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

Control.Monad.Loop

Synopsis

Documentation

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"

class With m ret param where Source #

Methods

with :: Loop m ret -> (param -> ExceptT () m ()) -> m () Source #

Instances

Instances details
(Monad m, Traversable t) => With m (t a) a Source # 
Instance details

Defined in Control.Monad.Loop

Methods

with :: Loop m (t a) -> (a -> ExceptT () m ()) -> m () Source #

(Monad m, Traversable t, Integral n) => With m (t a) (n, a) Source # 
Instance details

Defined in Control.Monad.Loop

Methods

with :: Loop m (t a) -> ((n, a) -> ExceptT () m ()) -> m () Source #

(Monad m, Traversable t) => With m (t a, a -> Bool) a Source # 
Instance details

Defined in Control.Monad.Loop

Methods

with :: Loop m (t a, a -> Bool) -> (a -> ExceptT () m ()) -> m () Source #

(Monad m, Traversable t, Integral n) => With m (t a, a -> Bool) (n, a) Source # 
Instance details

Defined in Control.Monad.Loop

Methods

with :: Loop m (t a, a -> Bool) -> ((n, a) -> ExceptT () m ()) -> m () Source #

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

start a for-each style loop.

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.