Expose HexString constructor
This commit is contained in:
parent
268eb1cd53
commit
be830be714
1 changed files with 7 additions and 7 deletions
|
@ -6,7 +6,7 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module Data.HexString
|
module Data.HexString
|
||||||
( HexString
|
( HexString(..)
|
||||||
, hexString
|
, hexString
|
||||||
, fromBinary
|
, fromBinary
|
||||||
, toBinary
|
, toBinary
|
||||||
|
@ -36,12 +36,12 @@ import qualified Generics.SOP as SOP
|
||||||
|
|
||||||
-- | Represents a Hex string. Guarantees that all characters it contains
|
-- | Represents a Hex string. Guarantees that all characters it contains
|
||||||
-- are valid hex characters.
|
-- are valid hex characters.
|
||||||
data HexString =
|
newtype HexString = HexString
|
||||||
HexString BS.ByteString
|
{ bytes :: BS.ByteString
|
||||||
deriving stock (Eq, Prelude.Show, GHC.Generic)
|
} deriving stock (Eq, Prelude.Show, GHC.Generic)
|
||||||
deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo)
|
deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo)
|
||||||
deriving anyclass (Data.Structured.Show)
|
deriving anyclass (Data.Structured.Show)
|
||||||
deriving (BorshSize, ToBorsh, FromBorsh) via AsStruct HexString
|
deriving (BorshSize, ToBorsh, FromBorsh) via AsStruct HexString
|
||||||
|
|
||||||
instance FromJSON HexString where
|
instance FromJSON HexString where
|
||||||
parseJSON = withText "HexString" $ pure . hexString . TE.encodeUtf8
|
parseJSON = withText "HexString" $ pure . hexString . TE.encodeUtf8
|
||||||
|
|
Loading…
Reference in a new issue