Skip to content

Commit 7abe88f

Browse files
committed
New asTypeFromValue function
1 parent 4690809 commit 7abe88f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

cardano-api/src/Cardano/Api.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ module Cardano.Api
4848
, module Cardano.Api.Key
4949
, module Cardano.Api.Hash
5050

51+
-- * HasTypeProxy
52+
, module Cardano.Api.HasTypeProxy
53+
5154
-- * Transaction building
5255
, module Cardano.Api.Tx
5356

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)