ghc-7.10.3: The GHC API

Safe HaskellNone
LanguageHaskell2010

DsMonad

Synopsis

Documentation

mapM :: Traversable t => forall a m b. Monad m => (a -> m b) -> t a -> m (t b) Source

Map each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see mapM_.

mapAndUnzipM :: Monad m => (a -> m (b, c)) -> [a] -> m ([b], [c]) Source

The mapAndUnzipM function maps its first argument over a list, returning the result as a pair of lists. This function is mainly used with complicated data structures or a state-transforming monad.

fixDs :: (a -> DsM a) -> DsM a Source

foldlM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a Source

Monadic version of foldl

foldrM :: Monad m => (b -> a -> m a) -> a -> [b] -> m a Source

Monadic version of foldr

whenGOptM :: GeneralFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () Source

unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source

unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source

class Functor f => Applicative f where Source

A functor with application, providing operations to

  • embed pure expressions (pure), and
  • sequence computations and combine their results (<*>).

A minimal complete definition must include implementations of these functions satisfying the following laws:

identity
pure id <*> v = v
composition
pure (.) <*> u <*> v <*> w = u <*> (v <*> w)
homomorphism
pure f <*> pure x = pure (f x)
interchange
u <*> pure y = pure ($ y) <*> u

The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:

As a consequence of these laws, the Functor instance for f will satisfy

If f is also a Monad, it should satisfy

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

Minimal complete definition

pure, (<*>)

Methods

pure :: a -> f a Source

Lift a value.

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

Sequential application.

(*>) :: f a -> f b -> f b infixl 4 Source

Sequence actions, discarding the value of the first argument.

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

Sequence actions, discarding the value of the second argument.

Instances

Applicative [] 
Applicative IO 
Applicative Q 
Applicative Id 
Applicative P 
Applicative Identity 
Applicative ZipList 
Applicative STM 
Applicative First 
Applicative Last 
Applicative ReadPrec 
Applicative ReadP 
Applicative Maybe 
Applicative Seq 
Applicative VM 
Applicative SimpleUniqueMonad 
Applicative Pair 
Applicative UniqSM 
Applicative P 
Applicative LlvmM 
Applicative NatM 
Applicative OccCheckResult 
Applicative FCode 
Applicative CmmParse 
Applicative Hsc 
Applicative Ghc 
Applicative CompPipeline 
Applicative TcPluginM 
Applicative CoreM 
Applicative SimplM 
Applicative CpsRn 
Applicative VM 
Applicative TcS 
Applicative ((->) a) 
Applicative (Either e) 
Monoid a => Applicative ((,) a) 
Applicative (ST s) 
Applicative (StateL s) 
Applicative (StateR s) 
Applicative (ST s) 
Monoid m => Applicative (Const m) 
Monad m => Applicative (WrappedMonad m) 
Arrow a => Applicative (ArrowMonad a) 
Applicative (Proxy *) 
Applicative (State s) 
Monad m => Applicative (CheckingFuelMonad m) 
Monad m => Applicative (InfiniteFuelMonad m) 
Monad m => Applicative (UniqueMonadT m) 
Applicative (MaybeErr err) 
(Monad m, Functor m) => Applicative (MaybeT m) 
Applicative (State s) 
Applicative (CmdLineP s) 
Monad m => Applicative (EwM m) 
Applicative (IOEnv m) 
Applicative (RegM freeRegs) 
Applicative m => Applicative (GhcT m) 
Arrow a => Applicative (WrappedArrow a b) 
Applicative f => Applicative (Alt * f) 
(Functor m, Monad m) => Applicative (StateT s m) 
Monad m => Applicative (Stream m a) 

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

An infix synonym for fmap.

Examples

Convert from a Maybe Int to a Maybe String using show:

>>> show <$> Nothing
Nothing
>>> show <$> Just 3
Just "3"

Convert from an Either Int Int to an Either Int String using show:

>>> show <$> Left 17
Left 17
>>> show <$> Right 17
Right "17"

Double each element of a list:

>>> (*2) <$> [1,2,3]
[2,4,6]

Apply even to the second element of a pair:

>>> even <$> (2,2)
(2,True)

data UniqSupply Source

A value of type UniqSupply is unique, and it can supply one distinct Unique. Also, from the supply, one can also manufacture an arbitrary number of further UniqueSupply values, which will be distinct from the first and from all others.

dsGetStaticBindsVar :: DsM (IORef [(Fingerprint, (Id, CoreExpr))]) Source

Gets a reference to the SPT entries created so far.

dsDPHBuiltin :: (PArrBuiltin -> a) -> DsM a Source

Get a name from Data.Array.Parallel for the desugarer, from the ds_parr_bi component of the global desugerar environment.

data PArrBuiltin Source

Constructors

PArrBuiltin 

Fields

lengthPVar :: Var

lengthP

replicatePVar :: Var

replicateP

singletonPVar :: Var

singletonP

mapPVar :: Var

mapP

filterPVar :: Var

filterP

zipPVar :: Var

zipP

crossMapPVar :: Var

crossMapP

indexPVar :: Var

(!:)

emptyPVar :: Var

emptyP

appPVar :: Var

(+:+)

enumFromToPVar :: Var

enumFromToP

enumFromThenToPVar :: Var

enumFromThenToP

dsLookupDPHRdrEnv :: OccName -> DsM Name Source

Lookup a name exported by Prim or Prim. Panic if there isn't one, or if it is defined multiple times.

dsLookupDPHRdrEnv_maybe :: OccName -> DsM (Maybe Name) Source

Lookup a name exported by Prim or Prim, returning Nothing if it's not defined. Panic if it's defined multiple times.

data DsMetaVal Source

Constructors

DsBound Id 
DsSplice (HsExpr Id) 

data EquationInfo Source

Constructors

EqnInfo 

Fields

eqn_pats :: [Pat Id]
 
eqn_rhs :: MatchResult
 

data CanItFail Source

Constructors

CanFail 
CantFail