From 66d7f53ff3c8c02de4e9a5b23c584b6041197869 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/ChangeLog.md | 5 +++++ mono-traversable/mono-traversable.cabal | 2 +- mono-traversable/package.yaml | 2 +- mono-traversable/src/Data/MonoTraversable.hs | 7 +++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mono-traversable/ChangeLog.md b/mono-traversable/ChangeLog.md index 820da807..dc918e30 100644 --- a/mono-traversable/ChangeLog.md +++ b/mono-traversable/ChangeLog.md @@ -1,5 +1,10 @@ # ChangeLog for mono-traversable +## 10.0.15.4 + +* Added MonoPointed instance for bytestring Builder + [#219](https://github.com/snoyberg/mono-traversable/pull/219#pullrequestreview-1879553961) + ## 1.0.15.3 * Compile with GHC 9.2 (`Option` removed from `base-4.16`) diff --git a/mono-traversable/mono-traversable.cabal b/mono-traversable/mono-traversable.cabal index 15d10d4b..339b5e91 100644 --- a/mono-traversable/mono-traversable.cabal +++ b/mono-traversable/mono-traversable.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: mono-traversable -version: 1.0.15.3 +version: 1.0.15.4 synopsis: Type classes for mapping, folding, and traversing monomorphic containers description: Please see the README at category: Data diff --git a/mono-traversable/package.yaml b/mono-traversable/package.yaml index 3992213c..9399b104 100644 --- a/mono-traversable/package.yaml +++ b/mono-traversable/package.yaml @@ -1,5 +1,5 @@ name: mono-traversable -version: 1.0.15.3 +version: 1.0.15.4 synopsis: Type classes for mapping, folding, and traversing monomorphic containers description: Please see the README at category: Data diff --git a/mono-traversable/src/Data/MonoTraversable.hs b/mono-traversable/src/Data/MonoTraversable.hs index 8e88451a..91e9f760 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,8 @@ import Control.Monad.Trans.Identity (IdentityT) type family Element mono type instance Element S.ByteString = Word8 type instance Element L.ByteString = Word8 +-- | @since 1.0.15.4 +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 +1143,10 @@ instance MonoPointed S.ByteString where instance MonoPointed L.ByteString where opoint = L.singleton {-# INLINE opoint #-} +-- | @since 1.0.15.4 +instance MonoPointed B.Builder where + opoint = B.word8 + {-# INLINE opoint #-} instance MonoPointed T.Text where opoint = T.singleton {-# INLINE opoint #-}