Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ module Cardano.Api
, module Cardano.Api.Key
, module Cardano.Api.Hash

-- * HasTypeProxy
, module Cardano.Api.HasTypeProxy

-- * Transaction building
, module Cardano.Api.Tx

Expand Down
4 changes: 4 additions & 0 deletions cardano-api/src/Cardano/Api/HasTypeProxy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module Cardano.Api.HasTypeProxy
, AsType (..)
, Proxy (..)
, FromSomeType (..)
, asTypeFromValue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you have to export it from Cardano.Api as well?

)
where

Expand Down Expand Up @@ -39,6 +40,9 @@ instance HasTypeProxy BS.ByteString where
data AsType BS.ByteString = AsByteString
proxyToAsType _ = AsByteString

asTypeFromValue :: HasTypeProxy t => t -> AsType t
asTypeFromValue _ = proxyToAsType Proxy

Copy link
Contributor

@carbolymer carbolymer Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be useful too:

Suggested change
asType :: HasTypeProxy t => AsType t
asType = proxyToAsType Proxy

data FromSomeType (c :: Type -> Constraint) b where
FromSomeType :: c a => AsType a -> (a -> b) -> FromSomeType c b

Expand Down
Loading