Copyright | Eric Mertens 2020 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | Safe |
Language | Haskell2010 |
This module provides a backwards-compatible API for constructing and
manipulating TyVarBndr
s across multiple versions of the template-haskell
package.
Synopsis
- type TyVarBndr_ flag = TyVarBndr flag
- type TyVarBndrUnit = TyVarBndr ()
- type TyVarBndrSpec = TyVarBndr Specificity
- type TyVarBndrVis = TyVarBndr BndrVis
- data Specificity
- data BndrVis
- class DefaultBndrFlag flag where
- defaultBndrFlag :: flag
- plainTVFlag :: Name -> flag -> TyVarBndr_ flag
- kindedTVFlag :: Name -> flag -> Kind -> TyVarBndr_ flag
- plainTV :: DefaultBndrFlag flag => Name -> TyVarBndr flag
- kindedTV :: DefaultBndrFlag flag => Name -> Kind -> TyVarBndr flag
- plainTVInferred :: Name -> TyVarBndrSpec
- plainTVSpecified :: Name -> TyVarBndrSpec
- kindedTVInferred :: Name -> Kind -> TyVarBndrSpec
- kindedTVSpecified :: Name -> Kind -> TyVarBndrSpec
- plainTVReq :: Name -> TyVarBndrVis
- plainTVInvis :: Name -> TyVarBndrVis
- kindedTVReq :: Name -> Kind -> TyVarBndrVis
- kindedTVInvis :: Name -> Kind -> TyVarBndrVis
- inferredSpec :: Specificity
- specifiedSpec :: Specificity
- bndrReq :: BndrVis
- bndrInvis :: BndrVis
- elimTV :: (Name -> r) -> (Name -> Kind -> r) -> TyVarBndr_ flag -> r
- elimTVFlag :: (Name -> flag -> r) -> (Name -> flag -> Kind -> r) -> TyVarBndr_ flag -> r
- mapTV :: (Name -> Name) -> (flag -> flag') -> (Kind -> Kind) -> TyVarBndr_ flag -> TyVarBndr_ flag'
- mapTVName :: (Name -> Name) -> TyVarBndr_ flag -> TyVarBndr_ flag
- mapTVFlag :: (flag -> flag') -> TyVarBndr_ flag -> TyVarBndr_ flag'
- mapTVKind :: (Kind -> Kind) -> TyVarBndr_ flag -> TyVarBndr_ flag
- traverseTV :: Applicative f => (Name -> f Name) -> (flag -> f flag') -> (Kind -> f Kind) -> TyVarBndr_ flag -> f (TyVarBndr_ flag')
- traverseTVName :: Functor f => (Name -> f Name) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
- traverseTVFlag :: Applicative f => (flag -> f flag') -> TyVarBndr_ flag -> f (TyVarBndr_ flag')
- traverseTVKind :: Applicative f => (Kind -> f Kind) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
- mapMTV :: Monad m => (Name -> m Name) -> (flag -> m flag') -> (Kind -> m Kind) -> TyVarBndr_ flag -> m (TyVarBndr_ flag')
- mapMTVName :: Monad m => (Name -> m Name) -> TyVarBndr_ flag -> m (TyVarBndr_ flag)
- mapMTVFlag :: Monad m => (flag -> m flag') -> TyVarBndr_ flag -> m (TyVarBndr_ flag')
- mapMTVKind :: Monad m => (Kind -> m Kind) -> TyVarBndr_ flag -> m (TyVarBndr_ flag)
- changeTVFlags :: newFlag -> [TyVarBndr_ oldFlag] -> [TyVarBndr_ newFlag]
- tvName :: TyVarBndr_ flag -> Name
- tvKind :: TyVarBndr_ flag -> Kind
- tvFlag :: TyVarBndr_ flag -> flag
TyVarBndr
-related types
type TyVarBndr_ flag = TyVarBndr flag Source #
type TyVarBndrUnit = TyVarBndr () #
type TyVarBndrSpec = TyVarBndr Specificity #
type TyVarBndrVis = TyVarBndr BndrVis #
data Specificity #
Instances
Instances
Data BndrVis | |
Defined in Language.Haskell.TH.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BndrVis -> c BndrVis # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BndrVis # toConstr :: BndrVis -> Constr # dataTypeOf :: BndrVis -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BndrVis) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BndrVis) # gmapT :: (forall b. Data b => b -> b) -> BndrVis -> BndrVis # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BndrVis -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BndrVis -> r # gmapQ :: (forall d. Data d => d -> u) -> BndrVis -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> BndrVis -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> BndrVis -> m BndrVis # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BndrVis -> m BndrVis # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BndrVis -> m BndrVis # | |
Generic BndrVis | |
Defined in Language.Haskell.TH.Syntax | |
Show BndrVis | |
Eq BndrVis | |
Ord BndrVis | |
DefaultBndrFlag BndrVis | |
Defined in Language.Haskell.TH.Lib | |
PprFlag BndrVis | |
Defined in Language.Haskell.TH.Ppr pprTyVarBndr :: TyVarBndr BndrVis -> Doc # | |
type Rep BndrVis | |
class DefaultBndrFlag flag where #
defaultBndrFlag :: flag #
Instances
DefaultBndrFlag BndrVis | |
Defined in Language.Haskell.TH.Lib | |
DefaultBndrFlag Specificity | |
Defined in Language.Haskell.TH.Lib | |
DefaultBndrFlag () | |
Defined in Language.Haskell.TH.Lib defaultBndrFlag :: () # |
Constructing TyVarBndr
s
flag
-polymorphic
plainTVFlag :: Name -> flag -> TyVarBndr_ flag Source #
Construct a PlainTV
with the given flag
.
kindedTVFlag :: Name -> flag -> Kind -> TyVarBndr_ flag Source #
Construct a KindedTV
with the given flag
.
TyVarBndrUnit
plainTV :: DefaultBndrFlag flag => Name -> TyVarBndr flag #
TyVarBndrSpec
plainTVInferred :: Name -> TyVarBndrSpec Source #
Construct a PlainTV
with an InferredSpec
.
plainTVSpecified :: Name -> TyVarBndrSpec Source #
Construct a PlainTV
with a SpecifiedSpec
.
kindedTVInferred :: Name -> Kind -> TyVarBndrSpec Source #
Construct a KindedTV
with an InferredSpec
.
kindedTVSpecified :: Name -> Kind -> TyVarBndrSpec Source #
Construct a KindedTV
with a SpecifiedSpec
.
TyVarBndrVis
plainTVReq :: Name -> TyVarBndrVis Source #
plainTVInvis :: Name -> TyVarBndrVis Source #
kindedTVReq :: Name -> Kind -> TyVarBndrVis Source #
kindedTVInvis :: Name -> Kind -> TyVarBndrVis Source #
Constructing Specificity
Constructing BndrVis
Modifying TyVarBndr
s
elimTVFlag :: (Name -> flag -> r) -> (Name -> flag -> Kind -> r) -> TyVarBndr_ flag -> r Source #
mapTV :: (Name -> Name) -> (flag -> flag') -> (Kind -> Kind) -> TyVarBndr_ flag -> TyVarBndr_ flag' Source #
Map over the components of a TyVarBndr
.
mapTVName :: (Name -> Name) -> TyVarBndr_ flag -> TyVarBndr_ flag Source #
mapTVFlag :: (flag -> flag') -> TyVarBndr_ flag -> TyVarBndr_ flag' Source #
Map over the flag
of a TyVarBndr
.
mapTVKind :: (Kind -> Kind) -> TyVarBndr_ flag -> TyVarBndr_ flag Source #
traverseTV :: Applicative f => (Name -> f Name) -> (flag -> f flag') -> (Kind -> f Kind) -> TyVarBndr_ flag -> f (TyVarBndr_ flag') Source #
Traverse the components of a TyVarBndr
.
traverseTVName :: Functor f => (Name -> f Name) -> TyVarBndr_ flag -> f (TyVarBndr_ flag) Source #
traverseTVFlag :: Applicative f => (flag -> f flag') -> TyVarBndr_ flag -> f (TyVarBndr_ flag') Source #
Traverse the flag
of a TyVarBndr
.
traverseTVKind :: Applicative f => (Kind -> f Kind) -> TyVarBndr_ flag -> f (TyVarBndr_ flag) Source #
mapMTV :: Monad m => (Name -> m Name) -> (flag -> m flag') -> (Kind -> m Kind) -> TyVarBndr_ flag -> m (TyVarBndr_ flag') Source #
Map over the components of a TyVarBndr
in a monadic fashion.
This is the same as traverseTV
, but with a Monad
constraint. This is
mainly useful for use with old versions of base
where Applicative
was
not a superclass of Monad
.
mapMTVName :: Monad m => (Name -> m Name) -> TyVarBndr_ flag -> m (TyVarBndr_ flag) Source #
Map over the Name
of a TyVarBndr
in a monadic fashion.
This is the same as traverseTVName
, but with a Monad
constraint. This is
mainly useful for use with old versions of base
where Applicative
was
not a superclass of Monad
.
mapMTVFlag :: Monad m => (flag -> m flag') -> TyVarBndr_ flag -> m (TyVarBndr_ flag') Source #
Map over the flag
of a TyVarBndr
in a monadic fashion.
This is the same as traverseTVFlag
, but with a Monad
constraint. This is
mainly useful for use with old versions of base
where Applicative
was
not a superclass of Monad
.
mapMTVKind :: Monad m => (Kind -> m Kind) -> TyVarBndr_ flag -> m (TyVarBndr_ flag) Source #
Map over the Kind
of a TyVarBndr
in a monadic fashion.
This is the same as traverseTVKind
, but with a Monad
constraint. This is
mainly useful for use with old versions of base
where Applicative
was
not a superclass of Monad
.
changeTVFlags :: newFlag -> [TyVarBndr_ oldFlag] -> [TyVarBndr_ newFlag] Source #
Set the flag in a list of TyVarBndr
s. This is often useful in contexts
where one needs to re-use a list of TyVarBndr
s from one flag setting to
another flag setting. For example, in order to re-use the TyVarBndr
s bound
by a DataD
in a ForallT
, one can do the following:
case x ofDataD
_ _ tvbs _ _ _ ->ForallT
(changeTVFlags
SpecifiedSpec
tvbs) ...
Properties of TyVarBndr
s
tvName :: TyVarBndr_ flag -> Name Source #
Extract the type variable name from a TyVarBndr
, ignoring the
kind signature if one exists.
tvKind :: TyVarBndr_ flag -> Kind Source #