loop-dsl-0.1.0.0: monadic loop dsl.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Loop.Internal

Synopsis

Documentation

data Loop m a where Source #

Constructors

For :: t a -> Loop m (t a) 
While :: Loop m (t a) -> (a -> Bool) -> Loop m (t a, a -> Bool) 

for :: Traversable t => t a -> Loop m (t a) Source #

for clause to start a loop

while :: Traversable t => Loop m (t a) -> (a -> Bool) -> Loop m (t a, a -> Bool) Source #

while clause to determine the terminal condition of a loop.

  for [(0::Int)..] `while` (<10) `with` \(i::Int) -> lift do
    putStrLn "hi"

evalLoop :: Monad m => Loop m a -> m a Source #

with_ :: (Traversable t, Monad m) => Loop m (t a) -> (a -> ExceptT () m ()) -> m () Source #

start a for-each style loop.

enumerateTrav :: (Traversable t, Integral n) => t a -> t (n, a) Source #

withi_ :: (Traversable t, Monad m, Integral n) => Loop m (t a) -> ((n, a) -> ExceptT () m ()) -> m () Source #

start a for-each style loop with access to indices.

withWhile_ :: (Traversable t, Monad m) => Loop m (t a, a -> Bool) -> (a -> ExceptT () m ()) -> m () Source #

start a for-each style loop with while clause.

withWhilei_ :: (Traversable t, Monad m, Integral n) => Loop m (t a, a -> Bool) -> ((n, a) -> ExceptT () m ()) -> m () Source #

start a for-each style loop with while clause and access to indices.

quit :: Monad m => ExceptT () m a Source #

break to the outer loop.

cease :: Monad m => ExceptT () m a Source #

break to the outer most loop.