Permalink
Browse files

[Plutus Core] [Pretty-printing] pad with zeroes when pretty-printing …

…bytestring literals
  • Loading branch information...
Mario Alvarez-Picallo
Mario Alvarez-Picallo committed Feb 11, 2019
1 parent b55f69a commit c2a08a5b3e48e5212b65a279b46848c17626b8ce
@@ -149,7 +149,10 @@ data Token a = LexName { loc :: a
deriving (Show, Eq, Generic, NFData)

asBytes :: Word8 -> Doc a
asBytes = Text 2 . T.pack . ($ mempty) . showHex
asBytes x = Text 2 $ T.pack $ addLeadingZero $ ($ mempty) $ showHex x
where addLeadingZero
| x < 16 = ("0" ++)
| otherwise = id

prettyBytes :: BSL.ByteString -> Doc a
prettyBytes b = "#" <> fold (asBytes <$> BSL.unpack b)
@@ -1,3 +1,3 @@
(program 0.1.0
(con 100 ! #4321758fabce1aa478193fb)
(con 100 ! #4321758fabce1aa4780193fb)
)

0 comments on commit c2a08a5

Please sign in to comment.