Skip to content

Commit e8bcfe9

Browse files
committed
New asTypeFromValue function
1 parent 83e0e04 commit e8bcfe9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module Cardano.Api.HasTypeProxy
99
, AsType (..)
1010
, Proxy (..)
1111
, FromSomeType (..)
12+
, asTypeFromValue
1213
)
1314
where
1415

@@ -39,6 +40,9 @@ instance HasTypeProxy BS.ByteString where
3940
data AsType BS.ByteString = AsByteString
4041
proxyToAsType _ = AsByteString
4142

43+
asTypeFromValue :: HasTypeProxy t => t -> AsType t
44+
asTypeFromValue _ = proxyToAsType Proxy
45+
4246
data FromSomeType (c :: Type -> Constraint) b where
4347
FromSomeType :: c a => AsType a -> (a -> b) -> FromSomeType c b
4448

0 commit comments

Comments
 (0)