lens-4.0.1: Lenses, Folds and Traversals

PortabilityTemplateHaskell
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Language.Haskell.TH.Lens

Contents

Description

Lenses, Prisms, and Traversals for working with Template Haskell

Synopsis

Traversals

class HasName t whereSource

Has a Name

Methods

name :: Lens' t NameSource

Extract (or modify) the Name of something

class HasTypeVars t whereSource

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

Methods

typeVarsEx :: Set Name -> Traversal' t NameSource

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 whereSource

Provides substitution for types

Methods

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

Perform substitution for types

typeVars :: HasTypeVars t => Traversal' t NameSource

Traverse free type variables

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

Substitute using a map of names in for free type variables

conFields :: Traversal' Con StrictTypeSource

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

conNamedFields :: Traversal' Con VarStrictTypeSource

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

Prisms

Info Prisms

Dec Prisms

Con Prisms

Strict Prisms

Foreign Prisms

Callconv Prisms

Safety Prisms

Pragma Prisms

Inline Prisms

RuleMatch Prisms

Phases Prisms

RuleBndr 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

TyLit Prisms

Pred Prisms