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 HaskellSafe
LanguageHaskell98

Language.Haskell.TH.Lens

Contents

Description

Lenses, Prisms, and Traversals for working with Template Haskell

Synopsis

Traversals

class HasName t where Source #

Has a Name

Minimal complete definition

name

Methods

name :: Lens' t Name Source #

Extract (or modify) the Name of something

class HasTypes t where Source #

Contains some amount of Types inside

Minimal complete definition

types

Methods

types :: Traversal' t Type Source #

Traverse all the types

class HasTypeVars t where Source #

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

Minimal complete definition

typeVarsEx

Methods

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

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

Provides substitution for types

Minimal complete definition

substType

Methods

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

Perform substitution for types

Instances

SubstType Type Source # 
SubstType t => SubstType [t] Source # 

Methods

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

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

Traverse free type variables

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

Substitute using a map of names in for free type variables

conFields :: Traversal' Con BangType Source #

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

conNamedFields :: Traversal' Con VarBangType Source #

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

DerivClause Lenses

Prisms

Info Prisms

Dec Prisms

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

_NewtypeD :: DataPrism' [TyVarBndr] Con Source #

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

_NewtypeInstD :: DataPrism' [Type] Con Source #

PatSynDir Prisms

PatSynArgs Prisms

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

DerivStrategy Prisms