diff --git a/library/Potoki/Transform.hs b/library/Potoki/Transform.hs
--- a/library/Potoki/Transform.hs
+++ b/library/Potoki/Transform.hs
@@ -16,6 +16,7 @@
   builderChunks,
   executeIO,
   mapInIO,
+  state,
   -- * Parsing
   parseBytes,
   parseText,
@@ -44,6 +45,7 @@
 import qualified Data.ByteString as J
 import qualified System.Directory as I
 import qualified Control.Concurrent.Chan.Unagi.Bounded as B
+import qualified Control.Monad.Trans.State.Strict as O
 import qualified Potoki.Transform.Concurrency as N
 
 
@@ -188,3 +190,34 @@
   Transform $ \ fetch -> do
     Transform transformIO <- io
     transformIO fetch
+
+{-# INLINE state #-}
+state :: (a -> O.State s [b]) -> s -> Transform a b
+state stateFn initialState =
+  Transform $ \ (A.Fetch fetchIO) -> do
+    stateRef <- newIORef initialState
+    bufferRef <- newIORef []
+    return $ A.Fetch $ \ nil just -> do
+      buffer <- readIORef bufferRef
+      case buffer of
+        head : tail -> do
+          writeIORef bufferRef tail
+          return (just head)
+        _ ->
+          let
+            nilCase =
+              return nil
+            justCase input =
+              do
+                currentState <- readIORef stateRef
+                case O.runState (stateFn input) currentState of
+                  (outputList, newState) -> case outputList of
+                    head : tail -> do
+                      writeIORef bufferRef tail
+                      writeIORef stateRef newState
+                      return (just head)
+                    _ -> do
+                      writeIORef bufferRef []
+                      writeIORef stateRef newState
+                      return nil
+            in join (fetchIO nilCase justCase)
diff --git a/potoki.cabal b/potoki.cabal
--- a/potoki.cabal
+++ b/potoki.cabal
@@ -1,7 +1,7 @@
 name:
   potoki
 version:
-  0.9
+  0.9.1
 synopsis:
   Simple streaming in IO
 description:
@@ -87,6 +87,7 @@
     potoki-core >=1.5 && <1.6,
     profunctors >=5.2 && <6,
     text >=1 && <2,
+    transformers >=0.5 && <0.6,
     unagi-chan >=0.4 && <0.5,
     unordered-containers >=0.2 && <0.3,
     vector >=0.12 && <0.13
