add laws tests for Chunks
This commit is contained in:
parent
da2be3281a
commit
d66a9e6880
3 changed files with 31 additions and 0 deletions
|
@ -27,6 +27,7 @@ import qualified Data.Primitive as PM
|
|||
data Chunks
|
||||
= ChunksCons {-# UNPACK #-} !Bytes !Chunks
|
||||
| ChunksNil
|
||||
deriving stock (Show)
|
||||
|
||||
instance Semigroup Chunks where
|
||||
ChunksNil <> a = a
|
||||
|
@ -37,6 +38,11 @@ instance Semigroup Chunks where
|
|||
instance Monoid Chunks where
|
||||
mempty = ChunksNil
|
||||
|
||||
instance Eq Chunks where
|
||||
-- TODO: There is a more efficient way to do this, but
|
||||
-- it is tedious.
|
||||
a == b = concat a == concat b
|
||||
|
||||
concat :: Chunks -> ByteArray
|
||||
concat x = ByteArray (concat# x)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue