Skip to content

Commit e2c8c26

Browse files
authored
Merge pull request #1031 from IntersectMBO/mgalazyn/chore/add-show-astype
Add `Show (AsType a)` instance
2 parents c2cf462 + c6c3cce commit e2c8c26

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cardano-api/src/Cardano/Api/HasTypeProxy.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ where
1515
import Data.ByteString qualified as BS
1616
import Data.ByteString.Lazy qualified as BSL
1717
import Data.Kind (Constraint, Type)
18-
import Data.Proxy (Proxy (..))
19-
import Data.Typeable (Typeable)
18+
import Data.Typeable
2019
import Data.Word (Word16, Word8)
2120
import Numeric.Natural (Natural)
2221

@@ -29,6 +28,10 @@ class Typeable t => HasTypeProxy t where
2928

3029
proxyToAsType :: Proxy t -> AsType t
3130

31+
-- | Generalised show instance for all singletons of 'AsType' displaying the type.
32+
instance Typeable t => Show (AsType t) where
33+
show = show . typeOf
34+
3235
instance HasTypeProxy Word8 where
3336
data AsType Word8 = AsWord8
3437
proxyToAsType _ = AsWord8

0 commit comments

Comments
 (0)