StrategyLibContentsIndex
MonadicFunctions
Portability portable
Stability experimental
Maintainer Ralf Laemmel, Joost Visser
Contents
The identity monad
Recover from partiality
Prototypes for strategy combinators seq, let, choice
Guards and conditionals
Description
This module is part of StrategyLib, a library of functional strategy combinators, including combinators for generic traversal. This module defines auxilliary monadic functions, some of which serve as parametric polymorphic prototypes for actual strategy combinators.
Synopsis
newtype Id a = Id a
unId :: Id a -> a
succeed :: Maybe x -> x
mseq :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
mlet :: Monad m => (a -> m b) -> (b -> a -> m c) -> a -> m c
mchoice :: MonadPlus m => (a -> m b) -> (a -> m b) -> a -> m b
argtype :: MonadPlus m => (x -> y) -> x -> m ()
valtype :: MonadPlus m => x -> x -> m ()
ifM :: MonadPlus m => m a -> (a -> m c) -> m c -> m c
The identity monad
newtype Id a
Identity type constructor.
Constructors
Id a
Instances
Monad Id
unId :: Id a -> a
Unwrap identity type constructor
Recover from partiality
succeed :: Maybe x -> x
Force success. If the argument value corresponds to failure, a run-time error will occur.
Prototypes for strategy combinators seq, let, choice
mseq :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
Sequential composition of monadic functions
mlet :: Monad m => (a -> m b) -> (b -> a -> m c) -> a -> m c
Sequential composition with value passing; a kind of monadic let.
mchoice :: MonadPlus m => (a -> m b) -> (a -> m b) -> a -> m b
Choice combinator for monadic functions
Guards and conditionals
argtype :: MonadPlus m => (x -> y) -> x -> m ()
Type guard described by the argument type of a function.
valtype :: MonadPlus m => x -> x -> m ()
Type guard described by a type of a value.
ifM :: MonadPlus m => m a -> (a -> m c) -> m c -> m c
A kind of monadic conditional.
Produced by Haddock version 0.6