From 4d0d42425aceabc6d7c173060db47c11aa804e29 Mon Sep 17 00:00:00 2001 From: William Rusnack Date: Tue, 13 Feb 2024 13:00:19 -0500 Subject: [PATCH] Added MonoPointed instance for bytestring Builder --- mono-traversable/src/Data/MonoTraversable.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mono-traversable/src/Data/MonoTraversable.hs b/mono-traversable/src/Data/MonoTraversable.hs index 8e88451a..078f7438 100644 --- a/mono-traversable/src/Data/MonoTraversable.hs +++ b/mono-traversable/src/Data/MonoTraversable.hs @@ -33,6 +33,7 @@ import Control.Category import Control.Monad (Monad (..)) import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L +import qualified Data.ByteString.Builder as B import qualified Data.Foldable as F import Data.Functor import Data.Maybe (fromMaybe) @@ -106,6 +107,7 @@ import Control.Monad.Trans.Identity (IdentityT) type family Element mono type instance Element S.ByteString = Word8 type instance Element L.ByteString = Word8 +type instance Element B.Builder = Word8 type instance Element T.Text = Char type instance Element TL.Text = Char type instance Element [a] = a @@ -1140,6 +1142,9 @@ instance MonoPointed S.ByteString where instance MonoPointed L.ByteString where opoint = L.singleton {-# INLINE opoint #-} +instance MonoPointed B.Builder where + opoint = B.word8 + {-# INLINE opoint #-} instance MonoPointed T.Text where opoint = T.singleton {-# INLINE opoint #-}