-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Break from a loop -- -- This library provides a simple and general API for exiting from loops -- -- Read the tutorial in Control.Break to learn more @package break @version 1.0.2 -- | Example usage: -- --
--   import Control.Break
--   import Control.Monad.State
--   import Prelude hiding (break)
--   
--   example :: State Int ()
--   example = loop (do
--       n <- lift get                -- Inside a `loop`, wrap commands in `lift`
--       if n < 10
--           then lift (put (n + 1))  -- You keep looping by default
--           else break () )          -- Use `break` to exit from the `loop`
--   
-- -- The loop command runs the given command repeatedly until the -- command breaks from the loop using break: -- --
--   >>> execState example 0
--   10
--   
-- -- For some effects (like State), you can omit lift: -- --
--   example :: State Int ()
--   example = loop (do
--       n <- get
--       if n < 10
--           then put (n + 1)
--           else break () )
--   
-- -- The loop will return whatever value you supply to break: -- --
--   example :: State Int Bool
--   example = loop (do
--       n <- get
--       if n < 10
--           then put (n + 1)
--           else break True )
--   
-- --
--   >>> runState example 0
--   (True,10)
--   
module Control.Break -- | For the most common use cases you will: -- -- -- -- The meaning of the type parameters: -- -- data Break r m a -- | (loop m) runs the action 'm' repeatedly until you -- break from the loop loop :: Monad m => Break r m () -> m r -- | break from a loop -- -- The argument you supply to break is the return value of the -- loop break :: Monad m => r -> Break r m a -- | Lift a computation from the argument monad to the constructed monad. lift :: MonadTrans t => forall (m :: * -> *) a. Monad m => m a -> t m a instance Control.Monad.Reader.Class.MonadReader d m => Control.Monad.Reader.Class.MonadReader d (Control.Break.Break r m) instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Break.Break r m) instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Control.Break.Break r m) instance Control.Monad.Cont.Class.MonadCont m => Control.Monad.Cont.Class.MonadCont (Control.Break.Break r m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Break.Break r m) instance Control.Monad.Trans.Class.MonadTrans (Control.Break.Break r) instance GHC.Base.Monad m => GHC.Base.Monad (Control.Break.Break r m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Break.Break r m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Break.Break r m)