aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/Internal.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2019-07-21 13:37:25 +0200
committerYann Herklotz <git@yannherklotz.com>2019-07-21 13:37:25 +0200
commit30fbe26f59e54a276f88650ffa5e78343b5411eb (patch)
treeaa3166c423f262ee6296826d2c815a0b54084c31 /src/VeriFuzz/Internal.hs
parentb5c035e45949945cc62845fa6492cffa77992524 (diff)
parentc19a51a8156bbcaee13d9819c8fe54ed0ca5c4cc (diff)
downloadverismith-30fbe26f59e54a276f88650ffa5e78343b5411eb.tar.gz
verismith-30fbe26f59e54a276f88650ffa5e78343b5411eb.zip
Merge branch 'master' into fix/resize-modports
Diffstat (limited to 'src/VeriFuzz/Internal.hs')
-rw-r--r--src/VeriFuzz/Internal.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/VeriFuzz/Internal.hs b/src/VeriFuzz/Internal.hs
index 22efa92..b5ce3ba 100644
--- a/src/VeriFuzz/Internal.hs
+++ b/src/VeriFuzz/Internal.hs
@@ -14,13 +14,24 @@ module VeriFuzz.Internal
( -- * Useful functions
safe
, showT
+ , showBS
, comma
, commaNL
)
where
-import Data.Text (Text)
-import qualified Data.Text as T
+import Data.ByteString ( ByteString )
+import Data.ByteString.Builder ( byteStringHex
+ , toLazyByteString
+ )
+import qualified Data.ByteString.Lazy as L
+import Data.Text ( Text )
+import qualified Data.Text as T
+import Data.Text.Encoding ( decodeUtf8 )
+
+-- | Function to show a bytestring in a hex format.
+showBS :: ByteString -> Text
+showBS = decodeUtf8 . L.toStrict . toLazyByteString . byteStringHex
-- | Converts unsafe list functions in the Prelude to a safe version.
safe :: ([a] -> b) -> [a] -> Maybe b