From 2eb37dfb7ca72b08fb3da15d4bdb7b77b428c18f Mon Sep 17 00:00:00 2001 From: Alice McKean Date: Sun, 1 Sep 2019 22:56:06 -0700 Subject: [PATCH] add monoidal unit for Bounded Builders --- src/Data/ByteArray/Builder/Small/Bounded.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Data/ByteArray/Builder/Small/Bounded.hs b/src/Data/ByteArray/Builder/Small/Bounded.hs index 429e0c5..892b36d 100644 --- a/src/Data/ByteArray/Builder/Small/Bounded.hs +++ b/src/Data/ByteArray/Builder/Small/Bounded.hs @@ -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) =