From 8c44b6993cb096a5f902e90e51bf67c35b2ea1f9 Mon Sep 17 00:00:00 2001 From: William Rusnack Date: Mon, 8 Jul 2024 08:56:08 -0400 Subject: [PATCH] Added MonoPointed instance for text 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 df870562..4f0b449d 100644 --- a/mono-traversable/ChangeLog.md +++ b/mono-traversable/ChangeLog.md @@ -1,5 +1,10 @@ # ChangeLog for mono-traversable +## 1.0.18.0 + +* Added MonoPointed instance for text Builder + [#225](https://github.com/snoyberg/mono-traversable/pull/225) + ## 1.0.17.0 * Added `inits`, `tails`, `initTails` to class `IsSequence` with tests and benchmarks for `initTails`. diff --git a/mono-traversable/mono-traversable.cabal b/mono-traversable/mono-traversable.cabal index da954c6f..5e8710dd 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.17.1 +version: 1.0.18.0 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 0c7ff52e..d8a68e4f 100644 --- a/mono-traversable/package.yaml +++ b/mono-traversable/package.yaml @@ -1,5 +1,5 @@ name: mono-traversable -version: 1.0.17.1 +version: 1.0.18.0 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 4c00ed8a..85607c54 100644 --- a/mono-traversable/src/Data/MonoTraversable.hs +++ b/mono-traversable/src/Data/MonoTraversable.hs @@ -41,6 +41,7 @@ import Data.Monoid (Monoid (..), Any (..), All (..)) import Data.Proxy import qualified Data.Text as T import qualified Data.Text.Lazy as TL +import qualified Data.Text.Lazy.Builder as TB import Data.Traversable import Data.Word (Word8) import Data.Int (Int, Int64) @@ -111,6 +112,8 @@ type instance Element L.ByteString = Word8 type instance Element B.Builder = Word8 type instance Element T.Text = Char type instance Element TL.Text = Char +-- | @since 1.0.18.0 +type instance Element TB.Builder = Char type instance Element [a] = a type instance Element (IO a) = a type instance Element (ZipList a) = a @@ -1153,6 +1156,10 @@ instance MonoPointed T.Text where instance MonoPointed TL.Text where opoint = TL.singleton {-# INLINE opoint #-} +-- | @since 1.0.18.0 +instance MonoPointed TB.Builder where + opoint = TB.singleton + {-# INLINE opoint #-} -- Applicative instance MonoPointed [a]