Skip to content

Commit 9612757

Browse files
committed
Add constructor-wrapping functions to Data.Builder.Catenable.Bytes
This makes it easier for library users to write code that can be migrated to other implementations of Builder.
1 parent 84809f0 commit 9612757

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Data/Builder/Catenable/Bytes.hs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ module Data.Builder.Catenable.Bytes
1515
-- * Create
1616
, bytes
1717
, byteArray
18+
-- * Mimic data constructors
19+
, cons
20+
, snoc
21+
, append
22+
, empty
1823
) where
1924

2025
import Prelude hiding (length)
@@ -84,3 +89,19 @@ bytes !b = Cons b Empty
8489

8590
byteArray :: ByteArray -> Builder
8691
byteArray !b = Cons (Bytes.fromByteArray b) Empty
92+
93+
snoc :: Builder -> Bytes -> Builder
94+
{-# inline snoc #-}
95+
snoc = Snoc
96+
97+
cons :: Bytes -> Builder -> Builder
98+
{-# inline cons #-}
99+
cons = Cons
100+
101+
empty :: Builder
102+
{-# inline empty #-}
103+
empty = Empty
104+
105+
append :: Builder -> Builder -> Builder
106+
{-# inline append #-}
107+
append = Append

0 commit comments

Comments
 (0)