lens-5.0.1: Lenses, Folds and Traversals
Copyright (C) 2012-2016 Edward Kmett
License BSD-style (see the file LICENSE)
Maintainer Edward Kmett <ekmett@gmail.com>
Stability experimental
Portability TemplateHaskell
Safe Haskell Trustworthy
Language Haskell2010

Language.Haskell.TH.Lens

Description

Lenses, Prisms, and Traversals for working with Template Haskell.

Beware that the API offered in this module is subject to change, as it mirrors the API exposed by the template-haskell package, which frequently changes between different releases of GHC. An effort is made to identify the functions in this module which have different type signatures when compiled with different versions of template-haskell .

Synopsis

Traversals

class SubstType t where Source #

Provides substitution for types

Methods

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

Perform substitution for types

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.

conFields :: Traversal' Con BangType   -- template-haskell-2.11+
conFields :: Traversal' Con StrictType -- Earlier versions

conNamedFields :: Traversal' Con VarBangType Source #

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

conNamedFields :: Traversal' Con VarBangType   -- template-haskell-2.11+
conNamedFields :: Traversal' Con VarStrictType -- Earlier versions

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

_ClassOpI :: Prism' Info ( Name , Type , ParentName ) Source #

_ClassOpI :: Prism' Info (Name, Type, ParentName)         -- template-haskell-2.11+
_ClassOpI :: Prism' Info (Name, Type, ParentName, Fixity) -- template-haskell-2.8 through 2.10
_ClassOpI :: Prism' Info (Name, Type, Name,       Fixity) -- Earlier versions

_DataConI :: Prism' Info ( Name , Type , ParentName ) Source #

_DataConI :: Prism' Info (Name, Type, ParentName)         -- template-haskell-2.11+
_DataConI :: Prism' Info (Name, Type, ParentName, Fixity) -- template-haskell-2.8 through 2.10
_DataConI :: Prism' Info (Name, Type, Name,       Fixity) -- Earlier versions

_VarI :: Prism' Info ( Name , Type , Maybe Dec ) Source #

_VarI :: Prism' Info (Name, Type, Maybe Dec)         -- template-haskell-2.11+
_VarI :: Prism' Info (Name, Type, Maybe Dec, Fixity) -- Earlier versions

Dec Prisms

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

_DataD :: Prism' Dec (Cxt, Name, [TyVarBndrUnit], Maybe Kind, [Con], [DerivClause]) -- template-haskell-2.12+
_DataD :: Prism' Dec (Cxt, Name, [Type],          Maybe Kind, [Con], Cxt)           -- template-haskell-2.11
_DataD :: Prism' Dec (Cxt, Name, [Type],                      [Con], [Name])        -- Earlier versions

_NewtypeD :: DataPrism' [ TyVarBndrUnit ] Con Source #

_NewtypeD :: Prism' Dec (Cxt, Name, [TyVarBndrUnit], Maybe Kind, Con, [DerivClause]) -- template-haskell-2.12+
_NewtypeD :: Prism' Dec (Cxt, Name, [Type],          Maybe Kind, Con, Cxt)           -- template-haskell-2.11
_NewtypeD :: Prism' Dec (Cxt, Name, [Type],                      Con, [Name])        -- Earlier versions

_InstanceD :: Prism' Dec ( Maybe Overlap , Cxt , Type , [ Dec ]) Source #

_InstanceD :: Prism' Dec (Maybe Overlap, Cxt, Type, [Dec]) -- template-haskell-2.11+
_InstanceD :: Prism' Dec                (Cxt, Type, [Dec]) -- Earlier versions

_DataInstD :: Prism' Dec ( Cxt , Maybe [ TyVarBndrUnit ], Type , Maybe Kind , [ Con ], [ DerivClause ]) Source #

_DataInstD :: Prism' Dec (Cxt, Maybe [TyVarBndrUnit], Type, Maybe Kind, [Con], [DerivClause]) -- template-haskell-2.15+
_DataInstD :: Prism' Dec (Cxt, Name, [Type],                Maybe Kind, [Con], [DerivClause]) -- template-haskell-2.12 through 2.14
_DataInstD :: Prism' Dec (Cxt, Name, [Type],                Maybe Kind, [Con], Cxt)           -- template-haskell-2.11
_DataInstD :: Prism' Dec (Cxt, Name, [Type],                            [Con], [Name])        -- Earlier versions

_NewtypeInstD :: Prism' Dec ( Cxt , Maybe [ TyVarBndrUnit ], Type , Maybe Kind , Con , [ DerivClause ]) Source #

_NewtypeInstD :: Prism' Dec (Cxt, Maybe [TyVarBndrUnit], Type, Maybe Kind, Con, [DerivClause]) -- template-haskell-2.15+
_NewtypeInstD :: Prism' Dec (Cxt, Name, [Type],                Maybe Kind, Con, [DerivClause]) -- template-haskell-2.12 through 2.14
_NewtypeInstD :: Prism' Dec (Cxt, Name, [Type],                Maybe Kind, Con, Cxt)           -- template-haskell-2.11
_NewtypeInstD :: Prism' Dec (Cxt, Name, [Type],                            Con, [Name])        -- Earlier versions

_TySynInstD :: Prism' Dec TySynEqn Source #

_TySynInstD :: Prism' Dec TySynEqn             -- template-haskell-2.15+
_TySynInstD :: Prism' Dec (Name, TySynEqn)     -- template-haskell-2.9 through 2.14
_TySynInstD :: Prism' Dec (Name, [Type], Type) -- Earlier versions

_StandaloneDerivD :: Prism' Dec ( Maybe DerivStrategy , Cxt , Type ) Source #

_StandaloneDerivD :: Prism' Dec (Maybe DerivStrategy, Cxt, Type) -- template-haskell-2.12+
_StandaloneDerivD :: Prism' Dec                      (Cxt, Type) -- Earlier versions

PatSynDir Prisms

PatSynArgs Prisms

Con Prisms

_NormalC :: Prism' Con ( Name , [ BangType ]) Source #

_NormalC :: Prism' Con (Name, [BangType])   -- template-haskell-2.11+
_NormalC :: Prism' Con (Name, [StrictType]) -- Earlier versions

_RecC :: Prism' Con ( Name , [ VarBangType ]) Source #

_RecC :: Prism' Con (Name, [VarBangType])   -- template-haskell-2.11+
_RecC :: Prism' Con (Name, [VarStrictType]) -- Earlier versions

_InfixC :: Prism' Con ( BangType , Name , BangType ) Source #

_InfixC :: Prism' Con (BangType,   Name, BangType)   -- template-haskell-2.11+
_InfixC :: Prism' Con (StrictType, Name, StrictType) -- Earlier versions

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

FixityDirection Prisms

Exp Prisms

_TupE :: Prism' Exp [ Maybe Exp ] Source #

_TupE :: Prism' Exp [Maybe Exp] -- template-haskell-2.16+
_TupE :: Prism' Exp [Exp]       -- Earlier versions

_UnboxedTupE :: Prism' Exp [ Maybe Exp ] Source #

_UnboxedTupE :: Prism' Exp [Maybe Exp] -- template-haskell-2.16+
_UnboxedTupE :: Prism' Exp [Exp]       -- Earlier versions

_DoE :: Prism' Exp [ Stmt ] Source #

_DoE :: Prism' Exp (Maybe ModName, [Stmt]) -- template-haskell-2.17+
_DoE :: Prism' Exp [Stmt]                  -- Earlier versions

_MDoE :: Prism' Exp [ Stmt ] Source #

_MDoE :: Prism' Exp (Maybe ModName, [Stmt]) -- template-haskell-2.17+
_MDoE :: Prism' Exp [Stmt]                  -- Earlier versions

Body Prisms

Guard Prisms

Stmt Prisms

Range Prisms

Lit Prisms

Pat Prisms

Type Prisms

TyVarBndr Prisms

_PlainTV :: Prism' TyVarBndr Name Source #

_PlainTV :: Prism' (TyVarBndr flag) (Name, flag) -- template-haskell-2.17+
_PlainTV :: Prism'  TyVarBndr        Name        -- Earlier versions

_KindedTV :: Prism' TyVarBndr ( Name , Kind ) Source #

_KindedTV :: Prism' (TyVarBndr flag) (Name, flag, Kind) -- template-haskell-2.17+
_KindedTV :: Prism'  TyVarBndr       (Name,       Kind) -- Earlier versions

FamilyResultSig Prisms

TyLit Prisms

Role Prisms

DerivStrategy Prisms