packages feed

potoki 0.10.6 → 0.11

raw patch · 2 files changed

+20/−6 lines, 2 filesnew-uploader

Files

library/Potoki/Transform.hs view
@@ -19,7 +19,9 @@   builderChunks,   executeIO,   mapInIO,-  state,+  runState,+  execState,+  evalState,   -- * Parsing   parseBytes,   parseText,@@ -224,9 +226,9 @@ by producing a list of outputs and then composing the transform with the "list" transform. -}-{-# INLINE state #-}-state :: (a -> O.State s b) -> s -> Transform a b-state stateFn initialState =+{-# INLINE runState #-}+runState :: (a -> O.State s b) -> s -> Transform a (s, b)+runState stateFn initialState =   Transform $ \ (A.Fetch fetchIO) -> do     stateRef <- newIORef initialState     return $ A.Fetch $ \ nil just -> do@@ -239,8 +241,20 @@             case O.runState (stateFn input) currentState of               (output, newState) -> do                 writeIORef stateRef newState-                return (just output)+                return (just (newState, output))         in join (fetchIO nilIO justIO)++{-# INLINE evalState #-}+evalState :: (a -> O.State s b) -> s -> Transform a b+evalState stateFn initialState =+  runState stateFn initialState >>> arr snd+++{-# INLINE execState #-}+execState :: (a -> O.State s b) -> s -> Transform a s+execState stateFn initialState =+  runState stateFn initialState >>> arr fst+    {-# INLINE list #-} list :: Transform [a] a
potoki.cabal view
@@ -1,7 +1,7 @@ name:   potoki version:-  0.10.6+  0.11 synopsis:   Simple streaming in IO description: