base-4.8.1.0: Basic libraries

Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Instances

Description

Deprecated: This module now contains no instances and will be removed in the future

This module is DEPRECATED and will be removed in the future!

Functor and Monad instances for (->) r and Functor instances for (,) a and Either a.

Synopsis

Documentation

class Functor f where Source

The Functor class is used for types that can be mapped over. Instances of Functor should satisfy the following laws:

fmap id  ==  id
fmap (f . g)  ==  fmap f . fmap g

The instances of Functor for lists, Maybe and IO satisfy these laws.

Minimal complete definition

fmap

Methods

fmap :: (a -> b) -> f a -> f b Source

(<$) :: a -> f b -> f a infixl 4 Source

Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

Instances

Functor [] Source 

Methods

fmap :: (a -> b) -> [a] -> [b] Source

(<$) :: a -> [b] -> [a] Source

Functor IO Source 

Methods

fmap :: (a -> b) -> IO a -> IO b Source

(<$) :: a -> IO b -> IO a Source

Functor Maybe Source 

Methods

fmap :: (a -> b) -> Maybe a -> Maybe b Source

(<$) :: a -> Maybe b -> Maybe a Source

Functor ReadP Source 

Methods

fmap :: (a -> b) -> ReadP a -> ReadP b Source

(<$) :: a -> ReadP b -> ReadP a Source

Functor ReadPrec Source 

Methods

fmap :: (a -> b) -> ReadPrec a -> ReadPrec b Source

(<$) :: a -> ReadPrec b -> ReadPrec a Source

Functor Last Source 

Methods

fmap :: (a -> b) -> Last a -> Last b Source

(<$) :: a -> Last b -> Last a Source

Functor First Source 

Methods

fmap :: (a -> b) -> First a -> First b Source

(<$) :: a -> First b -> First a Source

Functor STM Source 

Methods

fmap :: (a -> b) -> STM a -> STM b Source

(<$) :: a -> STM b -> STM a Source

Functor Handler Source 

Methods

fmap :: (a -> b) -> Handler a -> Handler b Source

(<$) :: a -> Handler b -> Handler a Source

Functor ZipList Source 

Methods

fmap :: (a -> b) -> ZipList a -> ZipList b Source

(<$) :: a -> ZipList b -> ZipList a Source

Functor Identity Source 

Methods

fmap :: (a -> b) -> Identity a -> Identity b Source

(<$) :: a -> Identity b -> Identity a Source

Functor ArgDescr Source 

Methods

fmap :: (a -> b) -> ArgDescr a -> ArgDescr b Source

(<$) :: a -> ArgDescr b -> ArgDescr a Source

Functor OptDescr Source 

Methods

fmap :: (a -> b) -> OptDescr a -> OptDescr b Source

(<$) :: a -> OptDescr b -> OptDescr a Source

Functor ArgOrder Source 

Methods

fmap :: (a -> b) -> ArgOrder a -> ArgOrder b Source

(<$) :: a -> ArgOrder b -> ArgOrder a Source

Functor ((->) r) Source 

Methods

fmap :: (a -> b) -> (->) r a -> (->) r b Source

(<$) :: a -> (->) r b -> (->) r a Source

Functor (Either a) Source 

Methods

fmap :: (b -> c) -> Either a b -> Either a c Source

(<$) :: b -> Either a c -> Either a b Source

Functor ((,) a) Source 

Methods

fmap :: (b -> c) -> (a, b) -> (a, c) Source

(<$) :: b -> (a, c) -> (a, b) Source

Functor (ST s) Source 

Methods

fmap :: (a -> b) -> ST s a -> ST s b Source

(<$) :: a -> ST s b -> ST s a Source

Functor (Proxy *) Source 

Methods

fmap :: (a -> b) -> Proxy * a -> Proxy * b Source

(<$) :: a -> Proxy * b -> Proxy * a Source

Arrow a => Functor (ArrowMonad a) Source 

Methods

fmap :: (b -> c) -> ArrowMonad a b -> ArrowMonad a c Source

(<$) :: b -> ArrowMonad a c -> ArrowMonad a b Source

Monad m => Functor (WrappedMonad m) Source 

Methods

fmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b Source

(<$) :: a -> WrappedMonad m b -> WrappedMonad m a Source

Functor (Const m) Source 

Methods

fmap :: (a -> b) -> Const m a -> Const m b Source

(<$) :: a -> Const m b -> Const m a Source

Functor (ST s) Source 

Methods

fmap :: (a -> b) -> ST s a -> ST s b Source

(<$) :: a -> ST s b -> ST s a Source

Functor f => Functor (Alt * f) Source 

Methods

fmap :: (a -> b) -> Alt * f a -> Alt * f b Source

(<$) :: a -> Alt * f b -> Alt * f a Source

Arrow a => Functor (WrappedArrow a b) Source 

Methods

fmap :: (c -> d) -> WrappedArrow a b c -> WrappedArrow a b d Source

(<$) :: c -> WrappedArrow a b d -> WrappedArrow a b c Source

class Applicative m => Monad m where Source

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.

Instances of Monad should satisfy the following laws:

Furthermore, the Monad and Applicative operations should relate as follows:

The above laws imply:

and that pure and (<*>) satisfy the applicative functor laws.

The instances of Monad for lists, Maybe and IO defined in the Prelude satisfy these laws.

Minimal complete definition

(>>=)

Methods

(>>=) :: forall a b. m a -> (a -> m b) -> m b infixl 1 Source

Sequentially compose two actions, passing any value produced by the first as an argument to the second.

(>>) :: forall a b. m a -> m b -> m b infixl 1 Source

Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.

return :: a -> m a Source

Inject a value into the monadic type.

fail :: String -> m a Source

Fail with a message. This operation is not part of the mathematical definition of a monad, but is invoked on pattern-match failure in a do expression.

Instances

Monad [] Source 

Methods

(>>=) :: [a] -> (a -> [b]) -> [b] Source

(>>) :: [a] -> [b] -> [b] Source

return :: a -> [a] Source

fail :: String -> [a] Source

Monad IO Source 

Methods

(>>=) :: IO a -> (a -> IO b) -> IO b Source

(>>) :: IO a -> IO b -> IO b Source

return :: a -> IO a Source

fail :: String -> IO a Source

Monad Maybe Source 

Methods

(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b Source

(>>) :: Maybe a -> Maybe b -> Maybe b Source

return :: a -> Maybe a Source

fail :: String -> Maybe a Source

Monad ReadP Source 

Methods

(>>=) :: ReadP a -> (a -> ReadP b) -> ReadP b Source

(>>) :: ReadP a -> ReadP b -> ReadP b Source

return :: a -> ReadP a Source

fail :: String -> ReadP a Source

Monad ReadPrec Source 
Monad Last Source 

Methods

(>>=) :: Last a -> (a -> Last b) -> Last b Source

(>>) :: Last a -> Last b -> Last b Source

return :: a -> Last a Source

fail :: String -> Last a Source

Monad First Source 

Methods

(>>=) :: First a -> (a -> First b) -> First b Source

(>>) :: First a -> First b -> First b Source

return :: a -> First a Source

fail :: String -> First a Source

Monad STM Source 

Methods

(>>=) :: STM a -> (a -> STM b) -> STM b Source

(>>) :: STM a -> STM b -> STM b Source

return :: a -> STM a Source

fail :: String -> STM a Source

Monad Identity Source 
Monad ((->) r) Source 

Methods

(>>=) :: (->) r a -> (a -> (->) r b) -> (->) r b Source

(>>) :: (->) r a -> (->) r b -> (->) r b Source

return :: a -> (->) r a Source

fail :: String -> (->) r a Source

Monad (Either e) Source 

Methods

(>>=) :: Either e a -> (a -> Either e b) -> Either e b Source

(>>) :: Either e a -> Either e b -> Either e b Source

return :: a -> Either e a Source

fail :: String -> Either e a Source

Monad (ST s) Source 

Methods

(>>=) :: ST s a -> (a -> ST s b) -> ST s b Source

(>>) :: ST s a -> ST s b -> ST s b Source

return :: a -> ST s a Source

fail :: String -> ST s a Source

Monad (Proxy *) Source 

Methods

(>>=) :: Proxy * a -> (a -> Proxy * b) -> Proxy * b Source

(>>) :: Proxy * a -> Proxy * b -> Proxy * b Source

return :: a -> Proxy * a Source

fail :: String -> Proxy * a Source

ArrowApply a => Monad (ArrowMonad a) Source 

Methods

(>>=) :: ArrowMonad a b -> (b -> ArrowMonad a c) -> ArrowMonad a c Source

(>>) :: ArrowMonad a b -> ArrowMonad a c -> ArrowMonad a c Source

return :: b -> ArrowMonad a b Source

fail :: String -> ArrowMonad a b Source

Monad m => Monad (WrappedMonad m) Source 
Monad (ST s) Source 

Methods

(>>=) :: ST s a -> (a -> ST s b) -> ST s b Source

(>>) :: ST s a -> ST s b -> ST s b Source

return :: a -> ST s a Source

fail :: String -> ST s a Source

Monad f => Monad (Alt * f) Source 

Methods

(>>=) :: Alt * f a -> (a -> Alt * f b) -> Alt * f b Source

(>>) :: Alt * f a -> Alt * f b -> Alt * f b Source

return :: a -> Alt * f a Source

fail :: String -> Alt * f a Source