foldl-transduce 0.4.2.0 → 0.4.3.0
raw patch · 5 files changed
+32/−14 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Foldl.Transduce: break :: (a -> Bool) -> Transducer a a ()
+ Control.Foldl.Transduce.Textual: textualBreak :: TextualMonoid m => (Char -> Bool) -> Transducer m m ()
Files
- CHANGELOG +4/−0
- foldl-transduce.cabal +1/−1
- src/Control/Foldl/Transduce.hs +13/−6
- src/Control/Foldl/Transduce/Textual.hs +11/−4
- tests/tests.hs +3/−3
CHANGELOG view
@@ -1,3 +1,7 @@+# 0.4.3.0+- deprecated splitWhen in favor of break+- deprecated textualSplitWhen in favor of textualBreak+ # 0.4.2.0 - Added "trip" fold.
foldl-transduce.cabal view
@@ -1,5 +1,5 @@ Name: foldl-transduce-Version: 0.4.2.0+Version: 0.4.3.0 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3
src/Control/Foldl/Transduce.hs view
@@ -61,8 +61,8 @@ , chunksOf , splitAt , chunkedSplitAt- , splitWhen , splitLast+ , break , chunkedStripPrefix -- * Transducer utilities , foldify@@ -83,9 +83,11 @@ , module Data.Functor.Extend , module Control.Foldl , module Control.Comonad.Cofree+ -- * Deprecated+ , splitWhen ) where -import Prelude hiding (take,drop,splitAt,dropWhile)+import Prelude hiding (splitAt,break) import Data.Bifunctor import Data.Monoid@@ -112,7 +114,7 @@ >>> import Control.Foldl.Transduce >>> import Control.Applicative >>> import qualified Control.Comonad.Cofree as C->>> import Prelude hiding (splitAt,takeWhile,dropWhile)+>>> import Prelude hiding (splitAt,break) -} @@ -930,11 +932,11 @@ {-| ->>> L.fold (bisect (splitWhen (>3)) (reify id) ignore L.list) [1..5]+>>> L.fold (bisect (break (>3)) (reify id) ignore L.list) [1..5] [1,2,3] -}-splitWhen :: (a -> Bool) -> Transducer a a ()-splitWhen predicate = +break :: (a -> Bool) -> Transducer a a ()+break predicate = Transducer step SplitWhenConditionPending done where step SplitWhenConditionPending i = @@ -1001,3 +1003,8 @@ {- $reexports -}+++{-# DEPRECATED splitWhen "use break instead" #-}+splitWhen :: (a -> Bool) -> Transducer a a ()+splitWhen = break
src/Control/Foldl/Transduce/Textual.hs view
@@ -4,7 +4,10 @@ -- -- This module has transducers that work on 'Text' and other text-like types. module Control.Foldl.Transduce.Textual (+ -- * Splitters textualSplit+ , textualBreak+ -- * Deprecated , textualSplitWhen ) where @@ -22,6 +25,7 @@ -} + {-| >>> L.fold (folds (textualSplit (=='.')) L.list L.list) [".","bb.bb","c.c."]@@ -40,14 +44,13 @@ SplitWhenConditionEncountered | SplitWhenConditionPending - {-| ->>> L.fold (bisect (textualSplitWhen (=='.')) (reify id) ignore L.list) ["aa","bb.bb","cc"]+>>> L.fold (bisect (textualBreak (=='.')) (reify id) ignore L.list) ["aa","bb.bb","cc"] ["aa","bb"] -}-textualSplitWhen :: MT.TextualMonoid m => (Char -> Bool) -> Transducer m m ()-textualSplitWhen predicate = +textualBreak :: MT.TextualMonoid m => (Char -> Bool) -> Transducer m m ()+textualBreak predicate = Transducer step SplitWhenConditionPending done where step SplitWhenConditionPending (MT.break (const False) predicate -> (i0,i1)) = @@ -57,4 +60,8 @@ step SplitWhenConditionEncountered i = (SplitWhenConditionEncountered,[i],[]) done = mempty++{-# DEPRECATED textualSplitWhen "use textualBreak instead" #-}+textualSplitWhen :: MT.TextualMonoid m => (Char -> Bool) -> Transducer m m ()+textualSplitWhen = textualBreak
tests/tests.hs view
@@ -48,17 +48,17 @@ (L.fold (folds (chunksOf 3) L.list L.list) [1..7]) ] ,- testGroup "textualSplitWhen" $ + testGroup "textualBreak" $ [ testCase "beginwithdot" $ assertEqual mempty ".bb"- (L.fold (bisect (textualSplitWhen (=='.')) ignore (reify id) L.mconcat) ["aa",".bb"])+ (L.fold (bisect (textualBreak (=='.')) ignore (reify id) L.mconcat) ["aa",".bb"]) , testCase "endwithdot" $ assertEqual mempty "."- (L.fold (bisect (textualSplitWhen (=='.')) ignore (reify id) L.mconcat) ["aa","bb."])+ (L.fold (bisect (textualBreak (=='.')) ignore (reify id) L.mconcat) ["aa","bb."]) ] , testGroup "newline" $