From be830be7146691557d1a0559d51eb882f77578d0 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Mon, 5 Feb 2024 15:31:19 -0600 Subject: [PATCH] Expose HexString constructor --- src/Data/HexString.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Data/HexString.hs b/src/Data/HexString.hs index f8d8d24..2fa7d1b 100644 --- a/src/Data/HexString.hs +++ b/src/Data/HexString.hs @@ -6,7 +6,7 @@ {-# LANGUAGE OverloadedStrings #-} module Data.HexString - ( HexString + ( HexString(..) , hexString , fromBinary , toBinary @@ -36,12 +36,12 @@ import qualified Generics.SOP as SOP -- | Represents a Hex string. Guarantees that all characters it contains -- are valid hex characters. -data HexString = - HexString BS.ByteString - deriving stock (Eq, Prelude.Show, GHC.Generic) - deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo) - deriving anyclass (Data.Structured.Show) - deriving (BorshSize, ToBorsh, FromBorsh) via AsStruct HexString +newtype HexString = HexString + { bytes :: BS.ByteString + } deriving stock (Eq, Prelude.Show, GHC.Generic) + deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo) + deriving anyclass (Data.Structured.Show) + deriving (BorshSize, ToBorsh, FromBorsh) via AsStruct HexString instance FromJSON HexString where parseJSON = withText "HexString" $ pure . hexString . TE.encodeUtf8