DsMonad

ghc-8.0.1: The GHC API

Safe Haskell | None
Language | Haskell2010

DsMonad

Contents

- Orphan instances

Synopsis

- type DsM = TcRnIf DsGblEnv DsLclEnv
- mapM :: Traversable t => forall m a b. Monad m => (a -> m b) -> t a -> m (t b)
- mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c])
- initDs :: HscEnv -> Module -> GlobalRdrEnv -> TypeEnv -> FamInstEnv -> DsM a -> IO (Messages, Maybe a)
- initDsTc :: DsM a -> TcM a
- initTcDsForSolver :: TcM a -> DsM (Messages, Maybe a)
- fixDs :: (a -> DsM a) -> DsM a
- foldlM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a
- foldrM :: Monad m => (b -> a -> m a) -> a -> [b] -> m a
- whenGOptM :: GeneralFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- class Functor f => Applicative f where
  - pure :: a -> f a
  - (<*>) :: f (a -> b) -> f a -> f b
  - (*>) :: f a -> f b -> f b
  - (<*) :: f a -> f b -> f a
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- newLocalName :: Name -> TcM Name
- duplicateLocalDs :: Id -> DsM Id
- newSysLocalDs :: Type -> DsM Id
- newSysLocalsDs :: [Type] -> DsM [Id]
- newUniqueId :: Id -> Type -> DsM Id
- newFailLocalDs :: Type -> DsM Id
- newPredVarDs :: PredType -> DsM Var
- getSrcSpanDs :: DsM SrcSpan
- putSrcSpanDs :: SrcSpan -> DsM a -> DsM a
- mkPrintUnqualifiedDs :: DsM PrintUnqualified
- newUnique :: TcRnIf gbl lcl Unique
- data UniqSupply
- newUniqueSupply :: TcRnIf gbl lcl UniqSupply
- getGhcModeDs :: DsM GhcMode
- dsGetFamInstEnvs :: DsM FamInstEnvs
- dsGetStaticBindsVar :: DsM (IORef [(Fingerprint, (Id, CoreExpr))])
- dsLookupGlobal :: Name -> DsM TyThing
- dsLookupGlobalId :: Name -> DsM Id
- dsDPHBuiltin :: (PArrBuiltin -> a) -> DsM a
- dsLookupTyCon :: Name -> DsM TyCon
- dsLookupDataCon :: Name -> DsM DataCon
- data PArrBuiltin = PArrBuiltin {
  - lengthPVar :: Var
  - replicatePVar :: Var
  - singletonPVar :: Var
  - mapPVar :: Var
  - filterPVar :: Var
  - zipPVar :: Var
  - crossMapPVar :: Var
  - indexPVar :: Var
  - emptyPVar :: Var
  - appPVar :: Var
  - enumFromToPVar :: Var
  - enumFromThenToPVar :: Var
  }
- dsLookupDPHRdrEnv :: OccName -> DsM Name
- dsLookupDPHRdrEnv_maybe :: OccName -> DsM (Maybe Name)
- dsInitPArrBuiltin :: DsM a -> DsM a
- type DsMetaEnv = NameEnv DsMetaVal
- data DsMetaVal
  - = DsBound Id
  - | DsSplice (HsExpr Id)
- dsGetMetaEnv :: DsM (NameEnv DsMetaVal)
- dsLookupMetaEnv :: Name -> DsM (Maybe DsMetaVal)
- dsExtendMetaEnv :: DsMetaEnv -> DsM a -> DsM a
- getDictsDs :: DsM (Bag EvVar)
- addDictsDs :: Bag EvVar -> DsM a -> DsM a
- getTmCsDs :: DsM (Bag SimpleEq)
- addTmCsDs :: Bag SimpleEq -> DsM a -> DsM a
- incrCheckPmIterDs :: DsM ()
- resetPmIterDs :: DsM ()
- type DsWarning = (SrcSpan, SDoc)
- warnDs :: WarnReason -> SDoc -> DsM ()
- failWithDs :: SDoc -> DsM a
- discardWarningsDs :: DsM a -> DsM a
- data DsMatchContext = DsMatchContext (HsMatchContext Name) SrcSpan
- data EquationInfo = EqnInfo {
  - eqn_pats :: [Pat Id]
  - eqn_rhs :: MatchResult
  }
- data MatchResult = MatchResult CanItFail (CoreExpr -> DsM CoreExpr)
- type DsWrapper = CoreExpr -> CoreExpr
- idDsWrapper :: DsWrapper
- data CanItFail
  - = CanFail
  - | CantFail
- orFail :: CanItFail -> CanItFail -> CanItFail

# Documentation

type DsM = TcRnIf DsGblEnv DsLclEnv #

mapM :: Traversable t => forall m a 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 :: Applicative 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.

initDs :: HscEnv -> Module -> GlobalRdrEnv -> TypeEnv -> FamInstEnv -> DsM a -> IO (Messages, Maybe a) #

initDsTc :: DsM a -> TcM a #

initTcDsForSolver :: TcM a -> DsM (Messages, Maybe a) #

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

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

Monadic version of foldl

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

Monadic version of foldr

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

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

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

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:

-     u *> v = pure (const id) <*> u <*> v

-     u <* v = pure const <*> u <*> v

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

-     fmap f x = pure f <*> x

If `f` is also a `Monad`, it should satisfy

-     pure = return

-     (<*>) = ap

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

Minimal complete definition

pure, (<*>)

Instances

Applicative [] |
Methods pure :: a -> [a] Source # (<*>) :: [a -> b] -> [a] -> [b] Source # (*>) :: [a] -> [b] -> [b] Source # (<*) :: [a] -> [b] -> [a] Source #
Applicative Maybe |
Methods pure :: a -> Maybe a Source # (<*>) :: Maybe (a -> b) -> Maybe a -> Maybe b Source # (*>) :: Maybe a -> Maybe b -> Maybe b Source # (<*) :: Maybe a -> Maybe b -> Maybe a Source #
Applicative IO |
Methods pure :: a -> IO a Source # (<*>) :: IO (a -> b) -> IO a -> IO b Source # (*>) :: IO a -> IO b -> IO b Source # (<*) :: IO a -> IO b -> IO a Source #
Applicative U1 |
Methods pure :: a -> U1 a Source # (<*>) :: U1 (a -> b) -> U1 a -> U1 b Source # (*>) :: U1 a -> U1 b -> U1 b Source # (<*) :: U1 a -> U1 b -> U1 a Source #
Applicative Par1 |
Methods pure :: a -> Par1 a Source # (<*>) :: Par1 (a -> b) -> Par1 a -> Par1 b Source # (*>) :: Par1 a -> Par1 b -> Par1 b Source # (<*) :: Par1 a -> Par1 b -> Par1 a Source #
Applicative Q |
Methods pure :: a -> Q a Source # (<*>) :: Q (a -> b) -> Q a -> Q b Source # (*>) :: Q a -> Q b -> Q b Source # (<*) :: Q a -> Q b -> Q a Source #
Applicative Id |
Methods pure :: a -> Id a Source # (<*>) :: Id (a -> b) -> Id a -> Id b Source # (*>) :: Id a -> Id b -> Id b Source # (<*) :: Id a -> Id b -> Id a Source #
Applicative P |
Methods pure :: a -> P a Source # (<*>) :: P (a -> b) -> P a -> P b Source # (*>) :: P a -> P b -> P b Source # (<*) :: P a -> P b -> P a Source #
Applicative Identity |
Methods pure :: a -> Identity a Source # (<*>) :: Identity (a -> b) -> Identity a -> Identity b Source # (*>) :: Identity a -> Identity b -> Identity b Source # (<*) :: Identity a -> Identity b -> Identity a Source #
Applicative Min |
Methods pure :: a -> Min a Source # (<*>) :: Min (a -> b) -> Min a -> Min b Source # (*>) :: Min a -> Min b -> Min b Source # (<*) :: Min a -> Min b -> Min a Source #
Applicative Max |
Methods pure :: a -> Max a Source # (<*>) :: Max (a -> b) -> Max a -> Max b Source # (*>) :: Max a -> Max b -> Max b Source # (<*) :: Max a -> Max b -> Max a Source #
Applicative First |
Methods pure :: a -> First a Source # (<*>) :: First (a -> b) -> First a -> First b Source # (*>) :: First a -> First b -> First b Source # (<*) :: First a -> First b -> First a Source #
Applicative Last |
Methods pure :: a -> Last a Source # (<*>) :: Last (a -> b) -> Last a -> Last b Source # (*>) :: Last a -> Last b -> Last b Source # (<*) :: Last a -> Last b -> Last a Source #
Applicative Option |
Methods pure :: a -> Option a Source # (<*>) :: Option (a -> b) -> Option a -> Option b Source # (*>) :: Option a -> Option b -> Option b Source # (<*) :: Option a -> Option b -> Option a Source #
Applicative NonEmpty |
Methods pure :: a -> NonEmpty a Source # (<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b Source # (*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b Source # (<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a Source #
Applicative Complex |
Methods pure :: a -> Complex a Source # (<*>) :: Complex (a -> b) -> Complex a -> Complex b Source # (*>) :: Complex a -> Complex b -> Complex b Source # (<*) :: Complex a -> Complex b -> Complex a Source #
Applicative ZipList |
Methods pure :: a -> ZipList a Source # (<*>) :: ZipList (a -> b) -> ZipList a -> ZipList b Source # (*>) :: ZipList a -> ZipList b -> ZipList b Source # (<*) :: ZipList a -> ZipList b -> ZipList a Source #
Applicative STM |
Methods pure :: a -> STM a Source # (<*>) :: STM (a -> b) -> STM a -> STM b Source # (*>) :: STM a -> STM b -> STM b Source # (<*) :: STM a -> STM b -> STM a Source #
Applicative Dual |
Methods pure :: a -> Dual a Source # (<*>) :: Dual (a -> b) -> Dual a -> Dual b Source # (*>) :: Dual a -> Dual b -> Dual b Source # (<*) :: Dual a -> Dual b -> Dual a Source #
Applicative Sum |
Methods pure :: a -> Sum a Source # (<*>) :: Sum (a -> b) -> Sum a -> Sum b Source # (*>) :: Sum a -> Sum b -> Sum b Source # (<*) :: Sum a -> Sum b -> Sum a Source #
Applicative Product |
Methods pure :: a -> Product a Source # (<*>) :: Product (a -> b) -> Product a -> Product b Source # (*>) :: Product a -> Product b -> Product b Source # (<*) :: Product a -> Product b -> Product a Source #
Applicative First |
Methods pure :: a -> First a Source # (<*>) :: First (a -> b) -> First a -> First b Source # (*>) :: First a -> First b -> First b Source # (<*) :: First a -> First b -> First a Source #
Applicative Last |
Methods pure :: a -> Last a Source # (<*>) :: Last (a -> b) -> Last a -> Last b Source # (*>) :: Last a -> Last b -> Last b Source # (<*) :: Last a -> Last b -> Last a Source #
Applicative ReadPrec |
Methods pure :: a -> ReadPrec a Source # (<*>) :: ReadPrec (a -> b) -> ReadPrec a -> ReadPrec b Source # (*>) :: ReadPrec a -> ReadPrec b -> ReadPrec b Source # (<*) :: ReadPrec a -> ReadPrec b -> ReadPrec a Source #
Applicative ReadP |
Methods pure :: a -> ReadP a Source # (<*>) :: ReadP (a -> b) -> ReadP a -> ReadP b Source # (*>) :: ReadP a -> ReadP b -> ReadP b Source # (<*) :: ReadP a -> ReadP b -> ReadP a Source #
Applicative PutM |
Methods pure :: a -> PutM a Source # (<*>) :: PutM (a -> b) -> PutM a -> PutM b Source # (*>) :: PutM a -> PutM b -> PutM b Source # (<*) :: PutM a -> PutM b -> PutM a Source #
Applicative Get |
Methods pure :: a -> Get a Source # (<*>) :: Get (a -> b) -> Get a -> Get b Source # (*>) :: Get a -> Get b -> Get b Source # (<*) :: Get a -> Get b -> Get a Source #
Applicative Tree |
Methods pure :: a -> Tree a Source # (<*>) :: Tree (a -> b) -> Tree a -> Tree b Source # (*>) :: Tree a -> Tree b -> Tree b Source # (<*) :: Tree a -> Tree b -> Tree a Source #
Applicative Seq |
Methods pure :: a -> Seq a Source # (<*>) :: Seq (a -> b) -> Seq a -> Seq b Source # (*>) :: Seq a -> Seq b -> Seq b Source # (<*) :: Seq a -> Seq b -> Seq a Source #
Applicative VM |
Methods pure :: a -> VM a Source # (<*>) :: VM (a -> b) -> VM a -> VM b Source # (*>) :: VM a -> VM b -> VM b Source # (<*) :: VM a -> VM b -> VM a Source #
Applicative SimpleUniqueMonad |
Methods pure :: a -> SimpleUniqueMonad a Source # (<*>) :: SimpleUniqueMonad (a -> b) -> SimpleUniqueMonad a -> SimpleUniqueMonad b Source # (*>) :: SimpleUniqueMonad a -> SimpleUniqueMonad b -> SimpleUniqueMonad b Source # (<*) :: SimpleUniqueMonad a -> SimpleUniqueMonad b -> SimpleUniqueMonad a Source #
Applicative PprM |
Methods pure :: a -> PprM a Source # (<*>) :: PprM (a -> b) -> PprM a -> PprM b Source # (*>) :: PprM a -> PprM b -> PprM b Source # (<*) :: PprM a -> PprM b -> PprM a Source #
Applicative Pair # |
Methods pure :: a -> Pair a Source # (<*>) :: Pair (a -> b) -> Pair a -> Pair b Source # (*>) :: Pair a -> Pair b -> Pair b Source # (<*) :: Pair a -> Pair b -> Pair a Source #
Applicative UniqSM # |
Methods pure :: a -> UniqSM a Source # (<*>) :: UniqSM (a -> b) -> UniqSM a -> UniqSM b Source # (*>) :: UniqSM a -> UniqSM b -> UniqSM b Source # (<*) :: UniqSM a -> UniqSM b -> UniqSM a Source #
Applicative P # |
Methods pure :: a -> P a Source # (<*>) :: P (a -> b) -> P a -> P b Source # (*>) :: P a -> P b -> P b Source # (<*) :: P a -> P b -> P a Source #
Applicative UnifyResultM # |
Methods pure :: a -> UnifyResultM a Source # (<*>) :: UnifyResultM (a -> b) -> UnifyResultM a -> UnifyResultM b Source # (*>) :: UnifyResultM a -> UnifyResultM b -> UnifyResultM b Source # (<*) :: UnifyResultM a -> UnifyResultM b -> UnifyResultM a Source #
Applicative LlvmM # |
Methods pure :: a -> LlvmM a Source # (<*>) :: LlvmM (a -> b) -> LlvmM a -> LlvmM b Source # (*>) :: LlvmM a -> LlvmM b -> LlvmM b Source # (<*) :: LlvmM a -> LlvmM b -> LlvmM a Source #
Applicative NatM # |
Methods pure :: a -> NatM a Source # (<*>) :: NatM (a -> b) -> NatM a -> NatM b Source # (*>) :: NatM a -> NatM b -> NatM b Source # (<*) :: NatM a -> NatM b -> NatM a Source #
Applicative OccCheckResult # |
Methods pure :: a -> OccCheckResult a Source # (<*>) :: OccCheckResult (a -> b) -> OccCheckResult a -> OccCheckResult b Source # (*>) :: OccCheckResult a -> OccCheckResult b -> OccCheckResult b Source # (<*) :: OccCheckResult a -> OccCheckResult b -> OccCheckResult a Source #
Applicative FCode # |
Methods pure :: a -> FCode a Source # (<*>) :: FCode (a -> b) -> FCode a -> FCode b Source # (*>) :: FCode a -> FCode b -> FCode b Source # (<*) :: FCode a -> FCode b -> FCode a Source #
Applicative CmmParse # |
Methods pure :: a -> CmmParse a Source # (<*>) :: CmmParse (a -> b) -> CmmParse a -> CmmParse b Source # (*>) :: CmmParse a -> CmmParse b -> CmmParse b Source # (<*) :: CmmParse a -> CmmParse b -> CmmParse a Source #
Applicative Hsc # |
Methods pure :: a -> Hsc a Source # (<*>) :: Hsc (a -> b) -> Hsc a -> Hsc b Source # (*>) :: Hsc a -> Hsc b -> Hsc b Source # (<*) :: Hsc a -> Hsc b -> Hsc a Source #
Applicative Ghc # |
Methods pure :: a -> Ghc a Source # (<*>) :: Ghc (a -> b) -> Ghc a -> Ghc b Source # (*>) :: Ghc a -> Ghc b -> Ghc b Source # (<*) :: Ghc a -> Ghc b -> Ghc a Source #
Applicative CompPipeline # |
Methods pure :: a -> CompPipeline a Source # (<*>) :: CompPipeline (a -> b) -> CompPipeline a -> CompPipeline b Source # (*>) :: CompPipeline a -> CompPipeline b -> CompPipeline b Source # (<*) :: CompPipeline a -> CompPipeline b -> CompPipeline a Source #
Applicative TcPluginM # |
Methods pure :: a -> TcPluginM a Source # (<*>) :: TcPluginM (a -> b) -> TcPluginM a -> TcPluginM b Source # (*>) :: TcPluginM a -> TcPluginM b -> TcPluginM b Source # (<*) :: TcPluginM a -> TcPluginM b -> TcPluginM a Source #
Applicative CpsRn # |
Methods pure :: a -> CpsRn a Source # (<*>) :: CpsRn (a -> b) -> CpsRn a -> CpsRn b Source # (*>) :: CpsRn a -> CpsRn b -> CpsRn b Source # (<*) :: CpsRn a -> CpsRn b -> CpsRn a Source #
Applicative TcS # |
Methods pure :: a -> TcS a Source # (<*>) :: TcS (a -> b) -> TcS a -> TcS b Source # (*>) :: TcS a -> TcS b -> TcS b Source # (<*) :: TcS a -> TcS b -> TcS a Source #
Applicative CoreM # |
Methods pure :: a -> CoreM a Source # (<*>) :: CoreM (a -> b) -> CoreM a -> CoreM b Source # (*>) :: CoreM a -> CoreM b -> CoreM b Source # (<*) :: CoreM a -> CoreM b -> CoreM a Source #
Applicative VM # |
Methods pure :: a -> VM a Source # (<*>) :: VM (a -> b) -> VM a -> VM b Source # (*>) :: VM a -> VM b -> VM b Source # (<*) :: VM a -> VM b -> VM a Source #
Applicative SimplM # |
Methods pure :: a -> SimplM a Source # (<*>) :: SimplM (a -> b) -> SimplM a -> SimplM b Source # (*>) :: SimplM a -> SimplM b -> SimplM b Source # (<*) :: SimplM a -> SimplM b -> SimplM a Source #
Applicative ((->) a) |
Methods pure :: a -> a -> a Source # (<*>) :: (a -> a -> b) -> (a -> a) -> a -> b Source # (*>) :: (a -> a) -> (a -> b) -> a -> b Source # (<*) :: (a -> a) -> (a -> b) -> a -> a Source #
Applicative (Either e) |
Methods pure :: a -> Either e a Source # (<*>) :: Either e (a -> b) -> Either e a -> Either e b Source # (*>) :: Either e a -> Either e b -> Either e b Source # (<*) :: Either e a -> Either e b -> Either e a Source #
Applicative f => Applicative (Rec1 f) |
Methods pure :: a -> Rec1 f a Source # (<*>) :: Rec1 f (a -> b) -> Rec1 f a -> Rec1 f b Source # (*>) :: Rec1 f a -> Rec1 f b -> Rec1 f b Source # (<*) :: Rec1 f a -> Rec1 f b -> Rec1 f a Source #
Monoid a => Applicative ((,) a) |
Methods pure :: a -> (a, a) Source # (<*>) :: (a, a -> b) -> (a, a) -> (a, b) Source # (*>) :: (a, a) -> (a, b) -> (a, b) Source # (<*) :: (a, a) -> (a, b) -> (a, a) Source #
Applicative (ST s) |
Methods pure :: a -> ST s a Source # (<*>) :: ST s (a -> b) -> ST s a -> ST s b Source # (*>) :: ST s a -> ST s b -> ST s b Source # (<*) :: ST s a -> ST s b -> ST s a Source #
Applicative (StateL s) |
Methods pure :: a -> StateL s a Source # (<*>) :: StateL s (a -> b) -> StateL s a -> StateL s b Source # (*>) :: StateL s a -> StateL s b -> StateL s b Source # (<*) :: StateL s a -> StateL s b -> StateL s a Source #
Applicative (StateR s) |
Methods pure :: a -> StateR s a Source # (<*>) :: StateR s (a -> b) -> StateR s a -> StateR s b Source # (*>) :: StateR s a -> StateR s b -> StateR s b Source # (<*) :: StateR s a -> StateR s b -> StateR s a Source #
Applicative (ST s) |
Methods pure :: a -> ST s a Source # (<*>) :: ST s (a -> b) -> ST s a -> ST s b Source # (*>) :: ST s a -> ST s b -> ST s b Source # (<*) :: ST s a -> ST s b -> ST s a Source #
Monad m => Applicative (WrappedMonad m) |
Methods pure :: a -> WrappedMonad m a Source # (<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b Source # (*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b Source # (<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a Source #
Arrow a => Applicative (ArrowMonad a) |
Methods pure :: a -> ArrowMonad a a Source # (<*>) :: ArrowMonad a (a -> b) -> ArrowMonad a a -> ArrowMonad a b Source # (*>) :: ArrowMonad a a -> ArrowMonad a b -> ArrowMonad a b Source # (<*) :: ArrowMonad a a -> ArrowMonad a b -> ArrowMonad a a Source #
Applicative (Proxy *) |
Methods pure :: a -> Proxy * a Source # (<*>) :: Proxy * (a -> b) -> Proxy * a -> Proxy * b Source # (*>) :: Proxy * a -> Proxy * b -> Proxy * b Source # (<*) :: Proxy * a -> Proxy * b -> Proxy * a Source #
Applicative (SetM s) |
Methods pure :: a -> SetM s a Source # (<*>) :: SetM s (a -> b) -> SetM s a -> SetM s b Source # (*>) :: SetM s a -> SetM s b -> SetM s b Source # (<*) :: SetM s a -> SetM s b -> SetM s a Source #
Applicative (State s) |
Methods pure :: a -> State s a Source # (<*>) :: State s (a -> b) -> State s a -> State s b Source # (*>) :: State s a -> State s b -> State s b Source # (<*) :: State s a -> State s b -> State s a Source #
Monad m => Applicative (CheckingFuelMonad m) |
Methods pure :: a -> CheckingFuelMonad m a Source # (<*>) :: CheckingFuelMonad m (a -> b) -> CheckingFuelMonad m a -> CheckingFuelMonad m b Source # (*>) :: CheckingFuelMonad m a -> CheckingFuelMonad m b -> CheckingFuelMonad m b Source # (<*) :: CheckingFuelMonad m a -> CheckingFuelMonad m b -> CheckingFuelMonad m a Source #
Monad m => Applicative (InfiniteFuelMonad m) |
Methods pure :: a -> InfiniteFuelMonad m a Source # (<*>) :: InfiniteFuelMonad m (a -> b) -> InfiniteFuelMonad m a -> InfiniteFuelMonad m b Source # (*>) :: InfiniteFuelMonad m a -> InfiniteFuelMonad m b -> InfiniteFuelMonad m b Source # (<*) :: InfiniteFuelMonad m a -> InfiniteFuelMonad m b -> InfiniteFuelMonad m a Source #
Monad m => Applicative (UniqueMonadT m) |
Methods pure :: a -> UniqueMonadT m a Source # (<*>) :: UniqueMonadT m (a -> b) -> UniqueMonadT m a -> UniqueMonadT m b Source # (*>) :: UniqueMonadT m a -> UniqueMonadT m b -> UniqueMonadT m b Source # (<*) :: UniqueMonadT m a -> UniqueMonadT m b -> UniqueMonadT m a Source #
(Functor m, Monad m) => Applicative (MaybeT m) |
Methods pure :: a -> MaybeT m a Source # (<*>) :: MaybeT m (a -> b) -> MaybeT m a -> MaybeT m b Source # (*>) :: MaybeT m a -> MaybeT m b -> MaybeT m b Source # (<*) :: MaybeT m a -> MaybeT m b -> MaybeT m a Source #
Applicative (State s) # |
Methods pure :: a -> State s a Source # (<*>) :: State s (a -> b) -> State s a -> State s b Source # (*>) :: State s a -> State s b -> State s b Source # (<*) :: State s a -> State s b -> State s a Source #
Applicative (MaybeErr err) # |
Methods pure :: a -> MaybeErr err a Source # (<*>) :: MaybeErr err (a -> b) -> MaybeErr err a -> MaybeErr err b Source # (*>) :: MaybeErr err a -> MaybeErr err b -> MaybeErr err b Source # (<*) :: MaybeErr err a -> MaybeErr err b -> MaybeErr err a Source #
Applicative (CmdLineP s) # |
Methods pure :: a -> CmdLineP s a Source # (<*>) :: CmdLineP s (a -> b) -> CmdLineP s a -> CmdLineP s b Source # (*>) :: CmdLineP s a -> CmdLineP s b -> CmdLineP s b Source # (<*) :: CmdLineP s a -> CmdLineP s b -> CmdLineP s a Source #
Monad m => Applicative (EwM m) # |
Methods pure :: a -> EwM m a Source # (<*>) :: EwM m (a -> b) -> EwM m a -> EwM m b Source # (*>) :: EwM m a -> EwM m b -> EwM m b Source # (<*) :: EwM m a -> EwM m b -> EwM m a Source #
Applicative (IOEnv m) # |
Methods pure :: a -> IOEnv m a Source # (<*>) :: IOEnv m (a -> b) -> IOEnv m a -> IOEnv m b Source # (*>) :: IOEnv m a -> IOEnv m b -> IOEnv m b Source # (<*) :: IOEnv m a -> IOEnv m b -> IOEnv m a Source #
Applicative (RegM freeRegs) # |
Methods pure :: a -> RegM freeRegs a Source # (<*>) :: RegM freeRegs (a -> b) -> RegM freeRegs a -> RegM freeRegs b Source # (*>) :: RegM freeRegs a -> RegM freeRegs b -> RegM freeRegs b Source # (<*) :: RegM freeRegs a -> RegM freeRegs b -> RegM freeRegs a Source #
Applicative m => Applicative (GhcT m) # |
Methods pure :: a -> GhcT m a Source # (<*>) :: GhcT m (a -> b) -> GhcT m a -> GhcT m b Source # (*>) :: GhcT m a -> GhcT m b -> GhcT m b Source # (<*) :: GhcT m a -> GhcT m b -> GhcT m a Source #
(Applicative f, Applicative g) => Applicative ((:*:) f g) |
Methods pure :: a -> (f :*: g) a Source # (<*>) :: (f :*: g) (a -> b) -> (f :*: g) a -> (f :*: g) b Source # (*>) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) b Source # (<*) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) a Source #
(Applicative f, Applicative g) => Applicative ((:.:) f g) |
Methods pure :: a -> (f :.: g) a Source # (<*>) :: (f :.: g) (a -> b) -> (f :.: g) a -> (f :.: g) b Source # (*>) :: (f :.: g) a -> (f :.: g) b -> (f :.: g) b Source # (<*) :: (f :.: g) a -> (f :.: g) b -> (f :.: g) a Source #
Arrow a => Applicative (WrappedArrow a b) |
Methods pure :: a -> WrappedArrow a b a Source # (<*>) :: WrappedArrow a b (a -> b) -> WrappedArrow a b a -> WrappedArrow a b b Source # (*>) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b b Source # (<*) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b a Source #
Monoid m => Applicative (Const * m) |
Methods pure :: a -> Const * m a Source # (<*>) :: Const * m (a -> b) -> Const * m a -> Const * m b Source # (*>) :: Const * m a -> Const * m b -> Const * m b Source # (<*) :: Const * m a -> Const * m b -> Const * m a Source #
Applicative f => Applicative (Alt * f) |
Methods pure :: a -> Alt * f a Source # (<*>) :: Alt * f (a -> b) -> Alt * f a -> Alt * f b Source # (*>) :: Alt * f a -> Alt * f b -> Alt * f b Source # (<*) :: Alt * f a -> Alt * f b -> Alt * f a Source #
(Monoid w, Applicative m) => Applicative (WriterT w m) |
Methods pure :: a -> WriterT w m a Source # (<*>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b Source # (*>) :: WriterT w m a -> WriterT w m b -> WriterT w m b Source # (<*) :: WriterT w m a -> WriterT w m b -> WriterT w m a Source #
(Functor m, Monad m) => Applicative (StateT s m) |
Methods pure :: a -> StateT s m a Source # (<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b Source # (*>) :: StateT s m a -> StateT s m b -> StateT s m b Source # (<*) :: StateT s m a -> StateT s m b -> StateT s m a Source #
(Functor m, Monad m) => Applicative (StateT s m) |
Methods pure :: a -> StateT s m a Source # (<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b Source # (*>) :: StateT s m a -> StateT s m b -> StateT s m b Source # (<*) :: StateT s m a -> StateT s m b -> StateT s m a Source #
(Functor m, Monad m) => Applicative (ExceptT e m) |
Methods pure :: a -> ExceptT e m a Source # (<*>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b Source # (*>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b Source # (<*) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a Source #
Monad m => Applicative (Stream m a) # |
Methods pure :: a -> Stream m a a Source # (<*>) :: Stream m a (a -> b) -> Stream m a a -> Stream m a b Source # (*>) :: Stream m a a -> Stream m a b -> Stream m a b Source # (<*) :: Stream m a a -> Stream m a b -> Stream m a a Source #
Applicative f => Applicative (M1 i c f) |
Methods pure :: a -> M1 i c f a Source # (<*>) :: M1 i c f (a -> b) -> M1 i c f a -> M1 i c f b Source # (*>) :: M1 i c f a -> M1 i c f b -> M1 i c f b Source # (<*) :: M1 i c f a -> M1 i c f b -> M1 i c f a Source #
Applicative m => Applicative (ReaderT * r m) |
Methods pure :: a -> ReaderT * r m a Source # (<*>) :: ReaderT * r m (a -> b) -> ReaderT * r m a -> ReaderT * r m b Source # (*>) :: ReaderT * r m a -> ReaderT * r m b -> ReaderT * r m b Source # (<*) :: ReaderT * r m a -> ReaderT * r m b -> ReaderT * r m a Source #

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

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

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)

newLocalName :: Name -> TcM Name #

duplicateLocalDs :: Id -> DsM Id #

newSysLocalDs :: Type -> DsM Id #

newSysLocalsDs :: [Type] -> DsM [Id] #

newUniqueId :: Id -> Type -> DsM Id #

newFailLocalDs :: Type -> DsM Id #

newPredVarDs :: PredType -> DsM Var #

getSrcSpanDs :: DsM SrcSpan #

putSrcSpanDs :: SrcSpan -> DsM a -> DsM a #

mkPrintUnqualifiedDs :: DsM PrintUnqualified #

newUnique :: TcRnIf gbl lcl Unique #

data UniqSupply #

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.

newUniqueSupply :: TcRnIf gbl lcl UniqSupply #

getGhcModeDs :: DsM GhcMode #

dsGetFamInstEnvs :: DsM FamInstEnvs #

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

Gets a reference to the SPT entries created so far.

dsLookupGlobal :: Name -> DsM TyThing #

dsLookupGlobalId :: Name -> DsM Id #

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

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

dsLookupTyCon :: Name -> DsM TyCon #

dsLookupDataCon :: Name -> DsM DataCon #

data PArrBuiltin #

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 #

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) #

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

dsInitPArrBuiltin :: DsM a -> DsM a #

type DsMetaEnv = NameEnv DsMetaVal #

data DsMetaVal #

Constructors

DsBound Id |
DsSplice (HsExpr Id) |

dsGetMetaEnv :: DsM (NameEnv DsMetaVal) #

dsLookupMetaEnv :: Name -> DsM (Maybe DsMetaVal) #

dsExtendMetaEnv :: DsMetaEnv -> DsM a -> DsM a #

getDictsDs :: DsM (Bag EvVar) #

Get in-scope type constraints (pm check)

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

Add in-scope type constraints (pm check)

getTmCsDs :: DsM (Bag SimpleEq) #

Get in-scope term constraints (pm check)

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

Add in-scope term constraints (pm check)

incrCheckPmIterDs :: DsM () #

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

resetPmIterDs :: DsM () #

Reset the counter for pattern match check iterations to zero

type DsWarning = (SrcSpan, SDoc) #

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

Emit a warning for the current source location

failWithDs :: SDoc -> DsM a #

discardWarningsDs :: DsM a -> DsM a #

data DsMatchContext #

Constructors

DsMatchContext (HsMatchContext Name) SrcSpan |

data EquationInfo #

Constructors

EqnInfo |
Fields eqn_pats :: [Pat Id] eqn_rhs :: MatchResult

Instances

Outputable EquationInfo # |
Methods ppr :: EquationInfo -> SDoc # pprPrec :: Rational -> EquationInfo -> SDoc #

data MatchResult #

Constructors

MatchResult CanItFail (CoreExpr -> DsM CoreExpr) |

type DsWrapper = CoreExpr -> CoreExpr #

idDsWrapper :: DsWrapper #

data CanItFail #

Constructors

CanFail |
CantFail |

orFail :: CanItFail -> CanItFail -> CanItFail #

# Orphan instances

MonadThings (IOEnv (Env DsGblEnv DsLclEnv)) # |
Methods lookupThing :: Name -> IOEnv (Env DsGblEnv DsLclEnv) TyThing # lookupId :: Name -> IOEnv (Env DsGblEnv DsLclEnv) Id # lookupDataCon :: Name -> IOEnv (Env DsGblEnv DsLclEnv) DataCon # lookupTyCon :: Name -> IOEnv (Env DsGblEnv DsLclEnv) TyCon #