Show instance for JSON

This commit is contained in:
Edsko de Vries 2023-03-23 18:27:59 +01:00
parent 1c5fef5162
commit 8aeada3529

View file

@ -24,6 +24,7 @@ import qualified Data.Aeson.Encoding as Aeson (unsafeToEncoding)
import qualified Data.Aeson.Types as Aeson (parseFail)
import qualified Data.Binary.Builder as Binary
import qualified Data.ByteString.Lazy as Lazy (ByteString)
import qualified Data.ByteString.Lazy.Char8 as Lazy.Char8
{-------------------------------------------------------------------------------
Serialisation
@ -34,6 +35,9 @@ newtype JSON = JSON Lazy.ByteString
deriving stock (Eq)
deriving newtype (BorshSize, ToBorsh, FromBorsh)
instance Show JSON where
show (JSON bs) = Lazy.Char8.unpack bs
-- | Types with a Rust-side JSON renderer
class ToJSON a where
toJSON :: a -> JSON