add monoidal unit for Bounded Builders

This commit is contained in:
Alice McKean 2019-09-01 22:56:06 -07:00
parent 9a14600a38
commit 2eb37dfb7c

View file

@ -22,6 +22,7 @@ module Data.ByteArray.Builder.Small.Bounded
, pasteGrowST
, pasteIO
-- * Combine
, empty
, append
-- * Bounds Manipulation
, (<=)
@ -136,6 +137,10 @@ construct f = Builder
infixr 9 `append`
-- | The monoidal unit of `append`
empty :: Builder 0
empty = Builder $ \_ off0 s0 -> (# s0, off0 #)
-- | Concatenate two builders.
append :: Builder n -> Builder m -> Builder (n + m)
append (Builder f) (Builder g) =