ghc-8.4.1: The GHC API

Safe HaskellNone
LanguageHaskell2010

DsMonad

Contents

Synopsis

Documentation

mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) #

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 :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c]) #

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.

initDs :: HscEnv -> TcGblEnv -> DsM a -> IO (Messages, Maybe a) Source #

Run a DsM action inside the IO monad.

initDsTc :: DsM a -> TcM a Source #

Run a DsM action inside the TcM monad.

initDsWithModGuts :: HscEnv -> ModGuts -> DsM a -> IO (Messages, Maybe a) Source #

Run a DsM action in the context of an existing ModGuts

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 #

A functor with application, providing operations to

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

A minimal complete definition must include implementations of pure and of either <*> or liftA2. If it defines both, then they must behave the same as their default definitions:

(<*>) = liftA2 id
liftA2 f x y = f <$> x <*> y

Further, any definition must satisfy the following:

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

It may be useful to note that supposing

forall x y. p (q x y) = f x . g y

it follows from the above that

liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v

If f is also a Monad, it should satisfy

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

Minimal complete definition

pure, ((<*>) | liftA2)

Methods

pure :: a -> f a #

Lift a value.

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

Sequential application.

A few functors support an implementation of <*> that is more efficient than the default one.

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

Sequence actions, discarding the value of the first argument.

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

Sequence actions, discarding the value of the second argument.

Instances
Applicative []

Since: 2.1

Instance details

Methods

pure :: a -> [a] #

(<*>) :: [a -> b] -> [a] -> [b] #

liftA2 :: (a -> b -> c) -> [a] -> [b] -> [c] #

(*>) :: [a] -> [b] -> [b] #

(<*) :: [a] -> [b] -> [a] #

Applicative Maybe

Since: 2.1

Instance details

Methods

pure :: a -> Maybe a #

(<*>) :: Maybe (a -> b) -> Maybe a -> Maybe b #

liftA2 :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c #

(*>) :: Maybe a -> Maybe b -> Maybe b #

(<*) :: Maybe a -> Maybe b -> Maybe a #

Applicative IO

Since: 2.1

Instance details

Methods

pure :: a -> IO a #

(<*>) :: IO (a -> b) -> IO a -> IO b #

liftA2 :: (a -> b -> c) -> IO a -> IO b -> IO c #

(*>) :: IO a -> IO b -> IO b #

(<*) :: IO a -> IO b -> IO a #

Applicative Par1

Since: 4.9.0.0

Instance details

Methods

pure :: a -> Par1 a #

(<*>) :: Par1 (a -> b) -> Par1 a -> Par1 b #

liftA2 :: (a -> b -> c) -> Par1 a -> Par1 b -> Par1 c #

(*>) :: Par1 a -> Par1 b -> Par1 b #

(<*) :: Par1 a -> Par1 b -> Par1 a #

Applicative Q 
Instance details

Methods

pure :: a -> Q a #

(<*>) :: Q (a -> b) -> Q a -> Q b #

liftA2 :: (a -> b -> c) -> Q a -> Q b -> Q c #

(*>) :: Q a -> Q b -> Q b #

(<*) :: Q a -> Q b -> Q a #

Applicative Complex

Since: 4.9.0.0

Instance details

Methods

pure :: a -> Complex a #

(<*>) :: Complex (a -> b) -> Complex a -> Complex b #

liftA2 :: (a -> b -> c) -> Complex a -> Complex b -> Complex c #

(*>) :: Complex a -> Complex b -> Complex b #

(<*) :: Complex a -> Complex b -> Complex a #

Applicative Min

Since: 4.9.0.0

Instance details

Methods

pure :: a -> Min a #

(<*>) :: Min (a -> b) -> Min a -> Min b #

liftA2 :: (a -> b -> c) -> Min a -> Min b -> Min c #

(*>) :: Min a -> Min b -> Min b #

(<*) :: Min a -> Min b -> Min a #

Applicative Max

Since: 4.9.0.0

Instance details

Methods

pure :: a -> Max a #

(<*>) :: Max (a -> b) -> Max a -> Max b #

liftA2 :: (a -> b -> c) -> Max a -> Max b -> Max c #

(*>) :: Max a -> Max b -> Max b #

(<*) :: Max a -> Max b -> Max a #

Applicative First

Since: 4.9.0.0

Instance details

Methods

pure :: a -> First a #

(<*>) :: First (a -> b) -> First a -> First b #

liftA2 :: (a -> b -> c) -> First a -> First b -> First c #

(*>) :: First a -> First b -> First b #

(<*) :: First a -> First b -> First a #

Applicative Last

Since: 4.9.0.0

Instance details

Methods

pure :: a -> Last a #

(<*>) :: Last (a -> b) -> Last a -> Last b #

liftA2 :: (a -> b -> c) -> Last a -> Last b -> Last c #

(*>) :: Last a -> Last b -> Last b #

(<*) :: Last a -> Last b -> Last a #

Applicative Option

Since: 4.9.0.0

Instance details

Methods

pure :: a -> Option a #

(<*>) :: Option (a -> b) -> Option a -> Option b #

liftA2 :: (a -> b -> c) -> Option a -> Option b -> Option c #

(*>) :: Option a -> Option b -> Option b #

(<*) :: Option a -> Option b -> Option a #

Applicative ZipList
f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN
    = 'ZipList' (zipWithN f xs1 ... xsN)

where zipWithN refers to the zipWith function of the appropriate arity (zipWith, zipWith3, zipWith4, ...). For example:

(\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..]
    = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..])
    = ZipList {getZipList = ["a5","b6b6","c7c7c7"]}

Since: 2.1

Instance details

Methods

pure :: a -> ZipList a #

(<*>) :: ZipList (a -> b) -> ZipList a -> ZipList b #

liftA2 :: (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c #

(*>) :: ZipList a -> ZipList b -> ZipList b #

(<*) :: ZipList a -> ZipList b -> ZipList a #

Applicative Identity

Since: 4.8.0.0

Instance details

Methods

pure :: a -> Identity a #

(<*>) :: Identity (a -> b) -> Identity a -> Identity b #

liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c #

(*>) :: Identity a -> Identity b -> Identity b #

(<*) :: Identity a -> Identity b -> Identity a #

Applicative STM

Since: 4.8.0.0

Instance details

Methods

pure :: a -> STM a #

(<*>) :: STM (a -> b) -> STM a -> STM b #

liftA2 :: (a -> b -> c) -> STM a -> STM b -> STM c #

(*>) :: STM a -> STM b -> STM b #

(<*) :: STM a -> STM b -> STM a #

Applicative First 
Instance details

Methods

pure :: a -> First a #

(<*>) :: First (a -> b) -> First a -> First b #

liftA2 :: (a -> b -> c) -> First a -> First b -> First c #

(*>) :: First a -> First b -> First b #

(<*) :: First a -> First b -> First a #

Applicative Last 
Instance details

Methods

pure :: a -> Last a #

(<*>) :: Last (a -> b) -> Last a -> Last b #

liftA2 :: (a -> b -> c) -> Last a -> Last b -> Last c #

(*>) :: Last a -> Last b -> Last b #

(<*) :: Last a -> Last b -> Last a #

Applicative Dual

Since: 4.8.0.0

Instance details

Methods

pure :: a -> Dual a #

(<*>) :: Dual (a -> b) -> Dual a -> Dual b #

liftA2 :: (a -> b -> c) -> Dual a -> Dual b -> Dual c #

(*>) :: Dual a -> Dual b -> Dual b #

(<*) :: Dual a -> Dual b -> Dual a #

Applicative Sum

Since: 4.8.0.0

Instance details

Methods

pure :: a -> Sum a #

(<*>) :: Sum (a -> b) -> Sum a -> Sum b #

liftA2 :: (a -> b -> c) -> Sum a -> Sum b -> Sum c #

(*>) :: Sum a -> Sum b -> Sum b #

(<*) :: Sum a -> Sum b -> Sum a #

Applicative Product

Since: 4.8.0.0

Instance details

Methods

pure :: a -> Product a #

(<*>) :: Product (a -> b) -> Product a -> Product b #

liftA2 :: (a -> b -> c) -> Product a -> Product b -> Product c #

(*>) :: Product a -> Product b -> Product b #

(<*) :: Product a -> Product b -> Product a #

Applicative Down

Since: 4.11.0.0

Instance details

Methods

pure :: a -> Down a #

(<*>) :: Down (a -> b) -> Down a -> Down b #

liftA2 :: (a -> b -> c) -> Down a -> Down b -> Down c #

(*>) :: Down a -> Down b -> Down b #

(<*) :: Down a -> Down b -> Down a #

Applicative ReadPrec

Since: 4.6.0.0

Instance details

Methods

pure :: a -> ReadPrec a #

(<*>) :: ReadPrec (a -> b) -> ReadPrec a -> ReadPrec b #

liftA2 :: (a -> b -> c) -> ReadPrec a -> ReadPrec b -> ReadPrec c #

(*>) :: ReadPrec a -> ReadPrec b -> ReadPrec b #

(<*) :: ReadPrec a -> ReadPrec b -> ReadPrec a #

Applicative ReadP

Since: 4.6.0.0

Instance details

Methods

pure :: a -> ReadP a #

(<*>) :: ReadP (a -> b) -> ReadP a -> ReadP b #

liftA2 :: (a -> b -> c) -> ReadP a -> ReadP b -> ReadP c #

(*>) :: ReadP a -> ReadP b -> ReadP b #

(<*) :: ReadP a -> ReadP b -> ReadP a #

Applicative NonEmpty

Since: 4.9.0.0

Instance details

Methods

pure :: a -> NonEmpty a #

(<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b #

liftA2 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c #

(*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b #

(<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a #

Applicative PutM 
Instance details

Methods

pure :: a -> PutM a #

(<*>) :: PutM (a -> b) -> PutM a -> PutM b #

liftA2 :: (a -> b -> c) -> PutM a -> PutM b -> PutM c #

(*>) :: PutM a -> PutM b -> PutM b #

(<*) :: PutM a -> PutM b -> PutM a #

Applicative Get 
Instance details

Methods

pure :: a -> Get a #

(<*>) :: Get (a -> b) -> Get a -> Get b #

liftA2 :: (a -> b -> c) -> Get a -> Get b -> Get c #

(*>) :: Get a -> Get b -> Get b #

(<*) :: Get a -> Get b -> Get a #

Applicative Put 
Instance details

Methods

pure :: a -> Put a #

(<*>) :: Put (a -> b) -> Put a -> Put b #

liftA2 :: (a -> b -> c) -> Put a -> Put b -> Put c #

(*>) :: Put a -> Put b -> Put b #

(<*) :: Put a -> Put b -> Put a #

Applicative Tree 
Instance details

Methods

pure :: a -> Tree a #

(<*>) :: Tree (a -> b) -> Tree a -> Tree b #

liftA2 :: (a -> b -> c) -> Tree a -> Tree b -> Tree c #

(*>) :: Tree a -> Tree b -> Tree b #

(<*) :: Tree a -> Tree b -> Tree a #

Applicative Seq

Since: 0.5.4

Instance details

Methods

pure :: a -> Seq a #

(<*>) :: Seq (a -> b) -> Seq a -> Seq b #

liftA2 :: (a -> b -> c) -> Seq a -> Seq b -> Seq c #

(*>) :: Seq a -> Seq b -> Seq b #

(<*) :: Seq a -> Seq b -> Seq a #

Applicative Capability 
Instance details

Methods

pure :: a -> Capability a #

(<*>) :: Capability (a -> b) -> Capability a -> Capability b #

liftA2 :: (a -> b -> c) -> Capability a -> Capability b -> Capability c #

(*>) :: Capability a -> Capability b -> Capability b #

(<*) :: Capability a -> Capability b -> Capability a #

Applicative P

Since: 4.5.0.0

Instance details

Methods

pure :: a -> P a #

(<*>) :: P (a -> b) -> P a -> P b #

liftA2 :: (a -> b -> c) -> P a -> P b -> P c #

(*>) :: P a -> P b -> P b #

(<*) :: P a -> P b -> P a #

Applicative Pair # 
Instance details

Methods

pure :: a -> Pair a #

(<*>) :: Pair (a -> b) -> Pair a -> Pair b #

liftA2 :: (a -> b -> c) -> Pair a -> Pair b -> Pair c #

(*>) :: Pair a -> Pair b -> Pair b #

(<*) :: Pair a -> Pair b -> Pair a #

Applicative UniqSM # 
Instance details

Methods

pure :: a -> UniqSM a #

(<*>) :: UniqSM (a -> b) -> UniqSM a -> UniqSM b #

liftA2 :: (a -> b -> c) -> UniqSM a -> UniqSM b -> UniqSM c #

(*>) :: UniqSM a -> UniqSM b -> UniqSM b #

(<*) :: UniqSM a -> UniqSM b -> UniqSM a #

Applicative P # 
Instance details

Methods

pure :: a -> P a #

(<*>) :: P (a -> b) -> P a -> P b #

liftA2 :: (a -> b -> c) -> P a -> P b -> P c #

(*>) :: P a -> P b -> P b #

(<*) :: P a -> P b -> P a #

Applicative PD # 
Instance details

Methods

pure :: a -> PD a #

(<*>) :: PD (a -> b) -> PD a -> PD b #

liftA2 :: (a -> b -> c) -> PD a -> PD b -> PD c #

(*>) :: PD a -> PD b -> PD b #

(<*) :: PD a -> PD b -> PD a #

Applicative UnifyResultM # 
Instance details
Applicative LlvmM # 
Instance details

Methods

pure :: a -> LlvmM a #

(<*>) :: LlvmM (a -> b) -> LlvmM a -> LlvmM b #

liftA2 :: (a -> b -> c) -> LlvmM a -> LlvmM b -> LlvmM c #

(*>) :: LlvmM a -> LlvmM b -> LlvmM b #

(<*) :: LlvmM a -> LlvmM b -> LlvmM a #

Applicative FCode # 
Instance details

Methods

pure :: a -> FCode a #

(<*>) :: FCode (a -> b) -> FCode a -> FCode b #

liftA2 :: (a -> b -> c) -> FCode a -> FCode b -> FCode c #

(*>) :: FCode a -> FCode b -> FCode b #

(<*) :: FCode a -> FCode b -> FCode a #

Applicative CmmParse # 
Instance details

Methods

pure :: a -> CmmParse a #

(<*>) :: CmmParse (a -> b) -> CmmParse a -> CmmParse b #

liftA2 :: (a -> b -> c) -> CmmParse a -> CmmParse b -> CmmParse c #

(*>) :: CmmParse a -> CmmParse b -> CmmParse b #

(<*) :: CmmParse a -> CmmParse b -> CmmParse a #

Applicative Hsc # 
Instance details

Methods

pure :: a -> Hsc a #

(<*>) :: Hsc (a -> b) -> Hsc a -> Hsc b #

liftA2 :: (a -> b -> c) -> Hsc a -> Hsc b -> Hsc c #

(*>) :: Hsc a -> Hsc b -> Hsc b #

(<*) :: Hsc a -> Hsc b -> Hsc a #

Applicative TcPluginM # 
Instance details

Methods

pure :: a -> TcPluginM a #

(<*>) :: TcPluginM (a -> b) -> TcPluginM a -> TcPluginM b #

liftA2 :: (a -> b -> c) -> TcPluginM a -> TcPluginM b -> TcPluginM c #

(*>) :: TcPluginM a -> TcPluginM b -> TcPluginM b #

(<*) :: TcPluginM a -> TcPluginM b -> TcPluginM a #

Applicative CompPipeline # 
Instance details
Applicative Ghc # 
Instance details

Methods

pure :: a -> Ghc a #

(<*>) :: Ghc (a -> b) -> Ghc a -> Ghc b #

liftA2 :: (a -> b -> c) -> Ghc a -> Ghc b -> Ghc c #

(*>) :: Ghc a -> Ghc b -> Ghc b #

(<*) :: Ghc a -> Ghc b -> Ghc a #

Applicative CoreM # 
Instance details

Methods

pure :: a -> CoreM a #

(<*>) :: CoreM (a -> b) -> CoreM a -> CoreM b #

liftA2 :: (a -> b -> c) -> CoreM a -> CoreM b -> CoreM c #

(*>) :: CoreM a -> CoreM b -> CoreM b #

(<*) :: CoreM a -> CoreM b -> CoreM a #

Applicative SimplM # 
Instance details

Methods

pure :: a -> SimplM a #

(<*>) :: SimplM (a -> b) -> SimplM a -> SimplM b #

liftA2 :: (a -> b -> c) -> SimplM a -> SimplM b -> SimplM c #

(*>) :: SimplM a -> SimplM b -> SimplM b #

(<*) :: SimplM a -> SimplM b -> SimplM a #

Applicative CpsRn # 
Instance details

Methods

pure :: a -> CpsRn a #

(<*>) :: CpsRn (a -> b) -> CpsRn a -> CpsRn b #

liftA2 :: (a -> b -> c) -> CpsRn a -> CpsRn b -> CpsRn c #

(*>) :: CpsRn a -> CpsRn b -> CpsRn b #

(<*) :: CpsRn a -> CpsRn b -> CpsRn a #

Applicative OccCheckResult # 
Instance details
Applicative TcS # 
Instance details

Methods

pure :: a -> TcS a #

(<*>) :: TcS (a -> b) -> TcS a -> TcS b #

liftA2 :: (a -> b -> c) -> TcS a -> TcS b -> TcS c #

(*>) :: TcS a -> TcS b -> TcS b #

(<*) :: TcS a -> TcS b -> TcS a #

Applicative VM # 
Instance details

Methods

pure :: a -> VM a #

(<*>) :: VM (a -> b) -> VM a -> VM b #

liftA2 :: (a -> b -> c) -> VM a -> VM b -> VM c #

(*>) :: VM a -> VM b -> VM b #

(<*) :: VM a -> VM b -> VM a #

Applicative NatM # 
Instance details

Methods

pure :: a -> NatM a #

(<*>) :: NatM (a -> b) -> NatM a -> NatM b #

liftA2 :: (a -> b -> c) -> NatM a -> NatM b -> NatM c #

(*>) :: NatM a -> NatM b -> NatM b #

(<*) :: NatM a -> NatM b -> NatM a #

Applicative (Either e)

Since: 3.0

Instance details

Methods

pure :: a -> Either e a #

(<*>) :: Either e (a -> b) -> Either e a -> Either e b #

liftA2 :: (a -> b -> c) -> Either e a -> Either e b -> Either e c #

(*>) :: Either e a -> Either e b -> Either e b #

(<*) :: Either e a -> Either e b -> Either e a #

Applicative (U1 :: * -> *)

Since: 4.9.0.0

Instance details

Methods

pure :: a -> U1 a #

(<*>) :: U1 (a -> b) -> U1 a -> U1 b #

liftA2 :: (a -> b -> c) -> U1 a -> U1 b -> U1 c #

(*>) :: U1 a -> U1 b -> U1 b #

(<*) :: U1 a -> U1 b -> U1 a #

Monoid a => Applicative ((,) a)

For tuples, the Monoid constraint on a determines how the first values merge. For example, Strings concatenate:

("hello ", (+15)) <*> ("world!", 2002)
("hello world!",2017)

Since: 2.1

Instance details

Methods

pure :: a0 -> (a, a0) #

(<*>) :: (a, a0 -> b) -> (a, a0) -> (a, b) #

liftA2 :: (a0 -> b -> c) -> (a, a0) -> (a, b) -> (a, c) #

(*>) :: (a, a0) -> (a, b) -> (a, b) #

(<*) :: (a, a0) -> (a, b) -> (a, a0) #

Applicative (ST s)

Since: 4.4.0.0

Instance details

Methods

pure :: a -> ST s a #

(<*>) :: ST s (a -> b) -> ST s a -> ST s b #

liftA2 :: (a -> b -> c) -> ST s a -> ST s b -> ST s c #

(*>) :: ST s a -> ST s b -> ST s b #

(<*) :: ST s a -> ST s b -> ST s a #

Monad m => Applicative (WrappedMonad m)

Since: 2.1

Instance details

Methods

pure :: a -> WrappedMonad m a #

(<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b #

liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c #

(*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b #

(<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a #

Arrow a => Applicative (ArrowMonad a)

Since: 4.6.0.0

Instance details

Methods

pure :: a0 -> ArrowMonad a a0 #

(<*>) :: ArrowMonad a (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b #

liftA2 :: (a0 -> b -> c) -> ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a c #

(*>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b #

(<*) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a a0 #

Applicative (Proxy :: * -> *)

Since: 4.7.0.0

Instance details

Methods

pure :: a -> Proxy a #

(<*>) :: Proxy (a -> b) -> Proxy a -> Proxy b #

liftA2 :: (a -> b -> c) -> Proxy a -> Proxy b -> Proxy c #

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

(<*) :: Proxy a -> Proxy b -> Proxy a #

(Functor m, Monad m) => Applicative (MaybeT m) 
Instance details

Methods

pure :: a -> MaybeT m a #

(<*>) :: MaybeT m (a -> b) -> MaybeT m a -> MaybeT m b #

liftA2 :: (a -> b -> c) -> MaybeT m a -> MaybeT m b -> MaybeT m c #

(*>) :: MaybeT m a -> MaybeT m b -> MaybeT m b #

(<*) :: MaybeT m a -> MaybeT m b -> MaybeT m a #

Applicative (ListT f) # 
Instance details

Methods

pure :: a -> ListT f a #

(<*>) :: ListT f (a -> b) -> ListT f a -> ListT f b #

liftA2 :: (a -> b -> c) -> ListT f a -> ListT f b -> ListT f c #

(*>) :: ListT f a -> ListT f b -> ListT f b #

(<*) :: ListT f a -> ListT f b -> ListT f a #

Applicative (State s) # 
Instance details

Methods

pure :: a -> State s a #

(<*>) :: State s (a -> b) -> State s a -> State s b #

liftA2 :: (a -> b -> c) -> State s a -> State s b -> State s c #

(*>) :: State s a -> State s b -> State s b #

(<*) :: State s a -> State s b -> State s a #

Applicative (MaybeErr err) # 
Instance details

Methods

pure :: a -> MaybeErr err a #

(<*>) :: MaybeErr err (a -> b) -> MaybeErr err a -> MaybeErr err b #

liftA2 :: (a -> b -> c) -> MaybeErr err a -> MaybeErr err b -> MaybeErr err c #

(*>) :: MaybeErr err a -> MaybeErr err b -> MaybeErr err b #

(<*) :: MaybeErr err a -> MaybeErr err b -> MaybeErr err a #

Applicative (SetM s) 
Instance details

Methods

pure :: a -> SetM s a #

(<*>) :: SetM s (a -> b) -> SetM s a -> SetM s b #

liftA2 :: (a -> b -> c) -> SetM s a -> SetM s b -> SetM s c #

(*>) :: SetM s a -> SetM s b -> SetM s b #

(<*) :: SetM s a -> SetM s b -> SetM s a #

Applicative (CmdLineP s) # 
Instance details

Methods

pure :: a -> CmdLineP s a #

(<*>) :: CmdLineP s (a -> b) -> CmdLineP s a -> CmdLineP s b #

liftA2 :: (a -> b -> c) -> CmdLineP s a -> CmdLineP s b -> CmdLineP s c #

(*>) :: CmdLineP s a -> CmdLineP s b -> CmdLineP s b #

(<*) :: CmdLineP s a -> CmdLineP s b -> CmdLineP s a #

Monad m => Applicative (EwM m) # 
Instance details

Methods

pure :: a -> EwM m a #

(<*>) :: EwM m (a -> b) -> EwM m a -> EwM m b #

liftA2 :: (a -> b -> c) -> EwM m a -> EwM m b -> EwM m c #

(*>) :: EwM m a -> EwM m b -> EwM m b #

(<*) :: EwM m a -> EwM m b -> EwM m a #

Applicative (IOEnv m) # 
Instance details

Methods

pure :: a -> IOEnv m a #

(<*>) :: IOEnv m (a -> b) -> IOEnv m a -> IOEnv m b #

liftA2 :: (a -> b -> c) -> IOEnv m a -> IOEnv m b -> IOEnv m c #

(*>) :: IOEnv m a -> IOEnv m b -> IOEnv m b #

(<*) :: IOEnv m a -> IOEnv m b -> IOEnv m a #

Applicative (RegM freeRegs) # 
Instance details

Methods

pure :: a -> RegM freeRegs a #

(<*>) :: RegM freeRegs (a -> b) -> RegM freeRegs a -> RegM freeRegs b #

liftA2 :: (a -> b -> c) -> RegM freeRegs a -> RegM freeRegs b -> RegM freeRegs c #

(*>) :: RegM freeRegs a -> RegM freeRegs b -> RegM freeRegs b #

(<*) :: RegM freeRegs a -> RegM freeRegs b -> RegM freeRegs a #

Applicative m => Applicative (GhcT m) # 
Instance details

Methods

pure :: a -> GhcT m a #

(<*>) :: GhcT m (a -> b) -> GhcT m a -> GhcT m b #

liftA2 :: (a -> b -> c) -> GhcT m a -> GhcT m b -> GhcT m c #

(*>) :: GhcT m a -> GhcT m b -> GhcT m b #

(<*) :: GhcT m a -> GhcT m b -> GhcT m a #

Applicative f => Applicative (Rec1 f)

Since: 4.9.0.0

Instance details

Methods

pure :: a -> Rec1 f a #

(<*>) :: Rec1 f (a -> b) -> Rec1 f a -> Rec1 f b #

liftA2 :: (a -> b -> c) -> Rec1 f a -> Rec1 f b -> Rec1 f c #

(*>) :: Rec1 f a -> Rec1 f b -> Rec1 f b #

(<*) :: Rec1 f a -> Rec1 f b -> Rec1 f a #

Arrow a => Applicative (WrappedArrow a b)

Since: 2.1

Instance details

Methods

pure :: a0 -> WrappedArrow a b a0 #

(<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 #

liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c #

(*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 #

(<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 #

Monoid m => Applicative (Const m :: * -> *)

Since: 2.0.1

Instance details

Methods

pure :: a -> Const m a #

(<*>) :: Const m (a -> b) -> Const m a -> Const m b #

liftA2 :: (a -> b -> c) -> Const m a -> Const m b -> Const m c #

(*>) :: Const m a -> Const m b -> Const m b #

(<*) :: Const m a -> Const m b -> Const m a #

Applicative f => Applicative (Alt f) 
Instance details

Methods

pure :: a -> Alt f a #

(<*>) :: Alt f (a -> b) -> Alt f a -> Alt f b #

liftA2 :: (a -> b -> c) -> Alt f a -> Alt f b -> Alt f c #

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

(<*) :: Alt f a -> Alt f b -> Alt f a #

(Applicative f, Monad f) => Applicative (WhenMissing f x)

Equivalent to ReaderT k (ReaderT x (MaybeT f)).

Since: 0.5.9

Instance details

Methods

pure :: a -> WhenMissing f x a #

(<*>) :: WhenMissing f x (a -> b) -> WhenMissing f x a -> WhenMissing f x b #

liftA2 :: (a -> b -> c) -> WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x c #

(*>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b #

(<*) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x a #

(Monoid w, Applicative m) => Applicative (WriterT w m) 
Instance details

Methods

pure :: a -> WriterT w m a #

(<*>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b #

liftA2 :: (a -> b -> c) -> WriterT w m a -> WriterT w m b -> WriterT w m c #

(*>) :: WriterT w m a -> WriterT w m b -> WriterT w m b #

(<*) :: WriterT w m a -> WriterT w m b -> WriterT w m a #

(Functor m, Monad m) => Applicative (StateT s m) 
Instance details

Methods

pure :: a -> StateT s m a #

(<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b #

liftA2 :: (a -> b -> c) -> StateT s m a -> StateT s m b -> StateT s m c #

(*>) :: StateT s m a -> StateT s m b -> StateT s m b #

(<*) :: StateT s m a -> StateT s m b -> StateT s m a #

(Functor m, Monad m) => Applicative (StateT s m) 
Instance details

Methods

pure :: a -> StateT s m a #

(<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b #

liftA2 :: (a -> b -> c) -> StateT s m a -> StateT s m b -> StateT s m c #

(*>) :: StateT s m a -> StateT s m b -> StateT s m b #

(<*) :: StateT s m a -> StateT s m b -> StateT s m a #

(Functor m, Monad m) => Applicative (ExceptT e m) 
Instance details

Methods

pure :: a -> ExceptT e m a #

(<*>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b #

liftA2 :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c #

(*>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b #

(<*) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a #

Monad m => Applicative (Stream m a) # 
Instance details

Methods

pure :: a0 -> Stream m a a0 #

(<*>) :: Stream m a (a0 -> b) -> Stream m a a0 -> Stream m a b #

liftA2 :: (a0 -> b -> c) -> Stream m a a0 -> Stream m a b -> Stream m a c #

(*>) :: Stream m a a0 -> Stream m a b -> Stream m a b #

(<*) :: Stream m a a0 -> Stream m a b -> Stream m a a0 #

Applicative ((->) a :: * -> *)

Since: 2.1

Instance details

Methods

pure :: a0 -> a -> a0 #

(<*>) :: (a -> a0 -> b) -> (a -> a0) -> a -> b #

liftA2 :: (a0 -> b -> c) -> (a -> a0) -> (a -> b) -> a -> c #

(*>) :: (a -> a0) -> (a -> b) -> a -> b #

(<*) :: (a -> a0) -> (a -> b) -> a -> a0 #

(Applicative f, Applicative g) => Applicative (f :*: g)

Since: 4.9.0.0

Instance details

Methods

pure :: a -> (f :*: g) a #

(<*>) :: (f :*: g) (a -> b) -> (f :*: g) a -> (f :*: g) b #

liftA2 :: (a -> b -> c) -> (f :*: g) a -> (f :*: g) b -> (f :*: g) c #

(*>) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) b #

(<*) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) a #

(Applicative f, Applicative g) => Applicative (Product f g)

Since: 4.9.0.0

Instance details

Methods

pure :: a -> Product f g a #

(<*>) :: Product f g (a -> b) -> Product f g a -> Product f g b #

liftA2 :: (a -> b -> c) -> Product f g a -> Product f g b -> Product f g c #

(*>) :: Product f g a -> Product f g b -> Product f g b #

(<*) :: Product f g a -> Product f g b -> Product f g a #

(Monad f, Applicative f) => Applicative (WhenMatched f x y)

Equivalent to ReaderT Key (ReaderT x (ReaderT y (MaybeT f)))

Since: 0.5.9

Instance details

Methods

pure :: a -> WhenMatched f x y a #

(<*>) :: WhenMatched f x y (a -> b) -> WhenMatched f x y a -> WhenMatched f x y b #

liftA2 :: (a -> b -> c) -> WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y c #

(*>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b #

(<*) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y a #

(Applicative f, Monad f) => Applicative (WhenMissing f k x)

Equivalent to ReaderT k (ReaderT x (MaybeT f)) .

Since: 0.5.9

Instance details

Methods

pure :: a -> WhenMissing f k x a #

(<*>) :: WhenMissing f k x (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b #

liftA2 :: (a -> b -> c) -> WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x c #

(*>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b #

(<*) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x a #

Applicative m => Applicative (ReaderT r m) 
Instance details

Methods

pure :: a -> ReaderT r m a #

(<*>) :: ReaderT r m (a -> b) -> ReaderT r m a -> ReaderT r m b #

liftA2 :: (a -> b -> c) -> ReaderT r m a -> ReaderT r m b -> ReaderT r m c #

(*>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b #

(<*) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m a #

Applicative f => Applicative (M1 i c f)

Since: 4.9.0.0

Instance details

Methods

pure :: a -> M1 i c f a #

(<*>) :: M1 i c f (a -> b) -> M1 i c f a -> M1 i c f b #

liftA2 :: (a -> b -> c0) -> M1 i c f a -> M1 i c f b -> M1 i c f c0 #

(*>) :: M1 i c f a -> M1 i c f b -> M1 i c f b #

(<*) :: M1 i c f a -> M1 i c f b -> M1 i c f a #

(Applicative f, Applicative g) => Applicative (f :.: g)

Since: 4.9.0.0

Instance details

Methods

pure :: a -> (f :.: g) a #

(<*>) :: (f :.: g) (a -> b) -> (f :.: g) a -> (f :.: g) b #

liftA2 :: (a -> b -> c) -> (f :.: g) a -> (f :.: g) b -> (f :.: g) c #

(*>) :: (f :.: g) a -> (f :.: g) b -> (f :.: g) b #

(<*) :: (f :.: g) a -> (f :.: g) b -> (f :.: g) a #

(Applicative f, Applicative g) => Applicative (Compose f g)

Since: 4.9.0.0

Instance details

Methods

pure :: a -> Compose f g a #

(<*>) :: Compose f g (a -> b) -> Compose f g a -> Compose f g b #

liftA2 :: (a -> b -> c) -> Compose f g a -> Compose f g b -> Compose f g c #

(*>) :: Compose f g a -> Compose f g b -> Compose f g b #

(<*) :: Compose f g a -> Compose f g b -> Compose f g a #

(Monad f, Applicative f) => Applicative (WhenMatched f k x y)

Equivalent to ReaderT k (ReaderT x (ReaderT y (MaybeT f)))

Since: 0.5.9

Instance details

Methods

pure :: a -> WhenMatched f k x y a #

(<*>) :: WhenMatched f k x y (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b #

liftA2 :: (a -> b -> c) -> WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y c #

(*>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b #

(<*) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y a #

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

An infix synonym for fmap.

The name of this operator is an allusion to $. Note the similarities between their types:

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

Whereas $ is function application, <$> is function application lifted over a Functor.

Examples

Expand

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 #

Unique Supply

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.

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

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.

getDictsDs :: DsM (Bag EvVar) Source #

Get in-scope type constraints (pm check)

addDictsDs :: Bag EvVar -> DsM a -> DsM a Source #

Add in-scope type constraints (pm check)

getTmCsDs :: DsM (Bag SimpleEq) Source #

Get in-scope term constraints (pm check)

addTmCsDs :: Bag SimpleEq -> DsM a -> DsM a Source #

Add in-scope term constraints (pm check)

incrCheckPmIterDs :: DsM Int Source #

Increase the counter for elapsed pattern match check iterations. If the current counter is already over the limit, fail

resetPmIterDs :: DsM () Source #

Reset the counter for pattern match check iterations to zero

dsGetCompleteMatches :: TyCon -> DsM [CompleteMatch] Source #

The COMPLETE pragams provided by the user for a given TyCon.

warnDs :: WarnReason -> SDoc -> DsM () Source #

Emit a warning for the current source location NB: Warns whether or not -Wxyz is set

warnIfSetDs :: WarningFlag -> SDoc -> DsM () Source #

Emit a warning only if the correct WarnReason is set in the DynFlags

errDs :: SDoc -> DsM () Source #

errDsCoreExpr :: SDoc -> DsM CoreExpr Source #

Issue an error, but return the expression for (), so that we can continue reporting errors.

data EquationInfo Source #

Constructors

EqnInfo 
Instances
Outputable EquationInfo Source # 
Instance details

data CanItFail Source #

Constructors

CanFail 
CantFail 

dsNoLevPoly :: Type -> SDoc -> DsM () Source #

Fail with an error message if the type is levity polymorphic.

dsNoLevPolyExpr :: CoreExpr -> SDoc -> DsM () Source #

Check an expression for levity polymorphism, failing if it is levity polymorphic.

dsWhenNoErrs :: DsM a -> (a -> CoreExpr) -> DsM CoreExpr Source #

Runs the thing_inside. If there are no errors, then returns the expr given. Otherwise, returns unitExpr. This is useful for doing a bunch of levity polymorphism checks and then avoiding making a core App. (If we make a core App on a levity polymorphic argument, detecting how to handle the let/app invariant might call isUnliftedType, which panics on a levity polymorphic type.) See #12709 for an example of why this machinery is necessary.

pprRuntimeTrace Source #

Arguments

:: String

header

-> SDoc

information to output

-> CoreExpr

expression

-> DsM CoreExpr 

Inject a trace message into the compiled program. Whereas pprTrace prints out information *while compiling*, pprRuntimeTrace captures that information and causes it to be printed *at runtime* using Debug.Trace.trace.

pprRuntimeTrace hdr doc expr

will produce an expression that looks like

trace (hdr + doc) expr

When using this to debug a module that Debug.Trace depends on, it is necessary to import {--} Debug.Trace () in that module. We could avoid this inconvenience by wiring in Debug.Trace.trace, but that doesn't seem worth the effort and maintenance cost.

Orphan instances