-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parsing infrastructure for the pipes ecosystem -- -- This package defines the generic machinery necessary for common -- parsing tasks using pipes: -- -- -- -- Import Control.Proxy.Parse to use this library. -- -- Read Control.Proxy.Parse.Tutorial for an introductory -- tutorial. @package pipes-parse @version 1.0.0 -- | Parsing utilities for pipes module Control.Proxy.Parse -- | Like request (), except try to use the leftovers buffer first -- -- A Nothing return value indicates end of input. draw :: (Monad m, Proxy p) => StateP [a] p () (Maybe a) y' y m (Maybe a) -- | Push an element back onto the leftovers buffer unDraw :: (Monad m, Proxy p) => a -> StateP [a] p x' x y' y m () -- | Peek at the next element without consuming it peek :: (Monad m, Proxy p) => StateP [a] p () (Maybe a) y' y m (Maybe a) -- | Check if at end of input stream. isEndOfInput :: (Monad m, Proxy p) => StateP [a] p () (Maybe a) y' y m Bool -- | Fold all input into a list -- -- Note: drawAll is usually an anti-pattern. drawAll :: (Monad m, Proxy p) => () -> StateP [a] p () (Maybe a) y' y m [a] -- | Consume the input completely, discarding all values skipAll :: (Monad m, Proxy p) => () -> StateP [a] p () (Maybe a) y' y m () -- | Forward up to the specified number of elements downstream passUpTo :: (Monad m, Proxy p) => Int -> () -> Pipe (StateP [a] p) (Maybe a) (Maybe a) m r -- | Forward downstream as many consecutive elements satisfying a predicate -- as possible passWhile :: (Monad m, Proxy p) => (a -> Bool) -> () -> Pipe (StateP [a] p) (Maybe a) (Maybe a) m r -- | Guard a pipe from terminating by wrapping every output in Just -- and ending with a never-ending stream of Nothings. wrap :: (Monad m, Proxy p) => p a' a b' b m r -> p a' a b' (Maybe b) m s -- | Compose unwrap downstream of a guarded pipe to unwrap all -- Justs and terminate on the first Nothing. unwrap :: (Monad m, Proxy p) => x -> p x (Maybe a) x a m () -- | Lift a Maybe-oblivious pipe to a Maybe-aware pipe by -- auto-forwarding all Nothings. -- --
--   fmapPull f >-> fmapPull g = fmapPull (f >-> g)
--   
--   fmapPull pull = pull
--   
fmapPull :: (Monad m, Proxy p) => (x -> p x a x b m r) -> (x -> p x (Maybe a) x (Maybe b) m r) -- | Wrap all values flowing downstream in Just. returnPull :: (Monad m, Proxy p) => x -> p x a x (Maybe a) m r -- | Lift a Maybe-generating pipe to a Maybe-transforming -- pipe by auto-forwarding all Nothings -- --
--   -- Using: f >>> g = f >-> bindPull g
--   
--   returnPull >>> f = f
--   
--   f >>> returnPull = f
--   
--   (f >>> g) >>> h = f >>> (g >>> h)
--   
-- -- Or equivalently: -- --
--   returnPull >-> bindPull f = f
--   
--   bindPull returnPull = pull
--   
--   bindPull (f >-> bindPull g) = bindPull f >-> bindPull g
--   
bindPull :: (Monad m, Proxy p) => (x -> p x a x (Maybe b) m r) -> (x -> p x (Maybe a) x (Maybe b) m r) -- | zoom in on a sub-state using a Lens'. -- --
--   zoom :: Lens' s1 s2 -> StateP s2 p a' a b' b m r -> StateP s1 p a' a b' b m r
--   
-- --
--   zoom (f . g) = zoom f . zoom g
--   
--   zoom id = id
--   
zoom :: (Monad m, Proxy p) => ((s2 -> (s2, s2)) -> (s1 -> (s2, s1))) -> StateP s2 p a' a b' b m r -> StateP s1 p a' a b' b m r -- | A Lens' to the first element of a pair. -- -- Like _1, but more monomorphic -- --
--   _fst :: Lens' (a, b) a
--   
_fst :: Functor f => (a -> f b) -> ((a, x) -> f (b, x)) -- | A Lens' to the second element of a pair. -- -- Like _2, but more monomorphic -- --
--   _snd :: Lens' (a, b) b
--   
_snd :: Functor f => (a -> f b) -> ((x, a) -> f (x, b)) -- | This module provides the tutorial for the pipes-parse library -- -- This tutorial assumes that you have read the pipes tutorial -- in Control.Proxy.Tutorial. module Control.Proxy.Parse.Tutorial