lens-4.15.4: Lenses, Folds and Traversals

Copyright(C) 2012-2016 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
PortabilityTemplateHaskell
Safe HaskellTrustworthy
LanguageHaskell98

Language.Haskell.TH.Lens

Contents

Description

Lenses, Prisms, and Traversals for working with Template Haskell

Synopsis

Traversals

class HasName t where #

Has a Name

Minimal complete definition

name

Methods

name :: Lens' t Name #

Extract (or modify) the Name of something

Instances

HasName Name # 

Methods

name :: Lens' Name Name #

HasName TyVarBndr # 
HasName InjectivityAnn # 
HasName TypeFamilyHead # 
HasName Foreign # 

Methods

name :: Lens' Foreign Name #

HasName RuleBndr # 
HasName Con #

On template-haskell-2.11.0.0 or later, if a GadtC or RecGadtC has multiple Names, the leftmost Name will be chosen.

Methods

name :: Lens' Con Name #

class HasTypes t where #

Contains some amount of Types inside

Minimal complete definition

types

Methods

types :: Traversal' t Type #

Traverse all the types

class HasTypeVars t where #

Provides for the extraction of free type variables, and alpha renaming.

Minimal complete definition

typeVarsEx

Methods

typeVarsEx :: Set Name -> Traversal' t Name #

When performing substitution into this traversal you're not allowed to substitute in a name that is bound internally or you'll violate the Traversal laws, when in doubt generate your names with newName.

class SubstType t where #

Provides substitution for types

Minimal complete definition

substType

Methods

substType :: Map Name Type -> t -> t #

Perform substitution for types

Instances

SubstType Type # 

Methods

substType :: Map Name Type -> Type -> Type #

SubstType t => SubstType [t] # 

Methods

substType :: Map Name Type -> [t] -> [t] #

typeVars :: HasTypeVars t => Traversal' t Name #

Traverse free type variables

substTypeVars :: HasTypeVars t => Map Name Name -> t -> t #

Substitute using a map of names in for free type variables

conFields :: Traversal' Con BangType #

Provides a Traversal of the types of each field of a constructor.

conNamedFields :: Traversal' Con VarBangType #

Traversal of the types of the named fields of a constructor.

Lenses

Loc Lenses

FunDep Lenses

Match Lenses

Fixity Lenses

Clause Lenses

FieldExp Lenses

FieldPat Lenses

TySynEqn Lenses

InjectivityAnn Lenses

TypeFamilyHead Lenses

Bang Lenses

Prisms

Info Prisms

Dec Prisms

_DataD :: DataPrism' [TyVarBndr] [Con] #

_NewtypeD :: DataPrism' [TyVarBndr] Con #

_DataInstD :: DataPrism' [Type] [Con] #

_NewtypeInstD :: DataPrism' [Type] Con #

Con Prisms

Overlap Prisms

SourceUnpackedness Prisms

SourceStrictness Prisms

DecidedStrictness Prisms

Foreign Prisms

Callconv Prisms

Safety Prisms

Pragma Prisms

Inline Prisms

RuleMatch Prisms

Phases Prisms

RuleBndr Prisms

AnnTarget Prisms

FunDep Prisms TODO make a lens

FamFlavour Prisms

FixityDirection Prisms

Exp Prisms

Body Prisms

Guard Prisms

Stmt Prisms

Range Prisms

Lit Prisms

Pat Prisms

Type Prisms

TyVarBndr Prisms

FamilyResultSig Prisms

TyLit Prisms

Role Prisms