Monad +Control

class Monad m
base Prelude, base Control.Monad, base Control.Monad.Instances
The Monad class defines the basic operations over a monad, a concept from a branch of mathematics known as category theory. From the perspective of a Haskell programmer, however, it is best to think of a monad as an abstract datatype of actions. Haskell's do expressions provide a convenient syntax for writing monadic expressions. Minimal complete definition: >>= and return. Instances of Monad should satisfy the following laws: > return a >>= k == k a > m >>= return == m > m >>= (\x -> k x >>= h) == (m >>= k) >>= h Instances of both Monad and Functor should additionally satisfy the law: > fmap f xs == xs >>= return . f The instances of Monad for lists, Data.Maybe.Maybe and System.IO.IO defined in the Prelude satisfy these laws.
module Control.Monad
base Control.Monad
The Functor, Monad and MonadPlus classes, with some useful operations on monads.
class Monad m => MonadFix m
base Control.Monad.Fix
Monads having fixed points with a 'knot-tying' semantics. Instances of MonadFix should satisfy the following laws: * purity mfix (return . h) = return (fix h) * left shrinking (or tightening) mfix (\x -> a >>= \y -> f x y) = a >>= \y -> mfix (\x -> f x y) * sliding mfix (Control.Monad.liftM h . f) = Control.Monad.liftM h (mfix (f . h)), for strict h. * nesting mfix (\x -> mfix (\y -> f x y)) = mfix (\x -> f x x) This class is used in the translation of the recursive do notation supported by GHC and Hugs.
class Monad m => MonadPlus m
base Control.Monad
Monads that also support choice and failure.
package monad-abort-fd
package
This package provides automated lifting of operations via functional dependencies for the transformers-abort package. Version 0.4
package monad-atom
package
package monad-atom-simple
package
Monadically map objects to unique ints. Version 0.0.2
package monad-control
package
This package defines the type class MonadBaseControl, a subset of MonadBase into which generic control operations such as catch can be lifted from IO or any other base monad. Instances are based on monad transformers in MonadTransControl, which includes all standard monad transformers in the transformers library except ContT. See the lifted-base package which uses monad-control to lift IO operations from the base library (like catch or bracket) into any monad that is an instance of MonadBase or MonadBaseControl. Note that this package is a rewrite of Anders Kaseorg's monad-peel library. The main difference is that this package provides CPS style operators and exploits the RankNTypes and TypeFamilies language extensions to simplify and speedup most definitions. The following criterion based benchmark shows that monad-control is on average about 99% faster than monad-peel: git clone https://github.com/basvandijk/bench-monad-peel-control Version 0.3.1.3
package monad-coroutine
package
This package defines a monad transformer, applicable to any monad, that allows the monadic computation to suspend and to be later resumed. The transformer is parameterized by an arbitrary functor, used to store the suspended computation's resumption. Version 0.7.1
package monad-exception
package
Extensible exceptions are a good solution to the exception problem in Haskell. However, there is one problem: they are not extensible enough! The problem is that the functions defined in Control.Exception for dealing with exceptions can only be used with the IO monad. A lot of Haskell code uses a stack of monads, at the bottom of which is IO, but the IO monad is not used directly. There have been many attempts to solve this problem, but the stumbling block has been the presence of short-circuiting monad transformers: sometimes, these prevented the cleanup actions from being run, making it effectively impossible to catch exceptions in such monads. The monad-control package has been developed as a solution to this problem: it defines a way to turn a monad transformer stack "inside-out", which ensures that cleanup actions are run even when the original action short-circuits. The lifted-base package, built on top of monad-control, exports the Control.Exception.Lifted module, which contains versions of the Control.Exception functions that work on any monad stack with IO at its base. This has pretty much solved the above problems. However, one thing that the solutions that came before monad-control did was provide a type class encapsulating exception functionality that could be implemented by pure monads, allowing you to use the same interface to throw and catch exceptions in both pure and IO-based code. This also makes it possible to express which can throw an exception, but which don't necessarily do any IO and which are polymorphic in their exception throwing (i.e., you could run the function in IO and it would use throwIO, or you could run it as an Either and it would use Left). That's what this package does. It provides a MonadException type class (in the Control.Monad.Exception.Class module), which has instances for IO and IO-like monads (for which monad-control is used to provide the correct instances as described above), as well as for some pure monads. Several overlapping instances (in the spirit of mtl-evil-instances) are provided, so it is not necessary to provide a pass-through instance for MonadException for every monad transformer you write. This package also defines an ExceptionT monad transformer (in Control.Monad.Trans.Exception) that can be used to add MonadException functionality to otherwise pure monad stacks. mtl-evil-instances is used to automatically provide pass-through instances for the mtl type classes for this transformer. Finally, this package includes the module Control.Exception.Monadic, which is a full replacement for Control.Exception, whose functions work on any instance of MonadException and not just IO. The functions for dealing with asynchronous exceptions require IO however, so these are only polymorphic for any IO-like monadic (as determined by monad-control). Version 0.1
package monad-fork
package
package monad-interleave
package
A type class for monads that have an "unsafeInterleave" operation. Instances are provided for IO and both strict and lazy ST. Version 0.1
package monad-loops
package
Some useful control operators for looping. New in 0.3.2.0: various functions for traversing lists and computing minima/maxima using arbitrary procedures to compare or score the elements. Version 0.3.3.0
package monad-lrs
package
A monad to calculate linear recursive sequence efficiently. Matrix multiplication and fast exponentiation algorithm are used to speed up calculating the number with particular index in the sequence. This library also provides a monadic DSL to describe the sequence. Version 0.0.2.1
package monad-memo
package
Memoization monad transformer supporting mutual recursive function definitions and most of the standard monad transformers Version 0.3.0
package monad-mersenne-random
package
Often we need an efficient way to generate high quality pseudo-random numbers in Haskell. We have good generators themselves (for example, the mersenne-random-pure64 package), however, users are often tempted to store the generator in a lazy state monad. This causes performance problems. This package provides an optimized Rand monad for monadic generation of random numbers from a state, with close attention to performance. You may have results an order of magnitude or more better than using Control.Monad.State to store your generator. Version 0.1
package monad-par
package
This library offers an alternative parallel programming API to that provided by the parallel package. A Par monad allows the simple description of parallel computations, and can be used to add parallelism to pure Haskell code.  The basic API is straightforward: the monad supports forking and simple communication in terms of IVars. The library comes with a work-stealing implementation, but the internals are also exposed so that you can build your own scheduler if necessary. Examples of use can be found in the examples/ directory of the source package. The modules below provide additionaly schedulers, data structures, and other added capabilities layered on top of the Par monad. Version 0.3
package monad-par-extras
package
The modules below provide additional data structures, and other added capabilities layered on top of the Par monad. * Finish These * Module Descriptions Version 0.3.2
package monad-parallel
package
This package defines classes of monads that can perform multiple executions in parallel and combine their results. For any monad that's an instance of the class, the package re-implements a subset of the Control.Monad interface, but with parallel execution. Version 0.7.1
package monad-param
package
Implements parameterized monads by overloading the monad sugar with more liberal types. Version 0.0.4
package monad-peel
package
This package defines MonadPeelIO, a subset of MonadIO into which generic control operations such as catch can be lifted from IO. Instances are based on monad transformers in MonadTransPeel, which includes all standard monad transformers in the transformers library except ContT.  For convenience, it provides a wrapped version of Control.Exception with types generalized from IO to all monads in MonadPeelIO. Version 0.1
package monad-products
package
Haskell 98 monad products Version 0.2.1.2
package monad-ran
package
Fast implementations of monads and monad transformers using right Kan extensions Version 0.1.0
package monad-st
package
Provides a MonadST class Version 0.2.1.1
package monad-state
package
Utility library for monads, particularly those involving state Version 0.1.1.2
package monad-stlike-io
package
ST-like monad capturing variables to regions and supporting IO. Version 0.2.2
package monad-stlike-stm
package
ST-like monad capturing variables to regions and supporting STM. Version 0.1.1
package monad-supply
package
Support for computations which consume values from a (possibly infinite) supply. Version 0.2
package monad-tx
package
. Version 0.0.1
package monad-wrap
package
This package allows you to invoke a function on one monadic type passing it an argument of a different monadic type.  The canonical example of this is wanting to use a function such as finally :: IO a -> IO a to catch exceptions thrown by a computation x :: ReaderT MyConfig IO b. If x uses the ReaderT function ask, it cannot be re-written to run in the IO monad, and hence cannot be executed with a construction like lift (x ``finally`` cleanup). Instead, you must use the wrap method, provide by module Control.Monad.Wrap.  This package contains two further modules:  Control.Monad.MultiWrap implements mwrap, a method that behaves like wrap but allows wrapping through multiple nested layers of monad transformer. The module Control.Monad.MultiLift provides mlift, a version of lift that similarly lifts through multiple nested monad transformers. Version 0.0
package monadacme
package
The Acme and AcmeT monads. Version 0.0.2
package monadbi
package
This module provides a Class called MonadBi which acts as a superset of MonadTrans, and provides raise analogous to lift, i.e. lifts underlying monads into the transformer. It also provides lower which is the opposite of lift, and extracts underlying monads from monad transformers. Generally speaking, MonadBi represents the relationship between monads that can be transformed into each other (atleast partially). Natural instances are provided for many Monad Transformers. Version 0.1
package MonadCatchIO-mtl
package
Provides a monad-transformer version of the Control.Exception.catch function. For this, it defines the MonadCatchIO class, a subset of MonadIO. It defines proper instances for most monad transformers in the mtl library. Version 0.3.0.4
package MonadCatchIO-mtl-foreign
package
Functions like alloca are provided, except not restricted to IO. Version 0.1
package MonadCatchIO-transformers
package
Provides functions to throw and catch exceptions. Unlike the functions from Control.Exception, which work in IO, these work in any stack of monad transformers (from the transformers package) with IO as the base monad. You can extend this functionality to other monads, by creating an instance of the MonadCatchIO class. Version 0.3.0.0
package MonadCatchIO-transformers-foreign
package
Functions like alloca are provided, except not restricted to IO. Version 0.1
class Monad m => MonadCont m
mtl Control.Monad.Cont.Class, mtl Control.Monad.Cont
package monadcryptorandom
package
A monad for using CryptoRandomGen Version 0.4.1
package monadenv
package
a generic, typesafe environment Version 0.0-2005-02-14
class Monad m => MonadError e m | m -> e
mtl Control.Monad.Error.Class, mtl Control.Monad.Error
The strategy of combining computations that can throw exceptions by bypassing bound functions from the point an exception is thrown to the point that it is handled. Is parameterized over the type of error information and the monad type constructor. It is common to use Either String as the monad type constructor for an error monad in which error descriptions take the form of strings. In that case and many other common cases the resulting monad is already defined as an instance of the MonadError class. You can also define your own error type and/or use a monad type constructor other than Either String or Either IOError. In these cases you will have to explicitly define instances of the Error and/or MonadError classes.

Show more results