Skip to content

Commit

Permalink
Merge pull request #435 from robkorn/bytestring-builtins-prelude
Browse files Browse the repository at this point in the history
Added Take/Drop/Concat ByteString Builtins To PlutusTx Prelude
  • Loading branch information
michaelpj authored Dec 26, 2018
2 parents 727151d + a1e7787 commit 595b723
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions plutus-tx/src/Language/PlutusTx/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ module Language.PlutusTx.Prelude (
ByteString,
sha2_256,
sha3_256,
equalsByteString
equalsByteString,
takeByteString,
dropByteString,
concatenate
) where

import Data.ByteString.Lazy (ByteString)
Expand Down Expand Up @@ -219,4 +222,16 @@ sha3_256 = [|| Builtins.sha3_256 ||]

-- | Check if two 'ByteString's are equal
equalsByteString :: Q (TExp (ByteString -> ByteString -> Bool))
equalsByteString = [|| Builtins.equalsByteString ||]
equalsByteString = [|| Builtins.equalsByteString ||]

-- | Returns the n length prefix of a 'ByteString'
takeByteString :: Q (TExp (Int -> ByteString -> ByteString))
takeByteString = [|| Builtins.takeByteString ||]

-- | Returns the suffix of a 'ByteString' after n elements
dropByteString :: Q (TExp (Int -> ByteString -> ByteString))
dropByteString = [|| Builtins.dropByteString ||]

-- | Concatenates two 'ByteString's together.
concatenate :: Q (TExp (ByteString -> ByteString -> ByteString))
concatenate = [|| Builtins.concatenate ||]

0 comments on commit 595b723

Please sign in to comment.