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
- type TyVarBndrUnit = TyVarBndr
- type TyVarBndrSpec = TyVarBndr
- data Specificity
- plainTVFlag :: Name -> flag -> TyVarBndr_ flag
- kindedTVFlag :: Name -> flag -> Kind -> TyVarBndr_ flag
- plainTV :: Name -> TyVarBndr
- kindedTV :: Name -> Kind -> TyVarBndr
- plainTVInferred :: Name -> TyVarBndrSpec
- plainTVSpecified :: Name -> TyVarBndrSpec
- kindedTVInferred :: Name -> Kind -> TyVarBndrSpec
- kindedTVSpecified :: Name -> Kind -> TyVarBndrSpec
- inferredSpec :: Specificity
- specifiedSpec :: Specificity
- elimTV :: (Name -> r) -> (Name -> 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
TyVarBndr
-related types
type TyVarBndr_ flag = TyVarBndr Source #
type TyVarBndrUnit = TyVarBndr Source #
type TyVarBndrSpec = TyVarBndr Source #
A TyVarBndr
with an explicit Specificity
. This is used for
TyVarBndr
s that interact with visible type application.
data Specificity Source #
Determines how a TyVarBndr
interacts with visible type application.
SpecifiedSpec |
|
InferredSpec |
|
Instances
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
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
.
Constructing Specificity
Modifying TyVarBndr
s
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) ...