{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
#if defined(__GLASGOW_HASKELL__)
{-# LANGUAGE Trustworthy #-}
#endif
{-# LANGUAGE Rank2Types #-}

#include "lens-common.h"

-----------------------------------------------------------------------------
-- |
-- Module      :  Language.Haskell.TH.Lens
-- Copyright   :  (C) 2012-2016 Edward Kmett
-- License     :  BSD-style (see the file LICENSE)
-- Maintainer  :  Edward Kmett <ekmett@gmail.com>
-- Stability   :  experimental
-- Portability :  TemplateHaskell
--
-- 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@.
----------------------------------------------------------------------------
module Language.Haskell.TH.Lens
  (
  -- * Traversals
    HasName(..)
  , HasTypes(..)
  , HasTypeVars(..)
  , SubstType(..)
  , typeVars      -- :: HasTypeVars t => Traversal' t Name
  , substTypeVars -- :: HasTypeVars t => Map Name Name -> t -> t
  , conFields
  , conNamedFields
  -- * Lenses
  -- ** Loc Lenses
  , locFileName
  , locPackage
  , locModule
  , locStart
  , locEnd
  -- ** FunDep Lenses
  , funDepInputs
  , funDepOutputs
  -- ** Match Lenses
  , matchPattern
  , matchBody
  , matchDeclarations
  -- ** Fixity Lenses
  , fixityPrecedence
  , fixityDirection
  -- ** Clause Lenses
  , clausePattern
  , clauseBody
  , clauseDecs
  -- ** FieldExp Lenses
  , fieldExpName
  , fieldExpExpression
  -- ** FieldPat Lenses
  , fieldPatName
  , fieldPatPattern
  -- ** TySynEqn Lenses
# if MIN_VERSION_template_haskell(2,15,0)
  , tySynEqnLHS
# endif
  , tySynEqnPatterns
  , tySynEqnResult
  -- ** InjectivityAnn Lenses
  , injectivityAnnOutput
  , injectivityAnnInputs
  -- ** TypeFamilyHead Lenses
  , typeFamilyHeadName
  , typeFamilyHeadTyVarBndrs
  , typeFamilyHeadResultSig
  , typeFamilyHeadInjectivityAnn
  -- ** Bang Lenses
  , bangSourceUnpackedness
  , bangSourceStrictness
#if MIN_VERSION_template_haskell(2,12,0)
  -- ** DerivClause Lenses
  , derivClauseStrategy
  , derivClauseCxt
#endif
  -- * Prisms
  -- ** Info Prisms
  , _ClassI
  , _ClassOpI
  , _TyConI
  , _FamilyI
  , _PrimTyConI
  , _DataConI
  , _VarI
  , _TyVarI
#if MIN_VERSION_template_haskell(2,12,0)
  , _PatSynI
#endif
  -- ** Dec Prisms
  , _FunD
  , _ValD
  , _DataD
  , _NewtypeD
  , _TySynD
  , _ClassD
  , _InstanceD
  , _SigD
  , _ForeignD
  , _InfixD
  , _PragmaD
  , _DataInstD
  , _NewtypeInstD
  , _TySynInstD
  , _ClosedTypeFamilyD
  , _RoleAnnotD
  , _StandaloneDerivD
  , _DefaultSigD
  , _DataFamilyD
  , _OpenTypeFamilyD
#if MIN_VERSION_template_haskell(2,12,0)
  , _PatSynD
  , _PatSynSigD
#endif
#if MIN_VERSION_template_haskell(2,15,0)
  , _ImplicitParamBindD
#endif
#if MIN_VERSION_template_haskell(2,19,0)
  , _DefaultD
#endif
#if MIN_VERSION_template_haskell(2,20,0)
  , _TypeDataD
#endif
#if MIN_VERSION_template_haskell(2,12,0)
  -- ** PatSynDir Prisms
  , _Unidir
  , _ImplBidir
  , _ExplBidir
  -- ** PatSynArgs Prisms
  , _PrefixPatSyn
  , _InfixPatSyn
  , _RecordPatSyn
#endif
  -- ** Con Prisms
  , _NormalC
  , _RecC
  , _InfixC
  , _ForallC
  , _GadtC
  , _RecGadtC
  -- ** Overlap Prisms
  ,_Overlappable
  ,_Overlapping
  ,_Overlaps
  ,_Incoherent
  -- ** SourceUnpackedness Prisms
  , _NoSourceUnpackedness
  , _SourceNoUnpack
  , _SourceUnpack
  -- ** SourceStrictness Prisms
  , _NoSourceStrictness
  , _SourceLazy
  , _SourceStrict
  -- ** DecidedStrictness Prisms
  , _DecidedLazy
  , _DecidedStrict
  , _DecidedUnpack
  -- ** Foreign Prisms
  , _ImportF
  , _ExportF
  -- ** Callconv Prisms
  , _CCall
  , _StdCall
  , _CApi
  , _Prim
  , _JavaScript
  -- ** Safety Prisms
  , _Unsafe
  , _Safe
  , _Interruptible
  -- ** Pragma Prisms
  , _InlineP
  , _SpecialiseP
  , _SpecialiseInstP
  , _RuleP
  , _AnnP
  , _LineP
#if MIN_VERSION_template_haskell(2,12,0)
  , _CompleteP
#endif
#if MIN_VERSION_template_haskell(2,19,0)
  , _OpaqueP
#endif
  -- ** Inline Prisms
  , _NoInline
  , _Inline
  , _Inlinable
  -- ** RuleMatch Prisms
  , _ConLike
  , _FunLike
  -- ** Phases Prisms
  , _AllPhases
  , _FromPhase
  , _BeforePhase
  -- ** RuleBndr Prisms
  , _RuleVar
  , _TypedRuleVar
  -- ** AnnTarget Prisms
  , _ModuleAnnotation
  , _TypeAnnotation
  , _ValueAnnotation
  -- ** FunDep Prisms TODO make a lens
  , _FunDep
#if !(MIN_VERSION_template_haskell(2,13,0))
  -- ** FamFlavour Prisms
  , _TypeFam
  , _DataFam
#endif
  -- ** FixityDirection Prisms
  , _InfixL
  , _InfixR
  , _InfixN
  -- ** Exp Prisms
  , _VarE
  , _ConE
  , _LitE
  , _AppE
#if MIN_VERSION_template_haskell(2,12,0)
  , _AppTypeE
#endif
  , _InfixE
  , _UInfixE
  , _ParensE
  , _LamE
  , _LamCaseE
  , _TupE
  , _UnboxedTupE
#if MIN_VERSION_template_haskell(2,12,0)
  , _UnboxedSumE
#endif
  , _CondE
  , _MultiIfE
  , _LetE
  , _CaseE
  , _DoE
  , _CompE
  , _ArithSeqE
  , _ListE
  , _SigE
  , _RecConE
  , _RecUpdE
  , _StaticE
  , _UnboundVarE
#if MIN_VERSION_template_haskell(2,13,0)
  , _LabelE
#endif
#if MIN_VERSION_template_haskell(2,15,0)
  , _MDoE
  , _ImplicitParamVarE
#endif
#if MIN_VERSION_template_haskell(2,18,0)
  , _GetFieldE
  , _ProjectionE
#endif
#if MIN_VERSION_template_haskell(2,19,0)
  , _LamCasesE
#endif
#if MIN_VERSION_template_haskell(2,21,0)
  , _TypedBracketE
  , _TypedSpliceE
#endif
  -- ** Body Prisms
  , _GuardedB
  , _NormalB
  -- ** Guard Prisms
  , _NormalG
  , _PatG
  -- ** Stmt Prisms
  , _BindS
  , _LetS
  , _NoBindS
  , _ParS
#if MIN_VERSION_template_haskell(2,15,0)
  , _RecS
#endif
  -- ** Range Prisms
  , _FromR
  , _FromThenR
  , _FromToR
  , _FromThenToR
  -- ** Lit Prisms
  , _CharL
  , _StringL
  , _IntegerL
  , _RationalL
  , _IntPrimL
  , _WordPrimL
  , _FloatPrimL
  , _DoublePrimL
  , _StringPrimL
  , _CharPrimL
#if MIN_VERSION_template_haskell(2,16,0)
  , _BytesPrimL
#endif
  -- ** Pat Prisms
  , _LitP
  , _VarP
  , _TupP
  , _UnboxedTupP
#if MIN_VERSION_template_haskell(2,12,0)
  , _UnboxedSumP
#endif
  , _ConP
  , _InfixP
  , _UInfixP
  , _ParensP
  , _TildeP
  , _BangP
  , _AsP
  , _WildP
  , _RecP
  , _ListP
  , _SigP
  , _ViewP
  -- ** Type Prisms
  , _ForallT
  , _AppT
  , _SigT
  , _VarT
  , _ConT
  , _PromotedT
  , _TupleT
  , _UnboxedTupleT
#if MIN_VERSION_template_haskell(2,12,0)
  , _UnboxedSumT
#endif
  , _ArrowT
  , _EqualityT
  , _ListT
  , _PromotedTupleT
  , _PromotedNilT
  , _PromotedConsT
  , _StarT
  , _ConstraintT
  , _LitT
  , _InfixT
  , _UInfixT
  , _ParensT
  , _WildCardT
#if MIN_VERSION_template_haskell(2,15,0)
  , _AppKindT
  , _ImplicitParamT
#endif
#if MIN_VERSION_template_haskell(2,16,0)
  , _ForallVisT
#endif
#if MIN_VERSION_template_haskell(2,17,0)
  , _MulArrowT
#endif
#if MIN_VERSION_template_haskell(2,19,0)
  , _PromotedInfixT
  , _PromotedUInfixT
#endif
#if MIN_VERSION_template_haskell(2,17,0)
  -- ** Specificity Prisms
  , _SpecifiedSpec
  , _InferredSpec
#endif
#if MIN_VERSION_template_haskell(2,21,0)
  -- ** BndrVis Prisms
  , _BndrReq
  , _BndrInvis
#endif
  -- ** TyVarBndr Prisms
  , _PlainTV
  , _KindedTV
  -- ** FamilyResultSig Prisms
  , _NoSig
  , _KindSig
  , _TyVarSig
  -- ** TyLit Prisms
  , _NumTyLit
  , _StrTyLit
#if MIN_VERSION_template_haskell(2,18,0)
  , _CharTyLit
#endif
  -- ** Role Prisms
  , _NominalR
  , _RepresentationalR
  , _PhantomR
  , _InferR
#if MIN_VERSION_template_haskell(2,12,0)
  -- ** DerivStrategy Prisms
  , _StockStrategy
  , _AnyclassStrategy
  , _NewtypeStrategy
#endif
  ) where

import Control.Applicative
import Control.Lens.At
import Control.Lens.Getter
import Control.Lens.Setter
import Control.Lens.Fold
import Control.Lens.Internal.TH
import Control.Lens.Iso (Iso', iso)
import Control.Lens.Lens
import Control.Lens.Prism
import Control.Lens.Tuple
import Control.Lens.Traversal
import qualified Data.Map as Map
import Data.Map (Map)
import Data.Maybe (fromMaybe)
import Data.Monoid
import qualified Data.Set as Set
import Data.Set (Set)
import Data.Set.Lens
import Language.Haskell.TH
import Language.Haskell.TH.Datatype.TyVarBndr
import Language.Haskell.TH.Syntax
import Data.Word
#if MIN_VERSION_template_haskell(2,15,0)
import Data.Foldable as F (foldl')
#endif
#if MIN_VERSION_template_haskell(2,18,0)
import Data.List.NonEmpty (NonEmpty)
#endif
import Prelude

-- | Has a 'Name'
class HasName t where
  -- | Extract (or modify) the 'Name' of something
  name :: Lens' t Name

instance HasName (TyVarBndr_ flag) where
  name :: Lens' (TyVarBndr_ flag) Name
name = (Name -> f Name) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
forall (f :: * -> *) flag.
Functor f =>
(Name -> f Name) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
traverseTVName

instance HasName Name where
  name :: Lens' Name Name
name = (Name -> f Name) -> Name -> f Name
forall a. a -> a
id

-- | On @template-haskell-2.11.0.0@ or later, if a 'GadtC' or 'RecGadtC' has
-- multiple 'Name's, the leftmost 'Name' will be chosen.
instance HasName Con where
  name :: Lens' Con Name
name Name -> f Name
f (NormalC Name
n [BangType]
tys)       = (Name -> [BangType] -> Con
`NormalC` [BangType]
tys) (Name -> Con) -> f Name -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n
  name Name -> f Name
f (RecC Name
n [VarBangType]
tys)          = (Name -> [VarBangType] -> Con
`RecC` [VarBangType]
tys) (Name -> Con) -> f Name -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n
  name Name -> f Name
f (InfixC BangType
l Name
n BangType
r)        = (\Name
n' -> BangType -> Name -> BangType -> Con
InfixC BangType
l Name
n' BangType
r) (Name -> Con) -> f Name -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n
  name Name -> f Name
f (ForallC [TyVarBndr Specificity]
bds Cxt
ctx Con
con) = [TyVarBndr Specificity] -> Cxt -> Con -> Con
ForallC [TyVarBndr Specificity]
bds Cxt
ctx (Con -> Con) -> f Con -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Name -> f Name) -> Con -> f Con
forall t. HasName t => Lens' t Name
Lens' Con Name
name Name -> f Name
f Con
con
  name Name -> f Name
f (GadtC [Name]
ns [BangType]
argTys Type
retTy) =
    (\Name
n -> [Name] -> [BangType] -> Type -> Con
GadtC [Name
n] [BangType]
argTys Type
retTy) (Name -> Con) -> f Name -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f ([Name] -> Name
headGadtConName [Name]
ns)
  name Name -> f Name
f (RecGadtC [Name]
ns [VarBangType]
argTys Type
retTy) =
    (\Name
n -> [Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name
n] [VarBangType]
argTys Type
retTy) (Name -> Con) -> f Name -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f ([Name] -> Name
headGadtConName [Name]
ns)

-- @template-haskell@ maintains the invariant that the list of constructor
-- @Name@s in a 'GadtC' or 'RecGadtC' will always be non-empty.
headGadtConName :: [Name] -> Name
headGadtConName :: [Name] -> Name
headGadtConName [Name]
conNames =
  case [Name]
conNames of
    Name
conName:[Name]
_ -> Name
conName
    [] -> [Char] -> Name
forall a. HasCallStack => [Char] -> a
error [Char]
"headGadtConName: Unexpected empty list of GADT constructor names"

instance HasName Foreign where
  name :: Lens' Foreign Name
name Name -> f Name
f (ImportF Callconv
cc Safety
saf [Char]
str Name
n Type
ty) =
    (\Name
n' -> Callconv -> Safety -> [Char] -> Name -> Type -> Foreign
ImportF Callconv
cc Safety
saf [Char]
str Name
n' Type
ty) (Name -> Foreign) -> f Name -> f Foreign
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n
  name Name -> f Name
f (ExportF Callconv
cc [Char]
str Name
n Type
ty) =
    (\Name
n' -> Callconv -> [Char] -> Name -> Type -> Foreign
ExportF Callconv
cc [Char]
str Name
n' Type
ty) (Name -> Foreign) -> f Name -> f Foreign
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n

instance HasName RuleBndr where
  name :: Lens' RuleBndr Name
name Name -> f Name
f (RuleVar Name
n) = Name -> RuleBndr
RuleVar (Name -> RuleBndr) -> f Name -> f RuleBndr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n
  name Name -> f Name
f (TypedRuleVar Name
n Type
ty) = (Name -> Type -> RuleBndr
`TypedRuleVar` Type
ty) (Name -> RuleBndr) -> f Name -> f RuleBndr
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n

instance HasName TypeFamilyHead where
  name :: Lens' TypeFamilyHead Name
name Name -> f Name
f (TypeFamilyHead Name
n [TyVarBndr BndrVis]
tvbs FamilyResultSig
frs Maybe InjectivityAnn
mia) =
    (\Name
n' -> Name
-> [TyVarBndr BndrVis]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n' [TyVarBndr BndrVis]
tvbs FamilyResultSig
frs Maybe InjectivityAnn
mia) (Name -> TypeFamilyHead) -> f Name -> f TypeFamilyHead
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n

instance HasName InjectivityAnn where
  name :: Lens' InjectivityAnn Name
name Name -> f Name
f (InjectivityAnn Name
n [Name]
deps) = (Name -> [Name] -> InjectivityAnn
`InjectivityAnn` [Name]
deps) (Name -> InjectivityAnn) -> f Name -> f InjectivityAnn
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n

-- | Contains some amount of `Type`s inside
class HasTypes t where
  -- | Traverse all the types
  types :: Traversal' t Type

instance HasTypes Type where
  types :: Traversal' Type Type
types = (Type -> f Type) -> Type -> f Type
forall a. a -> a
id

instance HasTypes Con where
  types :: Traversal' Con Type
types Type -> f Type
f (NormalC Name
n [BangType]
t)      = Name -> [BangType] -> Con
NormalC Name
n ([BangType] -> Con) -> f [BangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
Lens BangType BangType Type Type
_2 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f)) [BangType]
t
  types Type -> f Type
f (RecC Name
n [VarBangType]
t)         = Name -> [VarBangType] -> Con
RecC Name
n ([VarBangType] -> Con) -> f [VarBangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((Type -> f Type) -> VarBangType -> f VarBangType
forall s t a b. Field3 s t a b => Lens s t a b
Lens VarBangType VarBangType Type Type
_3 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f)) [VarBangType]
t
  types Type -> f Type
f (InfixC BangType
t1 Name
n BangType
t2) = BangType -> Name -> BangType -> Con
InfixC (BangType -> Name -> BangType -> Con)
-> f BangType -> f (Name -> BangType -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
Lens BangType BangType Type Type
_2 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f) BangType
t1
                                       f (Name -> BangType -> Con) -> f Name -> f (BangType -> Con)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Name -> f Name
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n f (BangType -> Con) -> f BangType -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
Lens BangType BangType Type Type
_2 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f) BangType
t2
  types Type -> f Type
f (ForallC [TyVarBndr Specificity]
vb Cxt
ctx Con
con)    = [TyVarBndr Specificity] -> Cxt -> Con -> Con
ForallC [TyVarBndr Specificity]
vb Cxt
ctx (Con -> Con) -> f Con -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Type -> f Type) -> Con -> f Con
forall t. HasTypes t => Traversal' t Type
Traversal' Con Type
types Type -> f Type
f Con
con
  types Type -> f Type
f (GadtC [Name]
ns [BangType]
argTys Type
retTy) =
    [Name] -> [BangType] -> Type -> Con
GadtC    [Name]
ns ([BangType] -> Type -> Con) -> f [BangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
Lens BangType BangType Type Type
_2 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f)) [BangType]
argTys f (Type -> Con) -> f Type -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f Type
retTy
  types Type -> f Type
f (RecGadtC [Name]
ns [VarBangType]
argTys Type
retTy) =
    [Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
ns ([VarBangType] -> Type -> Con)
-> f [VarBangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((Type -> f Type) -> VarBangType -> f VarBangType
forall s t a b. Field3 s t a b => Lens s t a b
Lens VarBangType VarBangType Type Type
_3 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f)) [VarBangType]
argTys f (Type -> Con) -> f Type -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f Type
retTy

instance HasTypes Foreign where
  types :: Traversal' Foreign Type
types Type -> f Type
f (ImportF Callconv
cc Safety
saf [Char]
str Name
n Type
t) = Callconv -> Safety -> [Char] -> Name -> Type -> Foreign
ImportF Callconv
cc Safety
saf [Char]
str Name
n (Type -> Foreign) -> f Type -> f Foreign
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f Type
t
  types Type -> f Type
f (ExportF Callconv
cc     [Char]
str Name
n Type
t) = Callconv -> [Char] -> Name -> Type -> Foreign
ExportF Callconv
cc     [Char]
str Name
n (Type -> Foreign) -> f Type -> f Foreign
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f Type
t

instance HasTypes TySynEqn where
#if MIN_VERSION_template_haskell(2,15,0)
  types :: Traversal' TySynEqn Type
types Type -> f Type
f (TySynEqn Maybe [TyVarBndr ()]
mtvbs Type
lhs Type
rhs) = Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn
TySynEqn (Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn)
-> f (Maybe [TyVarBndr ()]) -> f (Type -> Type -> TySynEqn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ([TyVarBndr ()] -> f [TyVarBndr ()])
-> Maybe [TyVarBndr ()] -> f (Maybe [TyVarBndr ()])
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Maybe a -> f (Maybe b)
traverse ((TyVarBndr () -> f (TyVarBndr ()))
-> [TyVarBndr ()] -> f [TyVarBndr ()]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse TyVarBndr () -> f (TyVarBndr ())
forall {flag}. TyVarBndr_ flag -> f (TyVarBndr_ flag)
go) Maybe [TyVarBndr ()]
mtvbs
                                              f (Type -> Type -> TySynEqn) -> f Type -> f (Type -> TySynEqn)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f Type
lhs
                                              f (Type -> TySynEqn) -> f Type -> f TySynEqn
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
Traversal' Type Type
types Type -> f Type
f Type
rhs
    where
      go :: TyVarBndr_ flag -> f (TyVarBndr_ flag)
go = (Type -> f Type) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
forall (f :: * -> *) flag.
Applicative f =>
(Type -> f Type) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
traverseTVKind Type -> f Type
f
#else
  types f (TySynEqn lhss rhs) = TySynEqn <$> traverse (types f) lhss
                                         <*> types f rhs
#endif

instance HasTypes t => HasTypes [t] where
  types :: Traversal' [t] Type
types = (t -> f t) -> [t] -> f [t]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((t -> f t) -> [t] -> f [t])
-> ((Type -> f Type) -> t -> f t)
-> (Type -> f Type)
-> [t]
-> f [t]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Type -> f Type) -> t -> f t
forall t. HasTypes t => Traversal' t Type
Traversal' t Type
types

-- | Provides for the extraction of free type variables, and alpha renaming.
class HasTypeVars t where
  -- | 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'.
  typeVarsEx :: Set Name -> Traversal' t Name

instance HasTypeVars (TyVarBndr_ flag) where
  typeVarsEx :: Set Name -> Traversal' (TyVarBndr_ flag) Name
typeVarsEx Set Name
s Name -> f Name
f TyVarBndr_ flag
b
    | Set Name
sSet Name -> Getting Bool (Set Name) Bool -> Bool
forall s a. s -> Getting a s a -> a
^.Index (Set Name) -> Lens' (Set Name) Bool
forall m. Contains m => Index m -> Lens' m Bool
contains (TyVarBndr_ flag
bTyVarBndr_ flag -> Getting Name (TyVarBndr_ flag) Name -> Name
forall s a. s -> Getting a s a -> a
^.Getting Name (TyVarBndr_ flag) Name
forall t. HasName t => Lens' t Name
Lens' (TyVarBndr_ flag) Name
name) = TyVarBndr_ flag -> f (TyVarBndr_ flag)
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TyVarBndr_ flag
b
    | Bool
otherwise             = (Name -> f Name) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
forall t. HasName t => Lens' t Name
Lens' (TyVarBndr_ flag) Name
name Name -> f Name
f TyVarBndr_ flag
b

instance HasTypeVars Name where
  typeVarsEx :: Set Name -> Traversal' Name Name
typeVarsEx Set Name
s Name -> f Name
f Name
n
    | Set Name
sSet Name -> Getting Bool (Set Name) Bool -> Bool
forall s a. s -> Getting a s a -> a
^.Index (Set Name) -> Lens' (Set Name) Bool
forall m. Contains m => Index m -> Lens' m Bool
contains Name
Index (Set Name)
n = Name -> f Name
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n
    | Bool
otherwise     = Name -> f Name
f Name
n

instance HasTypeVars Type where
  typeVarsEx :: Set Name -> Traversal' Type Name
typeVarsEx Set Name
s Name -> f Name
f (VarT Name
n)             = Name -> Type
VarT (Name -> Type) -> f Name -> f Type
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Name Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Name
n
  typeVarsEx Set Name
s Name -> f Name
f (AppT Type
l Type
r)           = Type -> Type -> Type
AppT (Type -> Type -> Type) -> f Type -> f (Type -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
l f (Type -> Type) -> f Type -> f Type
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
r
  typeVarsEx Set Name
s Name -> f Name
f (ForallT [TyVarBndr Specificity]
bs Cxt
ctx Type
ty)  = [TyVarBndr Specificity] -> Cxt -> Type -> Type
ForallT [TyVarBndr Specificity]
bs (Cxt -> Type -> Type) -> f Cxt -> f (Type -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Cxt Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s' Name -> f Name
f Cxt
ctx f (Type -> Type) -> f Type -> f Type
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s' Name -> f Name
f Type
ty
       where s' :: Set Name
s' = Set Name
s Set Name -> Set Name -> Set Name
forall a. Ord a => Set a -> Set a -> Set a
`Set.union` Getting (Set Name) [TyVarBndr Specificity] Name
-> [TyVarBndr Specificity] -> Set Name
forall a s. Getting (Set a) s a -> s -> Set a
setOf Getting (Set Name) [TyVarBndr Specificity] Name
forall t. HasTypeVars t => Traversal' t Name
Traversal' [TyVarBndr Specificity] Name
typeVars [TyVarBndr Specificity]
bs
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@ConT{}             = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@TupleT{}           = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@ListT{}            = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@ArrowT{}           = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@UnboxedTupleT{}    = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
s Name -> f Name
f (SigT Type
t Type
k)           = Type -> Type -> Type
SigT (Type -> Type -> Type) -> f Type -> f (Type -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t
                                             f (Type -> Type) -> f Type -> f Type
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
k
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@PromotedT{}        = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@PromotedTupleT{}   = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@PromotedNilT{}     = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@PromotedConsT{}    = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@StarT{}            = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@ConstraintT{}      = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@LitT{}             = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@EqualityT{}        = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
s Name -> f Name
f (InfixT  Type
t1 Name
n Type
t2)    = Type -> Name -> Type -> Type
InfixT  (Type -> Name -> Type -> Type)
-> f Type -> f (Name -> Type -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t1
                                                f (Name -> Type -> Type) -> f Name -> f (Type -> Type)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Name -> f Name
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n
                                                f (Type -> Type) -> f Type -> f Type
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t2
  typeVarsEx Set Name
s Name -> f Name
f (UInfixT Type
t1 Name
n Type
t2)    = Type -> Name -> Type -> Type
UInfixT (Type -> Name -> Type -> Type)
-> f Type -> f (Name -> Type -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t1
                                                f (Name -> Type -> Type) -> f Name -> f (Type -> Type)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Name -> f Name
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n
                                                f (Type -> Type) -> f Type -> f Type
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t2
  typeVarsEx Set Name
s Name -> f Name
f (ParensT Type
t)          = Type -> Type
ParensT (Type -> Type) -> f Type -> f Type
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@WildCardT{}        = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
#if MIN_VERSION_template_haskell(2,12,0)
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@UnboxedSumT{}      = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
#endif
#if MIN_VERSION_template_haskell(2,15,0)
  typeVarsEx Set Name
s Name -> f Name
f (AppKindT Type
t Type
k)       = Type -> Type -> Type
AppKindT (Type -> Type -> Type) -> f Type -> f (Type -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t
                                                 f (Type -> Type) -> f Type -> f Type
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
k
  typeVarsEx Set Name
s Name -> f Name
f (ImplicitParamT [Char]
n Type
t) = [Char] -> Type -> Type
ImplicitParamT [Char]
n (Type -> Type) -> f Type -> f Type
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t
#endif
#if MIN_VERSION_template_haskell(2,16,0)
  typeVarsEx Set Name
s Name -> f Name
f (ForallVisT [TyVarBndr ()]
bs Type
ty)   = [TyVarBndr ()] -> Type -> Type
ForallVisT [TyVarBndr ()]
bs (Type -> Type) -> f Type -> f Type
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s' Name -> f Name
f Type
ty
       where s' :: Set Name
s' = Set Name
s Set Name -> Set Name -> Set Name
forall a. Ord a => Set a -> Set a -> Set a
`Set.union` Getting (Set Name) [TyVarBndr ()] Name
-> [TyVarBndr ()] -> Set Name
forall a s. Getting (Set a) s a -> s -> Set a
setOf Getting (Set Name) [TyVarBndr ()] Name
forall t. HasTypeVars t => Traversal' t Name
Traversal' [TyVarBndr ()] Name
typeVars [TyVarBndr ()]
bs
#endif
#if MIN_VERSION_template_haskell(2,17,0)
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@MulArrowT{}        = Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
#endif
#if MIN_VERSION_template_haskell(2,19,0)
  typeVarsEx Set Name
s Name -> f Name
f (PromotedInfixT  Type
t1 Name
n Type
t2) = Type -> Name -> Type -> Type
PromotedInfixT  (Type -> Name -> Type -> Type)
-> f Type -> f (Name -> Type -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t1
                                                             f (Name -> Type -> Type) -> f Name -> f (Type -> Type)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Name -> f Name
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n
                                                             f (Type -> Type) -> f Type -> f Type
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t2
  typeVarsEx Set Name
s Name -> f Name
f (PromotedUInfixT Type
t1 Name
n Type
t2) = Type -> Name -> Type -> Type
PromotedUInfixT (Type -> Name -> Type -> Type)
-> f Type -> f (Name -> Type -> Type)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t1
                                                             f (Name -> Type -> Type) -> f Name -> f (Type -> Type)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Name -> f Name
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n
                                                             f (Type -> Type) -> f Type -> f Type
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t2
#endif

instance HasTypeVars Con where
  typeVarsEx :: Set Name -> Traversal' Con Name
typeVarsEx Set Name
s Name -> f Name
f (NormalC Name
n [BangType]
ts) = Name -> [BangType] -> Con
NormalC Name
n ([BangType] -> Con) -> f [BangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f [BangType] [BangType] Type Type
-> LensLike f [BangType] [BangType] Type Type
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf ((BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((BangType -> f BangType) -> [BangType] -> f [BangType])
-> ((Type -> f Type) -> BangType -> f BangType)
-> LensLike f [BangType] [BangType] Type Type
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
Lens BangType BangType Type Type
_2) (Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f) [BangType]
ts
  typeVarsEx Set Name
s Name -> f Name
f (RecC Name
n [VarBangType]
ts) = Name -> [VarBangType] -> Con
RecC Name
n ([VarBangType] -> Con) -> f [VarBangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f [VarBangType] [VarBangType] Type Type
-> LensLike f [VarBangType] [VarBangType] Type Type
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf ((VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((VarBangType -> f VarBangType)
 -> [VarBangType] -> f [VarBangType])
-> ((Type -> f Type) -> VarBangType -> f VarBangType)
-> LensLike f [VarBangType] [VarBangType] Type Type
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Type -> f Type) -> VarBangType -> f VarBangType
forall s t a b. Field3 s t a b => Lens s t a b
Lens VarBangType VarBangType Type Type
_3) (Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f) [VarBangType]
ts
  typeVarsEx Set Name
s Name -> f Name
f (InfixC BangType
l Name
n BangType
r) = BangType -> Name -> BangType -> Con
InfixC (BangType -> Name -> BangType -> Con)
-> f BangType -> f (Name -> BangType -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BangType -> f BangType
forall {a} {a}. HasTypeVars a => (a, a) -> f (a, a)
g BangType
l f (Name -> BangType -> Con) -> f Name -> f (BangType -> Con)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Name -> f Name
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n f (BangType -> Con) -> f BangType -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BangType -> f BangType
forall {a} {a}. HasTypeVars a => (a, a) -> f (a, a)
g BangType
r
       where g :: (a, a) -> f (a, a)
g (a
i, a
t) = (,) a
i (a -> (a, a)) -> f a -> f (a, a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' a Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f a
t
  typeVarsEx Set Name
s Name -> f Name
f (ForallC [TyVarBndr Specificity]
bs Cxt
ctx Con
c) = [TyVarBndr Specificity] -> Cxt -> Con -> Con
ForallC [TyVarBndr Specificity]
bs (Cxt -> Con -> Con) -> f Cxt -> f (Con -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Set Name -> Traversal' Cxt Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s' Name -> f Name
f Cxt
ctx f (Con -> Con) -> f Con -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Con Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s' Name -> f Name
f Con
c
       where s' :: Set Name
s' = Set Name
s Set Name -> Set Name -> Set Name
forall a. Ord a => Set a -> Set a -> Set a
`Set.union` Getting (Set Name) [TyVarBndr Specificity] Name
-> [TyVarBndr Specificity] -> Set Name
forall a s. Getting (Set a) s a -> s -> Set a
setOf Getting (Set Name) [TyVarBndr Specificity] Name
forall t. HasTypeVars t => Traversal' t Name
Traversal' [TyVarBndr Specificity] Name
typeVars [TyVarBndr Specificity]
bs
  typeVarsEx Set Name
s Name -> f Name
f (GadtC [Name]
ns [BangType]
argTys Type
retTy) =
    [Name] -> [BangType] -> Type -> Con
GadtC [Name]
ns ([BangType] -> Type -> Con) -> f [BangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f [BangType] [BangType] Type Type
-> LensLike f [BangType] [BangType] Type Type
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf ((BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((BangType -> f BangType) -> [BangType] -> f [BangType])
-> ((Type -> f Type) -> BangType -> f BangType)
-> LensLike f [BangType] [BangType] Type Type
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
Lens BangType BangType Type Type
_2) (Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f) [BangType]
argTys
             f (Type -> Con) -> f Type -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
retTy
  typeVarsEx Set Name
s Name -> f Name
f (RecGadtC [Name]
ns [VarBangType]
argTys Type
retTy) =
    [Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
ns ([VarBangType] -> Type -> Con)
-> f [VarBangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f [VarBangType] [VarBangType] Type Type
-> LensLike f [VarBangType] [VarBangType] Type Type
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf ((VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((VarBangType -> f VarBangType)
 -> [VarBangType] -> f [VarBangType])
-> ((Type -> f Type) -> VarBangType -> f VarBangType)
-> LensLike f [VarBangType] [VarBangType] Type Type
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Type -> f Type) -> VarBangType -> f VarBangType
forall s t a b. Field3 s t a b => Lens s t a b
Lens VarBangType VarBangType Type Type
_3) (Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f) [VarBangType]
argTys
                f (Type -> Con) -> f Type -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set Name -> Traversal' Type Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
retTy

instance HasTypeVars t => HasTypeVars [t] where
  typeVarsEx :: Set Name -> Traversal' [t] Name
typeVarsEx Set Name
s = (t -> f t) -> [t] -> f [t]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((t -> f t) -> [t] -> f [t])
-> ((Name -> f Name) -> t -> f t)
-> (Name -> f Name)
-> [t]
-> f [t]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set Name -> Traversal' t Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s

instance HasTypeVars t => HasTypeVars (Maybe t) where
  typeVarsEx :: Set Name -> Traversal' (Maybe t) Name
typeVarsEx Set Name
s = (t -> f t) -> Maybe t -> f (Maybe t)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Maybe a -> f (Maybe b)
traverse ((t -> f t) -> Maybe t -> f (Maybe t))
-> ((Name -> f Name) -> t -> f t)
-> (Name -> f Name)
-> Maybe t
-> f (Maybe t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set Name -> Traversal' t Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s

-- | Traverse /free/ type variables
typeVars :: HasTypeVars t => Traversal' t Name
typeVars :: forall t. HasTypeVars t => Traversal' t Name
typeVars = Set Name -> Traversal' t Name
forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
forall a. Monoid a => a
mempty

-- | Substitute using a map of names in for /free/ type variables
substTypeVars :: HasTypeVars t => Map Name Name -> t -> t
substTypeVars :: forall t. HasTypeVars t => Map Name Name -> t -> t
substTypeVars Map Name Name
m = ASetter t t Name Name -> (Name -> Name) -> t -> t
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over ASetter t t Name Name
forall t. HasTypeVars t => Traversal' t Name
Traversal' t Name
typeVars ((Name -> Name) -> t -> t) -> (Name -> Name) -> t -> t
forall a b. (a -> b) -> a -> b
$ \Name
n -> Name -> Maybe Name -> Name
forall a. a -> Maybe a -> a
fromMaybe Name
n (Map Name Name
mMap Name Name
-> Getting (Maybe Name) (Map Name Name) (Maybe Name) -> Maybe Name
forall s a. s -> Getting a s a -> a
^.Index (Map Name Name)
-> Lens' (Map Name Name) (Maybe (IxValue (Map Name Name)))
forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Name
Index (Map Name Name)
n)

-- | Provides substitution for types
class SubstType t where
  -- | Perform substitution for types
  substType :: Map Name Type -> t -> t

instance SubstType Type where
  substType :: Map Name Type -> Type -> Type
substType Map Name Type
m t :: Type
t@(VarT Name
n)           = Type -> Maybe Type -> Type
forall a. a -> Maybe a -> a
fromMaybe Type
t (Map Name Type
mMap Name Type
-> Getting (Maybe Type) (Map Name Type) (Maybe Type) -> Maybe Type
forall s a. s -> Getting a s a -> a
^.Index (Map Name Type)
-> Lens' (Map Name Type) (Maybe (IxValue (Map Name Type)))
forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Name
Index (Map Name Type)
n)
  substType Map Name Type
m (ForallT [TyVarBndr Specificity]
bs Cxt
ctx Type
ty)  = [TyVarBndr Specificity] -> Cxt -> Type -> Type
ForallT [TyVarBndr Specificity]
bs (Map Name Type -> Cxt -> Cxt
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m' Cxt
ctx) (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m' Type
ty)
    where m' :: Map Name Type
m' = Getting (Endo (Map Name Type)) [TyVarBndr Specificity] Name
-> (Name -> Map Name Type -> Map Name Type)
-> Map Name Type
-> [TyVarBndr Specificity]
-> Map Name Type
forall r s a. Getting (Endo r) s a -> (a -> r -> r) -> r -> s -> r
foldrOf Getting (Endo (Map Name Type)) [TyVarBndr Specificity] Name
forall t. HasTypeVars t => Traversal' t Name
Traversal' [TyVarBndr Specificity] Name
typeVars Name -> Map Name Type -> Map Name Type
forall k a. Ord k => k -> Map k a -> Map k a
Map.delete Map Name Type
m [TyVarBndr Specificity]
bs
  substType Map Name Type
_ t :: Type
t@ConT{}             = Type
t
  substType Map Name Type
_ t :: Type
t@TupleT{}           = Type
t
  substType Map Name Type
_ t :: Type
t@ListT{}            = Type
t
  substType Map Name Type
_ t :: Type
t@ArrowT{}           = Type
t
  substType Map Name Type
_ t :: Type
t@UnboxedTupleT{}    = Type
t
  substType Map Name Type
m (AppT Type
l Type
r)           = Type -> Type -> Type
AppT (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
l) (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
r)
  substType Map Name Type
m (SigT Type
t Type
k)           = Type -> Type -> Type
SigT (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t)
                                          (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
k)
  substType Map Name Type
_ t :: Type
t@PromotedT{}        = Type
t
  substType Map Name Type
_ t :: Type
t@PromotedTupleT{}   = Type
t
  substType Map Name Type
_ t :: Type
t@PromotedNilT{}     = Type
t
  substType Map Name Type
_ t :: Type
t@PromotedConsT{}    = Type
t
  substType Map Name Type
_ t :: Type
t@StarT{}            = Type
t
  substType Map Name Type
_ t :: Type
t@ConstraintT{}      = Type
t
  substType Map Name Type
_ t :: Type
t@LitT{}             = Type
t
  substType Map Name Type
_ t :: Type
t@EqualityT{}        = Type
t
  substType Map Name Type
m (InfixT  Type
t1 Name
n Type
t2)    = Type -> Name -> Type -> Type
InfixT  (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t1) Name
n (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t2)
  substType Map Name Type
m (UInfixT Type
t1 Name
n Type
t2)    = Type -> Name -> Type -> Type
UInfixT (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t1) Name
n (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t2)
  substType Map Name Type
m (ParensT Type
t)          = Type -> Type
ParensT (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t)
  substType Map Name Type
_ t :: Type
t@WildCardT{}        = Type
t
#if MIN_VERSION_template_haskell(2,12,0)
  substType Map Name Type
_ t :: Type
t@UnboxedSumT{}      = Type
t
#endif
#if MIN_VERSION_template_haskell(2,15,0)
  substType Map Name Type
m (AppKindT Type
t Type
k)       = Type -> Type -> Type
AppKindT (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t) (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
k)
  substType Map Name Type
m (ImplicitParamT [Char]
n Type
t) = [Char] -> Type -> Type
ImplicitParamT [Char]
n (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t)
#endif
#if MIN_VERSION_template_haskell(2,16,0)
  substType Map Name Type
m (ForallVisT [TyVarBndr ()]
bs Type
ty)   = [TyVarBndr ()] -> Type -> Type
ForallVisT [TyVarBndr ()]
bs (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m' Type
ty)
    where m' :: Map Name Type
m' = Getting (Endo (Map Name Type)) [TyVarBndr ()] Name
-> (Name -> Map Name Type -> Map Name Type)
-> Map Name Type
-> [TyVarBndr ()]
-> Map Name Type
forall r s a. Getting (Endo r) s a -> (a -> r -> r) -> r -> s -> r
foldrOf Getting (Endo (Map Name Type)) [TyVarBndr ()] Name
forall t. HasTypeVars t => Traversal' t Name
Traversal' [TyVarBndr ()] Name
typeVars Name -> Map Name Type -> Map Name Type
forall k a. Ord k => k -> Map k a -> Map k a
Map.delete Map Name Type
m [TyVarBndr ()]
bs
#endif
#if MIN_VERSION_template_haskell(2,17,0)
  substType Map Name Type
_ t :: Type
t@MulArrowT{}        = Type
t
#endif
#if MIN_VERSION_template_haskell(2,19,0)
  substType Map Name Type
m (PromotedInfixT  Type
t1 Name
n Type
t2) = Type -> Name -> Type -> Type
PromotedInfixT  (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t1) Name
n (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t2)
  substType Map Name Type
m (PromotedUInfixT Type
t1 Name
n Type
t2) = Type -> Name -> Type -> Type
PromotedUInfixT (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t1) Name
n (Map Name Type -> Type -> Type
forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t2)
#endif

instance SubstType t => SubstType [t] where
  substType :: Map Name Type -> [t] -> [t]
substType = (t -> t) -> [t] -> [t]
forall a b. (a -> b) -> [a] -> [b]
map ((t -> t) -> [t] -> [t])
-> (Map Name Type -> t -> t) -> Map Name Type -> [t] -> [t]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map Name Type -> t -> t
forall t. SubstType t => Map Name Type -> t -> t
substType

-- | Provides a 'Traversal' of the types of each field of a constructor.
conFields :: Traversal' Con BangType
conFields :: Traversal' Con BangType
conFields BangType -> f BangType
f (NormalC Name
n [BangType]
fs)      = Name -> [BangType] -> Con
NormalC Name
n ([BangType] -> Con) -> f [BangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse BangType -> f BangType
f [BangType]
fs
conFields BangType -> f BangType
f (RecC Name
n [VarBangType]
fs)         = Name -> [VarBangType] -> Con
RecC Name
n ([VarBangType] -> Con) -> f [VarBangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((BangType -> f BangType) -> VarBangType -> f VarBangType
Traversal' VarBangType BangType
sansVar BangType -> f BangType
f) [VarBangType]
fs
conFields BangType -> f BangType
f (InfixC BangType
l Name
n BangType
r)      = BangType -> Name -> BangType -> Con
InfixC (BangType -> Name -> BangType -> Con)
-> f BangType -> f (Name -> BangType -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BangType -> f BangType
f BangType
l f (Name -> BangType -> Con) -> f Name -> f (BangType -> Con)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Name -> f Name
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n f (BangType -> Con) -> f BangType -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BangType -> f BangType
f BangType
r
conFields BangType -> f BangType
f (ForallC [TyVarBndr Specificity]
bds Cxt
ctx Con
c) = [TyVarBndr Specificity] -> Cxt -> Con -> Con
ForallC [TyVarBndr Specificity]
bds Cxt
ctx (Con -> Con) -> f Con -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> Con -> f Con
Traversal' Con BangType
conFields BangType -> f BangType
f Con
c
conFields BangType -> f BangType
f (GadtC [Name]
ns [BangType]
argTys Type
retTy) =
  [Name] -> [BangType] -> Type -> Con
GadtC [Name]
ns ([BangType] -> Type -> Con) -> f [BangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse BangType -> f BangType
f [BangType]
argTys f (Type -> Con) -> f Type -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
retTy
conFields BangType -> f BangType
f (RecGadtC [Name]
ns [VarBangType]
argTys Type
retTy) =
  [Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
ns ([VarBangType] -> Type -> Con)
-> f [VarBangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((BangType -> f BangType) -> VarBangType -> f VarBangType
Traversal' VarBangType BangType
sansVar BangType -> f BangType
f) [VarBangType]
argTys f (Type -> Con) -> f Type -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
retTy

sansVar :: Traversal' VarBangType BangType
sansVar :: Traversal' VarBangType BangType
sansVar BangType -> f BangType
f (Name
fn,Bang
s,Type
t) = (\(Bang
s', Type
t') -> (Name
fn,Bang
s',Type
t')) (BangType -> VarBangType) -> f BangType -> f VarBangType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BangType -> f BangType
f (Bang
s, Type
t)

-- | 'Traversal' of the types of the /named/ fields of a constructor.
conNamedFields :: Traversal' Con VarBangType
conNamedFields :: Traversal' Con VarBangType
conNamedFields VarBangType -> f VarBangType
_ c :: Con
c@NormalC{}      = Con -> f Con
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Con
c
conNamedFields VarBangType -> f VarBangType
_ c :: Con
c@InfixC{}       = Con -> f Con
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Con
c
conNamedFields VarBangType -> f VarBangType
f (RecC Name
n [VarBangType]
fs)      = Name -> [VarBangType] -> Con
RecC Name
n ([VarBangType] -> Con) -> f [VarBangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse VarBangType -> f VarBangType
f [VarBangType]
fs
conNamedFields VarBangType -> f VarBangType
f (ForallC [TyVarBndr Specificity]
a Cxt
b Con
fs) = [TyVarBndr Specificity] -> Cxt -> Con -> Con
ForallC [TyVarBndr Specificity]
a Cxt
b (Con -> Con) -> f Con -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> Con -> f Con
Traversal' Con VarBangType
conNamedFields VarBangType -> f VarBangType
f Con
fs
conNamedFields VarBangType -> f VarBangType
_ c :: Con
c@GadtC{}        = Con -> f Con
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Con
c
conNamedFields VarBangType -> f VarBangType
f (RecGadtC [Name]
ns [VarBangType]
argTys Type
retTy) =
  [Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
ns ([VarBangType] -> Type -> Con)
-> f [VarBangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse VarBangType -> f VarBangType
f [VarBangType]
argTys f (Type -> Con) -> f Type -> f Con
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Type -> f Type
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
retTy

-- Lenses and Prisms
locFileName :: Lens' Loc String
locFileName :: Lens' Loc [Char]
locFileName = (Loc -> [Char]) -> (Loc -> [Char] -> Loc) -> Lens' Loc [Char]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Loc -> [Char]
loc_filename
            ((Loc -> [Char] -> Loc) -> Lens' Loc [Char])
-> (Loc -> [Char] -> Loc) -> Lens' Loc [Char]
forall a b. (a -> b) -> a -> b
$ \Loc
loc [Char]
fn -> Loc
loc { loc_filename = fn }

locPackage :: Lens' Loc String
locPackage :: Lens' Loc [Char]
locPackage = (Loc -> [Char]) -> (Loc -> [Char] -> Loc) -> Lens' Loc [Char]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Loc -> [Char]
loc_package
           ((Loc -> [Char] -> Loc) -> Lens' Loc [Char])
-> (Loc -> [Char] -> Loc) -> Lens' Loc [Char]
forall a b. (a -> b) -> a -> b
$ \Loc
loc [Char]
fn -> Loc
loc { loc_package = fn }

locModule :: Lens' Loc String
locModule :: Lens' Loc [Char]
locModule = (Loc -> [Char]) -> (Loc -> [Char] -> Loc) -> Lens' Loc [Char]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Loc -> [Char]
loc_module
          ((Loc -> [Char] -> Loc) -> Lens' Loc [Char])
-> (Loc -> [Char] -> Loc) -> Lens' Loc [Char]
forall a b. (a -> b) -> a -> b
$ \Loc
loc [Char]
fn -> Loc
loc { loc_module = fn }

locStart :: Lens' Loc CharPos
locStart :: Lens' Loc CharPos
locStart = (Loc -> CharPos) -> (Loc -> CharPos -> Loc) -> Lens' Loc CharPos
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Loc -> CharPos
loc_start
         ((Loc -> CharPos -> Loc) -> Lens' Loc CharPos)
-> (Loc -> CharPos -> Loc) -> Lens' Loc CharPos
forall a b. (a -> b) -> a -> b
$ \Loc
loc CharPos
fn -> Loc
loc { loc_start = fn }

locEnd :: Lens' Loc CharPos
locEnd :: Lens' Loc CharPos
locEnd = (Loc -> CharPos) -> (Loc -> CharPos -> Loc) -> Lens' Loc CharPos
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Loc -> CharPos
loc_end
       ((Loc -> CharPos -> Loc) -> Lens' Loc CharPos)
-> (Loc -> CharPos -> Loc) -> Lens' Loc CharPos
forall a b. (a -> b) -> a -> b
$ \Loc
loc CharPos
fn -> Loc
loc { loc_end = fn }

funDepInputs :: Lens' FunDep [Name]
funDepInputs :: Lens' FunDep [Name]
funDepInputs = (FunDep -> [Name])
-> (FunDep -> [Name] -> FunDep) -> Lens' FunDep [Name]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens FunDep -> [Name]
g FunDep -> [Name] -> FunDep
s where
   g :: FunDep -> [Name]
g (FunDep [Name]
xs [Name]
_)    = [Name]
xs
   s :: FunDep -> [Name] -> FunDep
s (FunDep [Name]
_ [Name]
ys) [Name]
xs = [Name] -> [Name] -> FunDep
FunDep [Name]
xs [Name]
ys

funDepOutputs :: Lens' FunDep [Name]
funDepOutputs :: Lens' FunDep [Name]
funDepOutputs = (FunDep -> [Name])
-> (FunDep -> [Name] -> FunDep) -> Lens' FunDep [Name]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens FunDep -> [Name]
g FunDep -> [Name] -> FunDep
s where
   g :: FunDep -> [Name]
g (FunDep [Name]
_ [Name]
xs) = [Name]
xs
   s :: FunDep -> [Name] -> FunDep
s (FunDep [Name]
ys [Name]
_) = [Name] -> [Name] -> FunDep
FunDep [Name]
ys

fieldExpName :: Lens' FieldExp Name
fieldExpName :: Lens' FieldExp Name
fieldExpName = (Name -> f Name) -> FieldExp -> f FieldExp
forall s t a b. Field1 s t a b => Lens s t a b
Lens' FieldExp Name
_1

fieldExpExpression :: Lens' FieldExp Exp
fieldExpExpression :: Lens' FieldExp Exp
fieldExpExpression = (Exp -> f Exp) -> FieldExp -> f FieldExp
forall s t a b. Field2 s t a b => Lens s t a b
Lens' FieldExp Exp
_2

fieldPatName :: Lens' FieldPat Name
fieldPatName :: Lens' FieldPat Name
fieldPatName = (Name -> f Name) -> FieldPat -> f FieldPat
forall s t a b. Field1 s t a b => Lens s t a b
Lens' FieldPat Name
_1

fieldPatPattern :: Lens' FieldPat Pat
fieldPatPattern :: Lens' FieldPat Pat
fieldPatPattern = (Pat -> f Pat) -> FieldPat -> f FieldPat
forall s t a b. Field2 s t a b => Lens s t a b
Lens' FieldPat Pat
_2

matchPattern :: Lens' Match Pat
matchPattern :: Lens' Match Pat
matchPattern = (Match -> Pat) -> (Match -> Pat -> Match) -> Lens' Match Pat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Match -> Pat
g Match -> Pat -> Match
s where
   g :: Match -> Pat
g (Match Pat
p Body
_ [Dec]
_)   = Pat
p
   s :: Match -> Pat -> Match
s (Match Pat
_ Body
x [Dec]
y) Pat
p = Pat -> Body -> [Dec] -> Match
Match Pat
p Body
x [Dec]
y

matchBody :: Lens' Match Body
matchBody :: Lens' Match Body
matchBody = (Match -> Body) -> (Match -> Body -> Match) -> Lens' Match Body
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Match -> Body
g Match -> Body -> Match
s where
   g :: Match -> Body
g (Match Pat
_ Body
b [Dec]
_)   = Body
b
   s :: Match -> Body -> Match
s (Match Pat
x Body
_ [Dec]
y) Body
b = Pat -> Body -> [Dec] -> Match
Match Pat
x Body
b [Dec]
y

matchDeclarations :: Lens' Match [Dec]
matchDeclarations :: Lens' Match [Dec]
matchDeclarations = (Match -> [Dec]) -> (Match -> [Dec] -> Match) -> Lens' Match [Dec]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Match -> [Dec]
g Match -> [Dec] -> Match
s where
   g :: Match -> [Dec]
g (Match Pat
_ Body
_ [Dec]
ds) = [Dec]
ds
   s :: Match -> [Dec] -> Match
s (Match Pat
x Body
y [Dec]
_ ) = Pat -> Body -> [Dec] -> Match
Match Pat
x Body
y

fixityPrecedence :: Lens' Fixity Int
fixityPrecedence :: Lens' Fixity Int
fixityPrecedence = (Fixity -> Int) -> (Fixity -> Int -> Fixity) -> Lens' Fixity Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Fixity -> Int
g Fixity -> Int -> Fixity
s where
   g :: Fixity -> Int
g (Fixity Int
i FixityDirection
_)   = Int
i
   s :: Fixity -> Int -> Fixity
s (Fixity Int
_ FixityDirection
x) Int
i = Int -> FixityDirection -> Fixity
Fixity Int
i FixityDirection
x

fixityDirection :: Lens' Fixity FixityDirection
fixityDirection :: Lens' Fixity FixityDirection
fixityDirection = (Fixity -> FixityDirection)
-> (Fixity -> FixityDirection -> Fixity)
-> Lens' Fixity FixityDirection
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Fixity -> FixityDirection
g Fixity -> FixityDirection -> Fixity
s where
   g :: Fixity -> FixityDirection
g (Fixity Int
_ FixityDirection
d) = FixityDirection
d
   s :: Fixity -> FixityDirection -> Fixity
s (Fixity Int
i FixityDirection
_) = Int -> FixityDirection -> Fixity
Fixity Int
i

clausePattern :: Lens' Clause [Pat]
clausePattern :: Lens' Clause [Pat]
clausePattern = (Clause -> [Pat])
-> (Clause -> [Pat] -> Clause) -> Lens' Clause [Pat]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Clause -> [Pat]
g Clause -> [Pat] -> Clause
s where
   g :: Clause -> [Pat]
g (Clause [Pat]
ps Body
_ [Dec]
_)    = [Pat]
ps
   s :: Clause -> [Pat] -> Clause
s (Clause [Pat]
_  Body
x [Dec]
y) [Pat]
ps = [Pat] -> Body -> [Dec] -> Clause
Clause [Pat]
ps Body
x [Dec]
y

clauseBody :: Lens' Clause Body
clauseBody :: Lens' Clause Body
clauseBody = (Clause -> Body) -> (Clause -> Body -> Clause) -> Lens' Clause Body
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Clause -> Body
g Clause -> Body -> Clause
s where
   g :: Clause -> Body
g (Clause [Pat]
_ Body
b [Dec]
_)   = Body
b
   s :: Clause -> Body -> Clause
s (Clause [Pat]
x Body
_ [Dec]
y) Body
b = [Pat] -> Body -> [Dec] -> Clause
Clause [Pat]
x Body
b [Dec]
y

clauseDecs :: Lens' Clause [Dec]
clauseDecs :: Lens' Clause [Dec]
clauseDecs = (Clause -> [Dec])
-> (Clause -> [Dec] -> Clause) -> Lens' Clause [Dec]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Clause -> [Dec]
g Clause -> [Dec] -> Clause
s where
   g :: Clause -> [Dec]
g (Clause [Pat]
_ Body
_ [Dec]
ds) = [Dec]
ds
   s :: Clause -> [Dec] -> Clause
s (Clause [Pat]
x Body
y [Dec]
_ ) = [Pat] -> Body -> [Dec] -> Clause
Clause [Pat]
x Body
y

injectivityAnnOutput :: Lens' InjectivityAnn Name
injectivityAnnOutput :: Lens' InjectivityAnn Name
injectivityAnnOutput = (InjectivityAnn -> Name)
-> (InjectivityAnn -> Name -> InjectivityAnn)
-> Lens' InjectivityAnn Name
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens InjectivityAnn -> Name
g InjectivityAnn -> Name -> InjectivityAnn
s where
   g :: InjectivityAnn -> Name
g (InjectivityAnn Name
o [Name]
_)   = Name
o
   s :: InjectivityAnn -> Name -> InjectivityAnn
s (InjectivityAnn Name
_ [Name]
i) Name
o = Name -> [Name] -> InjectivityAnn
InjectivityAnn Name
o [Name]
i

injectivityAnnInputs :: Lens' InjectivityAnn [Name]
injectivityAnnInputs :: Lens' InjectivityAnn [Name]
injectivityAnnInputs = (InjectivityAnn -> [Name])
-> (InjectivityAnn -> [Name] -> InjectivityAnn)
-> Lens' InjectivityAnn [Name]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens InjectivityAnn -> [Name]
g InjectivityAnn -> [Name] -> InjectivityAnn
s where
   g :: InjectivityAnn -> [Name]
g (InjectivityAnn Name
_ [Name]
i) = [Name]
i
   s :: InjectivityAnn -> [Name] -> InjectivityAnn
s (InjectivityAnn Name
o [Name]
_) = Name -> [Name] -> InjectivityAnn
InjectivityAnn Name
o

typeFamilyHeadName :: Lens' TypeFamilyHead Name
typeFamilyHeadName :: Lens' TypeFamilyHead Name
typeFamilyHeadName = (TypeFamilyHead -> Name)
-> (TypeFamilyHead -> Name -> TypeFamilyHead)
-> Lens' TypeFamilyHead Name
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TypeFamilyHead -> Name
g TypeFamilyHead -> Name -> TypeFamilyHead
s where
  g :: TypeFamilyHead -> Name
g (TypeFamilyHead Name
n [TyVarBndr BndrVis]
_    FamilyResultSig
_  Maybe InjectivityAnn
_ )   = Name
n
  s :: TypeFamilyHead -> Name -> TypeFamilyHead
s (TypeFamilyHead Name
_ [TyVarBndr BndrVis]
tvbs FamilyResultSig
rs Maybe InjectivityAnn
ia) Name
n = Name
-> [TyVarBndr BndrVis]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n [TyVarBndr BndrVis]
tvbs FamilyResultSig
rs Maybe InjectivityAnn
ia

typeFamilyHeadTyVarBndrs :: Lens' TypeFamilyHead [TyVarBndrVis]
typeFamilyHeadTyVarBndrs :: Lens' TypeFamilyHead [TyVarBndr BndrVis]
typeFamilyHeadTyVarBndrs = (TypeFamilyHead -> [TyVarBndr BndrVis])
-> (TypeFamilyHead -> [TyVarBndr BndrVis] -> TypeFamilyHead)
-> Lens' TypeFamilyHead [TyVarBndr BndrVis]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TypeFamilyHead -> [TyVarBndr BndrVis]
g TypeFamilyHead -> [TyVarBndr BndrVis] -> TypeFamilyHead
s where
  g :: TypeFamilyHead -> [TyVarBndr BndrVis]
g (TypeFamilyHead Name
_ [TyVarBndr BndrVis]
tvbs FamilyResultSig
_  Maybe InjectivityAnn
_ )      = [TyVarBndr BndrVis]
tvbs
  s :: TypeFamilyHead -> [TyVarBndr BndrVis] -> TypeFamilyHead
s (TypeFamilyHead Name
n [TyVarBndr BndrVis]
_    FamilyResultSig
rs Maybe InjectivityAnn
ia) [TyVarBndr BndrVis]
tvbs = Name
-> [TyVarBndr BndrVis]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n [TyVarBndr BndrVis]
tvbs FamilyResultSig
rs Maybe InjectivityAnn
ia

typeFamilyHeadResultSig :: Lens' TypeFamilyHead FamilyResultSig
typeFamilyHeadResultSig :: Lens' TypeFamilyHead FamilyResultSig
typeFamilyHeadResultSig = (TypeFamilyHead -> FamilyResultSig)
-> (TypeFamilyHead -> FamilyResultSig -> TypeFamilyHead)
-> Lens' TypeFamilyHead FamilyResultSig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TypeFamilyHead -> FamilyResultSig
g TypeFamilyHead -> FamilyResultSig -> TypeFamilyHead
s where
  g :: TypeFamilyHead -> FamilyResultSig
g (TypeFamilyHead Name
_ [TyVarBndr BndrVis]
_    FamilyResultSig
rs Maybe InjectivityAnn
_ )    = FamilyResultSig
rs
  s :: TypeFamilyHead -> FamilyResultSig -> TypeFamilyHead
s (TypeFamilyHead Name
n [TyVarBndr BndrVis]
tvbs FamilyResultSig
_  Maybe InjectivityAnn
ia) FamilyResultSig
rs = Name
-> [TyVarBndr BndrVis]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n [TyVarBndr BndrVis]
tvbs FamilyResultSig
rs Maybe InjectivityAnn
ia

typeFamilyHeadInjectivityAnn :: Lens' TypeFamilyHead (Maybe InjectivityAnn)
typeFamilyHeadInjectivityAnn :: Lens' TypeFamilyHead (Maybe InjectivityAnn)
typeFamilyHeadInjectivityAnn = (TypeFamilyHead -> Maybe InjectivityAnn)
-> (TypeFamilyHead -> Maybe InjectivityAnn -> TypeFamilyHead)
-> Lens' TypeFamilyHead (Maybe InjectivityAnn)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TypeFamilyHead -> Maybe InjectivityAnn
g TypeFamilyHead -> Maybe InjectivityAnn -> TypeFamilyHead
s where
  g :: TypeFamilyHead -> Maybe InjectivityAnn
g (TypeFamilyHead Name
_ [TyVarBndr BndrVis]
_    FamilyResultSig
_  Maybe InjectivityAnn
ia) = Maybe InjectivityAnn
ia
  s :: TypeFamilyHead -> Maybe InjectivityAnn -> TypeFamilyHead
s (TypeFamilyHead Name
n [TyVarBndr BndrVis]
tvbs FamilyResultSig
rs Maybe InjectivityAnn
_ ) = Name
-> [TyVarBndr BndrVis]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n [TyVarBndr BndrVis]
tvbs FamilyResultSig
rs

bangSourceUnpackedness :: Lens' Bang SourceUnpackedness
bangSourceUnpackedness :: Lens' Bang SourceUnpackedness
bangSourceUnpackedness = (Bang -> SourceUnpackedness)
-> (Bang -> SourceUnpackedness -> Bang)
-> Lens' Bang SourceUnpackedness
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Bang -> SourceUnpackedness
g Bang -> SourceUnpackedness -> Bang
s where
  g :: Bang -> SourceUnpackedness
g (Bang SourceUnpackedness
su SourceStrictness
_ )    = SourceUnpackedness
su
  s :: Bang -> SourceUnpackedness -> Bang
s (Bang SourceUnpackedness
_  SourceStrictness
ss) SourceUnpackedness
su = SourceUnpackedness -> SourceStrictness -> Bang
Bang SourceUnpackedness
su SourceStrictness
ss

bangSourceStrictness :: Lens' Bang SourceStrictness
bangSourceStrictness :: Lens' Bang SourceStrictness
bangSourceStrictness = (Bang -> SourceStrictness)
-> (Bang -> SourceStrictness -> Bang)
-> Lens' Bang SourceStrictness
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Bang -> SourceStrictness
g Bang -> SourceStrictness -> Bang
s where
  g :: Bang -> SourceStrictness
g (Bang SourceUnpackedness
_  SourceStrictness
su) = SourceStrictness
su
  s :: Bang -> SourceStrictness -> Bang
s (Bang SourceUnpackedness
ss SourceStrictness
_ ) = SourceUnpackedness -> SourceStrictness -> Bang
Bang SourceUnpackedness
ss

#if MIN_VERSION_template_haskell(2,12,0)
derivClauseStrategy :: Lens' DerivClause (Maybe DerivStrategy)
derivClauseStrategy :: Lens' DerivClause (Maybe DerivStrategy)
derivClauseStrategy = (DerivClause -> Maybe DerivStrategy)
-> (DerivClause -> Maybe DerivStrategy -> DerivClause)
-> Lens' DerivClause (Maybe DerivStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens DerivClause -> Maybe DerivStrategy
g DerivClause -> Maybe DerivStrategy -> DerivClause
s where
  g :: DerivClause -> Maybe DerivStrategy
g (DerivClause Maybe DerivStrategy
mds Cxt
_)     = Maybe DerivStrategy
mds
  s :: DerivClause -> Maybe DerivStrategy -> DerivClause
s (DerivClause Maybe DerivStrategy
_   Cxt
c) Maybe DerivStrategy
mds = Maybe DerivStrategy -> Cxt -> DerivClause
DerivClause Maybe DerivStrategy
mds Cxt
c

derivClauseCxt :: Lens' DerivClause Cxt
derivClauseCxt :: Lens' DerivClause Cxt
derivClauseCxt = (DerivClause -> Cxt)
-> (DerivClause -> Cxt -> DerivClause) -> Lens' DerivClause Cxt
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens DerivClause -> Cxt
g DerivClause -> Cxt -> DerivClause
s where
  g :: DerivClause -> Cxt
g (DerivClause Maybe DerivStrategy
_   Cxt
c) = Cxt
c
  s :: DerivClause -> Cxt -> DerivClause
s (DerivClause Maybe DerivStrategy
mds Cxt
_) = Maybe DerivStrategy -> Cxt -> DerivClause
DerivClause Maybe DerivStrategy
mds
#endif

_ClassI :: Prism' Info (Dec, [InstanceDec])
_ClassI :: Prism' Info (Dec, [Dec])
_ClassI
  = ((Dec, [Dec]) -> Info)
-> (Info -> Maybe (Dec, [Dec])) -> Prism' Info (Dec, [Dec])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Dec, [Dec]) -> Info
reviewer Info -> Maybe (Dec, [Dec])
remitter
  where
      reviewer :: (Dec, [Dec]) -> Info
reviewer (Dec
x, [Dec]
y) = Dec -> [Dec] -> Info
ClassI Dec
x [Dec]
y
      remitter :: Info -> Maybe (Dec, [Dec])
remitter (ClassI Dec
x [Dec]
y) = (Dec, [Dec]) -> Maybe (Dec, [Dec])
forall a. a -> Maybe a
Just (Dec
x, [Dec]
y)
      remitter Info
_ = Maybe (Dec, [Dec])
forall a. Maybe a
Nothing

_ClassOpI :: Prism' Info (Name, Type, ParentName)
_ClassOpI :: Prism' Info (Name, Type, Name)
_ClassOpI
  = ((Name, Type, Name) -> Info)
-> (Info -> Maybe (Name, Type, Name))
-> Prism' Info (Name, Type, Name)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type, Name) -> Info
reviewer Info -> Maybe (Name, Type, Name)
remitter
  where
      reviewer :: (Name, Type, Name) -> Info
reviewer (Name
x, Type
y, Name
z) = Name -> Type -> Name -> Info
ClassOpI Name
x Type
y Name
z
      remitter :: Info -> Maybe (Name, Type, Name)
remitter (ClassOpI Name
x Type
y Name
z) = (Name, Type, Name) -> Maybe (Name, Type, Name)
forall a. a -> Maybe a
Just (Name
x, Type
y, Name
z)
      remitter Info
_ = Maybe (Name, Type, Name)
forall a. Maybe a
Nothing

_TyConI :: Prism' Info Dec
_TyConI :: Prism' Info Dec
_TyConI
  = (Dec -> Info) -> (Info -> Maybe Dec) -> Prism' Info Dec
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Dec -> Info
reviewer Info -> Maybe Dec
remitter
  where
      reviewer :: Dec -> Info
reviewer = Dec -> Info
TyConI
      remitter :: Info -> Maybe Dec
remitter (TyConI Dec
x) = Dec -> Maybe Dec
forall a. a -> Maybe a
Just Dec
x
      remitter Info
_ = Maybe Dec
forall a. Maybe a
Nothing

_FamilyI :: Prism' Info (Dec, [InstanceDec])
_FamilyI :: Prism' Info (Dec, [Dec])
_FamilyI
  = ((Dec, [Dec]) -> Info)
-> (Info -> Maybe (Dec, [Dec])) -> Prism' Info (Dec, [Dec])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Dec, [Dec]) -> Info
reviewer Info -> Maybe (Dec, [Dec])
remitter
  where
      reviewer :: (Dec, [Dec]) -> Info
reviewer (Dec
x, [Dec]
y) = Dec -> [Dec] -> Info
FamilyI Dec
x [Dec]
y
      remitter :: Info -> Maybe (Dec, [Dec])
remitter (FamilyI Dec
x [Dec]
y) = (Dec, [Dec]) -> Maybe (Dec, [Dec])
forall a. a -> Maybe a
Just (Dec
x, [Dec]
y)
      remitter Info
_ = Maybe (Dec, [Dec])
forall a. Maybe a
Nothing

_PrimTyConI :: Prism' Info (Name, Arity, Unlifted)
_PrimTyConI :: Prism' Info (Name, Int, Bool)
_PrimTyConI
  = ((Name, Int, Bool) -> Info)
-> (Info -> Maybe (Name, Int, Bool))
-> Prism' Info (Name, Int, Bool)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Int, Bool) -> Info
reviewer Info -> Maybe (Name, Int, Bool)
remitter
  where
      reviewer :: (Name, Int, Bool) -> Info
reviewer (Name
x, Int
y, Bool
z) = Name -> Int -> Bool -> Info
PrimTyConI Name
x Int
y Bool
z
      remitter :: Info -> Maybe (Name, Int, Bool)
remitter (PrimTyConI Name
x Int
y Bool
z) = (Name, Int, Bool) -> Maybe (Name, Int, Bool)
forall a. a -> Maybe a
Just (Name
x, Int
y, Bool
z)
      remitter Info
_ = Maybe (Name, Int, Bool)
forall a. Maybe a
Nothing

_DataConI :: Prism' Info (Name, Type, ParentName)
_DataConI :: Prism' Info (Name, Type, Name)
_DataConI
  = ((Name, Type, Name) -> Info)
-> (Info -> Maybe (Name, Type, Name))
-> Prism' Info (Name, Type, Name)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type, Name) -> Info
reviewer Info -> Maybe (Name, Type, Name)
remitter
  where
      reviewer :: (Name, Type, Name) -> Info
reviewer (Name
x, Type
y, Name
z) = Name -> Type -> Name -> Info
DataConI Name
x Type
y Name
z
      remitter :: Info -> Maybe (Name, Type, Name)
remitter (DataConI Name
x Type
y Name
z) = (Name, Type, Name) -> Maybe (Name, Type, Name)
forall a. a -> Maybe a
Just (Name
x, Type
y, Name
z)
      remitter Info
_ = Maybe (Name, Type, Name)
forall a. Maybe a
Nothing

_VarI :: Prism' Info (Name, Type, Maybe Dec)
_VarI :: Prism' Info (Name, Type, Maybe Dec)
_VarI
  = ((Name, Type, Maybe Dec) -> Info)
-> (Info -> Maybe (Name, Type, Maybe Dec))
-> Prism' Info (Name, Type, Maybe Dec)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type, Maybe Dec) -> Info
reviewer Info -> Maybe (Name, Type, Maybe Dec)
remitter
  where
      reviewer :: (Name, Type, Maybe Dec) -> Info
reviewer (Name
x, Type
y, Maybe Dec
z) = Name -> Type -> Maybe Dec -> Info
VarI Name
x Type
y Maybe Dec
z
      remitter :: Info -> Maybe (Name, Type, Maybe Dec)
remitter (VarI Name
x Type
y Maybe Dec
z) = (Name, Type, Maybe Dec) -> Maybe (Name, Type, Maybe Dec)
forall a. a -> Maybe a
Just (Name
x, Type
y, Maybe Dec
z)
      remitter Info
_ = Maybe (Name, Type, Maybe Dec)
forall a. Maybe a
Nothing

_TyVarI :: Prism' Info (Name, Type)
_TyVarI :: Prism' Info (Name, Type)
_TyVarI
  = ((Name, Type) -> Info)
-> (Info -> Maybe (Name, Type)) -> Prism' Info (Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type) -> Info
reviewer Info -> Maybe (Name, Type)
remitter
  where
      reviewer :: (Name, Type) -> Info
reviewer (Name
x, Type
y) = Name -> Type -> Info
TyVarI Name
x Type
y
      remitter :: Info -> Maybe (Name, Type)
remitter (TyVarI Name
x Type
y) = (Name, Type) -> Maybe (Name, Type)
forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Info
_ = Maybe (Name, Type)
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_PatSynI :: Prism' Info (Name, PatSynType)
_PatSynI :: Prism' Info (Name, Type)
_PatSynI
  = ((Name, Type) -> Info)
-> (Info -> Maybe (Name, Type)) -> Prism' Info (Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type) -> Info
reviewer Info -> Maybe (Name, Type)
remitter
  where
      reviewer :: (Name, Type) -> Info
reviewer (Name
x, Type
y) = Name -> Type -> Info
PatSynI Name
x Type
y
      remitter :: Info -> Maybe (Name, Type)
remitter (PatSynI Name
x Type
y) = (Name, Type) -> Maybe (Name, Type)
forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Info
_ = Maybe (Name, Type)
forall a. Maybe a
Nothing
#endif

_FunD :: Prism' Dec (Name, [Clause])
_FunD :: Prism' Dec (Name, [Clause])
_FunD
  = ((Name, [Clause]) -> Dec)
-> (Dec -> Maybe (Name, [Clause])) -> Prism' Dec (Name, [Clause])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [Clause]) -> Dec
reviewer Dec -> Maybe (Name, [Clause])
remitter
  where
      reviewer :: (Name, [Clause]) -> Dec
reviewer (Name
x, [Clause]
y) = Name -> [Clause] -> Dec
FunD Name
x [Clause]
y
      remitter :: Dec -> Maybe (Name, [Clause])
remitter (FunD Name
x [Clause]
y) = (Name, [Clause]) -> Maybe (Name, [Clause])
forall a. a -> Maybe a
Just (Name
x,[Clause]
y)
      remitter Dec
_ = Maybe (Name, [Clause])
forall a. Maybe a
Nothing

_ValD :: Prism' Dec (Pat, Body, [Dec])
_ValD :: Prism' Dec (Pat, Body, [Dec])
_ValD
  = ((Pat, Body, [Dec]) -> Dec)
-> (Dec -> Maybe (Pat, Body, [Dec]))
-> Prism' Dec (Pat, Body, [Dec])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Pat, Body, [Dec]) -> Dec
reviewer Dec -> Maybe (Pat, Body, [Dec])
remitter
  where
      reviewer :: (Pat, Body, [Dec]) -> Dec
reviewer (Pat
x, Body
y, [Dec]
z) = Pat -> Body -> [Dec] -> Dec
ValD Pat
x Body
y [Dec]
z
      remitter :: Dec -> Maybe (Pat, Body, [Dec])
remitter (ValD Pat
x Body
y [Dec]
z) = (Pat, Body, [Dec]) -> Maybe (Pat, Body, [Dec])
forall a. a -> Maybe a
Just (Pat
x, Body
y, [Dec]
z)
      remitter Dec
_ = Maybe (Pat, Body, [Dec])
forall a. Maybe a
Nothing

_TySynD :: Prism' Dec (Name, [TyVarBndrVis], Type)
_TySynD :: Prism' Dec (Name, [TyVarBndr BndrVis], Type)
_TySynD
  = ((Name, [TyVarBndr BndrVis], Type) -> Dec)
-> (Dec -> Maybe (Name, [TyVarBndr BndrVis], Type))
-> Prism' Dec (Name, [TyVarBndr BndrVis], Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [TyVarBndr BndrVis], Type) -> Dec
reviewer Dec -> Maybe (Name, [TyVarBndr BndrVis], Type)
remitter
  where
      reviewer :: (Name, [TyVarBndr BndrVis], Type) -> Dec
reviewer (Name
x, [TyVarBndr BndrVis]
y, Type
z) = Name -> [TyVarBndr BndrVis] -> Type -> Dec
TySynD Name
x [TyVarBndr BndrVis]
y Type
z
      remitter :: Dec -> Maybe (Name, [TyVarBndr BndrVis], Type)
remitter (TySynD Name
x [TyVarBndr BndrVis]
y Type
z) = (Name, [TyVarBndr BndrVis], Type)
-> Maybe (Name, [TyVarBndr BndrVis], Type)
forall a. a -> Maybe a
Just (Name
x, [TyVarBndr BndrVis]
y, Type
z)
      remitter Dec
_ = Maybe (Name, [TyVarBndr BndrVis], Type)
forall a. Maybe a
Nothing

_ClassD :: Prism' Dec (Cxt, Name, [TyVarBndrVis], [FunDep], [Dec])
_ClassD :: Prism' Dec (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec])
_ClassD
  = ((Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec]) -> Dec)
-> (Dec -> Maybe (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec]))
-> Prism' Dec (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec]) -> Dec
reviewer Dec -> Maybe (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec])
remitter
  where
      reviewer :: (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec]) -> Dec
reviewer (Cxt
x, Name
y, [TyVarBndr BndrVis]
z, [FunDep]
w, [Dec]
u) = Cxt -> Name -> [TyVarBndr BndrVis] -> [FunDep] -> [Dec] -> Dec
ClassD Cxt
x Name
y [TyVarBndr BndrVis]
z [FunDep]
w [Dec]
u
      remitter :: Dec -> Maybe (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec])
remitter (ClassD Cxt
x Name
y [TyVarBndr BndrVis]
z [FunDep]
w [Dec]
u) = (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec])
-> Maybe (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec])
forall a. a -> Maybe a
Just (Cxt
x, Name
y, [TyVarBndr BndrVis]
z, [FunDep]
w, [Dec]
u)
      remitter Dec
_ = Maybe (Cxt, Name, [TyVarBndr BndrVis], [FunDep], [Dec])
forall a. Maybe a
Nothing

_InstanceD :: Prism' Dec (Maybe Overlap, Cxt, Type, [Dec])
_InstanceD :: Prism' Dec (Maybe Overlap, Cxt, Type, [Dec])
_InstanceD
  = ((Maybe Overlap, Cxt, Type, [Dec]) -> Dec)
-> (Dec -> Maybe (Maybe Overlap, Cxt, Type, [Dec]))
-> Prism' Dec (Maybe Overlap, Cxt, Type, [Dec])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Maybe Overlap, Cxt, Type, [Dec]) -> Dec
reviewer Dec -> Maybe (Maybe Overlap, Cxt, Type, [Dec])
remitter
  where
      reviewer :: (Maybe Overlap, Cxt, Type, [Dec]) -> Dec
reviewer (Maybe Overlap
x, Cxt
y, Type
z, [Dec]
w) = Maybe Overlap -> Cxt -> Type -> [Dec] -> Dec
InstanceD Maybe Overlap
x Cxt
y Type
z [Dec]
w
      remitter :: Dec -> Maybe (Maybe Overlap, Cxt, Type, [Dec])
remitter (InstanceD Maybe Overlap
x Cxt
y Type
z [Dec]
w) = (Maybe Overlap, Cxt, Type, [Dec])
-> Maybe (Maybe Overlap, Cxt, Type, [Dec])
forall a. a -> Maybe a
Just (Maybe Overlap
x, Cxt
y, Type
z, [Dec]
w)
      remitter Dec
_ = Maybe (Maybe Overlap, Cxt, Type, [Dec])
forall a. Maybe a
Nothing

_Overlappable  :: Prism' Overlap  ()
_Overlappable :: Prism' Overlap ()
_Overlappable  = (() -> Overlap) -> (Overlap -> Maybe ()) -> Prism' Overlap ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Overlap
reviewer Overlap -> Maybe ()
remitter
  where
      reviewer :: () -> Overlap
reviewer () = Overlap
Overlappable
      remitter :: Overlap -> Maybe ()
remitter Overlap
Overlappable = () -> Maybe ()
forall a. a -> Maybe a
Just  ()
      remitter Overlap
_ = Maybe ()
forall a. Maybe a
Nothing

_Overlapping :: Prism' Overlap ()
_Overlapping :: Prism' Overlap ()
_Overlapping = (() -> Overlap) -> (Overlap -> Maybe ()) -> Prism' Overlap ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Overlap
reviewer Overlap -> Maybe ()
remitter
  where
      reviewer :: () -> Overlap
reviewer () = Overlap
Overlapping
      remitter :: Overlap -> Maybe ()
remitter Overlap
Overlapping = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Overlap
_ = Maybe ()
forall a. Maybe a
Nothing

_Overlaps ::  Prism' Overlap  ()
_Overlaps :: Prism' Overlap ()
_Overlaps =  (() -> Overlap) -> (Overlap -> Maybe ()) -> Prism' Overlap ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Overlap
reviewer Overlap -> Maybe ()
remitter
  where
      reviewer :: () -> Overlap
reviewer () =  Overlap
Overlaps
      remitter :: Overlap -> Maybe ()
remitter Overlap
Overlaps = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Overlap
_ = Maybe ()
forall a. Maybe a
Nothing

_Incoherent  :: Prism' Overlap ()
_Incoherent :: Prism' Overlap ()
_Incoherent  = (() -> Overlap) -> (Overlap -> Maybe ()) -> Prism' Overlap ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Overlap
reviewer Overlap -> Maybe ()
remitter
  where
      reviewer :: () -> Overlap
reviewer () = Overlap
Incoherent
      remitter :: Overlap -> Maybe ()
remitter Overlap
Incoherent = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Overlap
_ = Maybe ()
forall a. Maybe a
Nothing

_SigD :: Prism' Dec (Name, Type)
_SigD :: Prism' Dec (Name, Type)
_SigD
  = ((Name, Type) -> Dec)
-> (Dec -> Maybe (Name, Type)) -> Prism' Dec (Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type) -> Dec
reviewer Dec -> Maybe (Name, Type)
remitter
  where
      reviewer :: (Name, Type) -> Dec
reviewer (Name
x, Type
y) = Name -> Type -> Dec
SigD Name
x Type
y
      remitter :: Dec -> Maybe (Name, Type)
remitter (SigD Name
x Type
y) = (Name, Type) -> Maybe (Name, Type)
forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Dec
_ = Maybe (Name, Type)
forall a. Maybe a
Nothing

_ForeignD :: Prism' Dec Foreign
_ForeignD :: Prism' Dec Foreign
_ForeignD
  = (Foreign -> Dec) -> (Dec -> Maybe Foreign) -> Prism' Dec Foreign
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Foreign -> Dec
reviewer Dec -> Maybe Foreign
remitter
  where
      reviewer :: Foreign -> Dec
reviewer = Foreign -> Dec
ForeignD
      remitter :: Dec -> Maybe Foreign
remitter (ForeignD Foreign
x) = Foreign -> Maybe Foreign
forall a. a -> Maybe a
Just Foreign
x
      remitter Dec
_ = Maybe Foreign
forall a. Maybe a
Nothing

_InfixD :: Prism' Dec (Fixity, Name)
_InfixD :: Prism' Dec (Fixity, Name)
_InfixD
  = ((Fixity, Name) -> Dec)
-> (Dec -> Maybe (Fixity, Name)) -> Prism' Dec (Fixity, Name)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Fixity, Name) -> Dec
reviewer Dec -> Maybe (Fixity, Name)
remitter
  where
      reviewer :: (Fixity, Name) -> Dec
reviewer (Fixity
x, Name
y) = Fixity -> Name -> Dec
InfixD Fixity
x Name
y
      remitter :: Dec -> Maybe (Fixity, Name)
remitter (InfixD Fixity
x Name
y) = (Fixity, Name) -> Maybe (Fixity, Name)
forall a. a -> Maybe a
Just (Fixity
x, Name
y)
      remitter Dec
_ = Maybe (Fixity, Name)
forall a. Maybe a
Nothing

_PragmaD :: Prism' Dec Pragma
_PragmaD :: Prism' Dec Pragma
_PragmaD
  = (Pragma -> Dec) -> (Dec -> Maybe Pragma) -> Prism' Dec Pragma
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Pragma -> Dec
reviewer Dec -> Maybe Pragma
remitter
  where
      reviewer :: Pragma -> Dec
reviewer = Pragma -> Dec
PragmaD
      remitter :: Dec -> Maybe Pragma
remitter (PragmaD Pragma
x) = Pragma -> Maybe Pragma
forall a. a -> Maybe a
Just Pragma
x
      remitter Dec
_ = Maybe Pragma
forall a. Maybe a
Nothing

-- |
-- @
-- _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
-- @
#if MIN_VERSION_template_haskell(2,15,0)
_TySynInstD :: Prism' Dec TySynEqn
_TySynInstD :: Prism' Dec TySynEqn
_TySynInstD
  = (TySynEqn -> Dec) -> (Dec -> Maybe TySynEqn) -> Prism' Dec TySynEqn
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' TySynEqn -> Dec
reviewer Dec -> Maybe TySynEqn
remitter
  where
      reviewer :: TySynEqn -> Dec
reviewer = TySynEqn -> Dec
TySynInstD
      remitter :: Dec -> Maybe TySynEqn
remitter (TySynInstD TySynEqn
x) = TySynEqn -> Maybe TySynEqn
forall a. a -> Maybe a
Just TySynEqn
x
      remitter Dec
_ = Maybe TySynEqn
forall a. Maybe a
Nothing
#else
_TySynInstD :: Prism' Dec (Name, TySynEqn)
_TySynInstD
  = prism' reviewer remitter
  where
      reviewer (x, y) = TySynInstD x y
      remitter (TySynInstD x y) = Just (x, y)
      remitter _ = Nothing
#endif

_RoleAnnotD :: Prism' Dec (Name, [Role])
_RoleAnnotD :: Prism' Dec (Name, [Role])
_RoleAnnotD
  = ((Name, [Role]) -> Dec)
-> (Dec -> Maybe (Name, [Role])) -> Prism' Dec (Name, [Role])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [Role]) -> Dec
reviewer Dec -> Maybe (Name, [Role])
remitter
  where
      reviewer :: (Name, [Role]) -> Dec
reviewer (Name
x, [Role]
y) = Name -> [Role] -> Dec
RoleAnnotD Name
x [Role]
y
      remitter :: Dec -> Maybe (Name, [Role])
remitter (RoleAnnotD Name
x [Role]
y) = (Name, [Role]) -> Maybe (Name, [Role])
forall a. a -> Maybe a
Just (Name
x, [Role]
y)
      remitter Dec
_ = Maybe (Name, [Role])
forall a. Maybe a
Nothing

-- |
-- @
-- _StandaloneDerivD :: 'Prism'' 'Dec' ('Maybe' 'DerivStrategy', 'Cxt', 'Type') -- template-haskell-2.12+
-- _StandaloneDerivD :: 'Prism'' 'Dec'                      ('Cxt', 'Type') -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,12,0)
_StandaloneDerivD :: Prism' Dec (Maybe DerivStrategy, Cxt, Type)
_StandaloneDerivD :: Prism' Dec (Maybe DerivStrategy, Cxt, Type)
_StandaloneDerivD
  = ((Maybe DerivStrategy, Cxt, Type) -> Dec)
-> (Dec -> Maybe (Maybe DerivStrategy, Cxt, Type))
-> Prism' Dec (Maybe DerivStrategy, Cxt, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Maybe DerivStrategy, Cxt, Type) -> Dec
reviewer Dec -> Maybe (Maybe DerivStrategy, Cxt, Type)
remitter
  where
      reviewer :: (Maybe DerivStrategy, Cxt, Type) -> Dec
reviewer (Maybe DerivStrategy
x, Cxt
y, Type
z) = Maybe DerivStrategy -> Cxt -> Type -> Dec
StandaloneDerivD Maybe DerivStrategy
x Cxt
y Type
z
      remitter :: Dec -> Maybe (Maybe DerivStrategy, Cxt, Type)
remitter (StandaloneDerivD Maybe DerivStrategy
x Cxt
y Type
z) = (Maybe DerivStrategy, Cxt, Type)
-> Maybe (Maybe DerivStrategy, Cxt, Type)
forall a. a -> Maybe a
Just (Maybe DerivStrategy
x, Cxt
y, Type
z)
      remitter Dec
_ = Maybe (Maybe DerivStrategy, Cxt, Type)
forall a. Maybe a
Nothing
#else
_StandaloneDerivD :: Prism' Dec (Cxt, Type)
_StandaloneDerivD
  = prism' reviewer remitter
  where
      reviewer (x, y) = StandaloneDerivD x y
      remitter (StandaloneDerivD x y) = Just (x, y)
      remitter _ = Nothing
#endif

_DefaultSigD :: Prism' Dec (Name, Type)
_DefaultSigD :: Prism' Dec (Name, Type)
_DefaultSigD
  = ((Name, Type) -> Dec)
-> (Dec -> Maybe (Name, Type)) -> Prism' Dec (Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type) -> Dec
reviewer Dec -> Maybe (Name, Type)
remitter
  where
      reviewer :: (Name, Type) -> Dec
reviewer (Name
x, Type
y) = Name -> Type -> Dec
DefaultSigD Name
x Type
y
      remitter :: Dec -> Maybe (Name, Type)
remitter (DefaultSigD Name
x Type
y) = (Name, Type) -> Maybe (Name, Type)
forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Dec
_ = Maybe (Name, Type)
forall a. Maybe a
Nothing

# if MIN_VERSION_template_haskell(2,12,0)
type DataPrism' tys cons = Prism' Dec (Cxt, Name, tys, Maybe Kind, cons, [DerivClause])
# else
type DataPrism' tys cons = Prism' Dec (Cxt, Name, tys, Maybe Kind, cons, Cxt)
# endif

-- |
-- @
-- _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')           -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,15,0)
_DataInstD :: Prism' Dec (Cxt, Maybe [TyVarBndrUnit], Type, Maybe Kind, [Con], [DerivClause])
_DataInstD :: Prism'
  Dec
  (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con], [DerivClause])
_DataInstD
  = ((Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con],
  [DerivClause])
 -> Dec)
-> (Dec
    -> Maybe
         (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con],
          [DerivClause]))
-> Prism'
     Dec
     (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con], [DerivClause])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con], [DerivClause])
-> Dec
reviewer Dec
-> Maybe
     (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con], [DerivClause])
remitter
  where
      reviewer :: (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con], [DerivClause])
-> Dec
reviewer (Cxt
x, Maybe [TyVarBndr ()]
y, Type
z, Maybe Type
w, [Con]
u, [DerivClause]
v) = Cxt
-> Maybe [TyVarBndr ()]
-> Type
-> Maybe Type
-> [Con]
-> [DerivClause]
-> Dec
DataInstD Cxt
x Maybe [TyVarBndr ()]
y Type
z Maybe Type
w [Con]
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con], [DerivClause])
remitter (DataInstD Cxt
x Maybe [TyVarBndr ()]
y Type
z Maybe Type
w [Con]
u [DerivClause]
v) = (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con], [DerivClause])
-> Maybe
     (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con], [DerivClause])
forall a. a -> Maybe a
Just (Cxt
x, Maybe [TyVarBndr ()]
y, Type
z, Maybe Type
w, [Con]
u, [DerivClause]
v)
      remitter Dec
_ = Maybe
  (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, [Con], [DerivClause])
forall a. Maybe a
Nothing
#else
_DataInstD :: DataPrism' [Type] [Con]
_DataInstD
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w, u, v) = DataInstD x y z w u v
      remitter (DataInstD x y z w u v) = Just (x, y, z, w, u, v)
      remitter _ = Nothing
#endif

-- |
-- @
-- _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')           -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,15,0)
_NewtypeInstD :: Prism' Dec (Cxt, Maybe [TyVarBndrUnit], Type, Maybe Kind, Con, [DerivClause])
_NewtypeInstD :: Prism'
  Dec
  (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
_NewtypeInstD
  = ((Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
 -> Dec)
-> (Dec
    -> Maybe
         (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause]))
-> Prism'
     Dec
     (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
-> Dec
reviewer Dec
-> Maybe
     (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
remitter
  where
      reviewer :: (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
-> Dec
reviewer (Cxt
x, Maybe [TyVarBndr ()]
y, Type
z, Maybe Type
w, Con
u, [DerivClause]
v) = Cxt
-> Maybe [TyVarBndr ()]
-> Type
-> Maybe Type
-> Con
-> [DerivClause]
-> Dec
NewtypeInstD Cxt
x Maybe [TyVarBndr ()]
y Type
z Maybe Type
w Con
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
remitter (NewtypeInstD Cxt
x Maybe [TyVarBndr ()]
y Type
z Maybe Type
w Con
u [DerivClause]
v) = (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
-> Maybe
     (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
forall a. a -> Maybe a
Just (Cxt
x, Maybe [TyVarBndr ()]
y, Type
z, Maybe Type
w, Con
u, [DerivClause]
v)
      remitter Dec
_ = Maybe
  (Cxt, Maybe [TyVarBndr ()], Type, Maybe Type, Con, [DerivClause])
forall a. Maybe a
Nothing
#else
_NewtypeInstD :: DataPrism' [Type] Con
_NewtypeInstD
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w, u, v) = NewtypeInstD x y z w u v
      remitter (NewtypeInstD x y z w u v) = Just (x, y, z, w, u, v)
      remitter _ = Nothing
#endif

_ClosedTypeFamilyD :: Prism' Dec (TypeFamilyHead, [TySynEqn])
_ClosedTypeFamilyD :: Prism' Dec (TypeFamilyHead, [TySynEqn])
_ClosedTypeFamilyD
  = ((TypeFamilyHead, [TySynEqn]) -> Dec)
-> (Dec -> Maybe (TypeFamilyHead, [TySynEqn]))
-> Prism' Dec (TypeFamilyHead, [TySynEqn])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (TypeFamilyHead, [TySynEqn]) -> Dec
reviewer Dec -> Maybe (TypeFamilyHead, [TySynEqn])
remitter
  where
      reviewer :: (TypeFamilyHead, [TySynEqn]) -> Dec
reviewer (TypeFamilyHead
x, [TySynEqn]
y) = TypeFamilyHead -> [TySynEqn] -> Dec
ClosedTypeFamilyD TypeFamilyHead
x [TySynEqn]
y
      remitter :: Dec -> Maybe (TypeFamilyHead, [TySynEqn])
remitter (ClosedTypeFamilyD TypeFamilyHead
x [TySynEqn]
y) = (TypeFamilyHead, [TySynEqn]) -> Maybe (TypeFamilyHead, [TySynEqn])
forall a. a -> Maybe a
Just (TypeFamilyHead
x, [TySynEqn]
y)
      remitter Dec
_ = Maybe (TypeFamilyHead, [TySynEqn])
forall a. Maybe a
Nothing

-- |
-- @
-- _DataD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['TyVarBndrUnit'], 'Maybe' 'Kind', ['Con'], ['DerivClause']) -- template-haskell-2.12+
-- _DataD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['Type'],          'Maybe' 'Kind', ['Con'], 'Cxt')           -- Earlier versions
-- @
_DataD :: DataPrism' [TyVarBndrVis] [Con]
_DataD :: DataPrism' [TyVarBndr BndrVis] [Con]
_DataD
  = ((Cxt, Name, [TyVarBndr BndrVis], Maybe Type, [Con], [DerivClause])
 -> Dec)
-> (Dec
    -> Maybe
         (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, [Con], [DerivClause]))
-> DataPrism' [TyVarBndr BndrVis] [Con]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, [Con], [DerivClause])
-> Dec
reviewer Dec
-> Maybe
     (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, [Con], [DerivClause])
remitter
  where
      reviewer :: (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, [Con], [DerivClause])
-> Dec
reviewer (Cxt
x, Name
y, [TyVarBndr BndrVis]
z, Maybe Type
w, [Con]
u, [DerivClause]
v) = Cxt
-> Name
-> [TyVarBndr BndrVis]
-> Maybe Type
-> [Con]
-> [DerivClause]
-> Dec
DataD Cxt
x Name
y [TyVarBndr BndrVis]
z Maybe Type
w [Con]
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, [Con], [DerivClause])
remitter (DataD Cxt
x Name
y [TyVarBndr BndrVis]
z Maybe Type
w [Con]
u [DerivClause]
v) = (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, [Con], [DerivClause])
-> Maybe
     (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, [Con], [DerivClause])
forall a. a -> Maybe a
Just (Cxt
x, Name
y, [TyVarBndr BndrVis]
z, Maybe Type
w, [Con]
u, [DerivClause]
v)
      remitter Dec
_ = Maybe
  (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, [Con], [DerivClause])
forall a. Maybe a
Nothing

-- |
-- @
-- _NewtypeD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['TyVarBndrUnit'], 'Maybe' 'Kind', 'Con', ['DerivClause']) -- template-haskell-2.12+
-- _NewtypeD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['Type'],          'Maybe' 'Kind', 'Con', 'Cxt')           -- Earlier versions
-- @
_NewtypeD :: DataPrism' [TyVarBndrVis] Con
_NewtypeD :: DataPrism' [TyVarBndr BndrVis] Con
_NewtypeD
  = ((Cxt, Name, [TyVarBndr BndrVis], Maybe Type, Con, [DerivClause])
 -> Dec)
-> (Dec
    -> Maybe
         (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, Con, [DerivClause]))
-> DataPrism' [TyVarBndr BndrVis] Con
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, Con, [DerivClause])
-> Dec
reviewer Dec
-> Maybe
     (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, Con, [DerivClause])
remitter
  where
      reviewer :: (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, Con, [DerivClause])
-> Dec
reviewer (Cxt
x, Name
y, [TyVarBndr BndrVis]
z, Maybe Type
w, Con
u, [DerivClause]
v) = Cxt
-> Name
-> [TyVarBndr BndrVis]
-> Maybe Type
-> Con
-> [DerivClause]
-> Dec
NewtypeD Cxt
x Name
y [TyVarBndr BndrVis]
z Maybe Type
w Con
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, Con, [DerivClause])
remitter (NewtypeD Cxt
x Name
y [TyVarBndr BndrVis]
z Maybe Type
w Con
u [DerivClause]
v) = (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, Con, [DerivClause])
-> Maybe
     (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, Con, [DerivClause])
forall a. a -> Maybe a
Just (Cxt
x, Name
y, [TyVarBndr BndrVis]
z, Maybe Type
w, Con
u, [DerivClause]
v)
      remitter Dec
_ = Maybe
  (Cxt, Name, [TyVarBndr BndrVis], Maybe Type, Con, [DerivClause])
forall a. Maybe a
Nothing

_DataFamilyD :: Prism' Dec (Name, [TyVarBndrVis], Maybe Kind)
_DataFamilyD :: Prism' Dec (Name, [TyVarBndr BndrVis], Maybe Type)
_DataFamilyD
  = ((Name, [TyVarBndr BndrVis], Maybe Type) -> Dec)
-> (Dec -> Maybe (Name, [TyVarBndr BndrVis], Maybe Type))
-> Prism' Dec (Name, [TyVarBndr BndrVis], Maybe Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [TyVarBndr BndrVis], Maybe Type) -> Dec
reviewer Dec -> Maybe (Name, [TyVarBndr BndrVis], Maybe Type)
remitter
  where
      reviewer :: (Name, [TyVarBndr BndrVis], Maybe Type) -> Dec
reviewer (Name
x, [TyVarBndr BndrVis]
y, Maybe Type
z) = Name -> [TyVarBndr BndrVis] -> Maybe Type -> Dec
DataFamilyD Name
x [TyVarBndr BndrVis]
y Maybe Type
z
      remitter :: Dec -> Maybe (Name, [TyVarBndr BndrVis], Maybe Type)
remitter (DataFamilyD Name
x [TyVarBndr BndrVis]
y Maybe Type
z) = (Name, [TyVarBndr BndrVis], Maybe Type)
-> Maybe (Name, [TyVarBndr BndrVis], Maybe Type)
forall a. a -> Maybe a
Just (Name
x, [TyVarBndr BndrVis]
y, Maybe Type
z)
      remitter Dec
_ = Maybe (Name, [TyVarBndr BndrVis], Maybe Type)
forall a. Maybe a
Nothing

_OpenTypeFamilyD :: Prism' Dec TypeFamilyHead
_OpenTypeFamilyD :: Prism' Dec TypeFamilyHead
_OpenTypeFamilyD
  = (TypeFamilyHead -> Dec)
-> (Dec -> Maybe TypeFamilyHead) -> Prism' Dec TypeFamilyHead
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' TypeFamilyHead -> Dec
reviewer Dec -> Maybe TypeFamilyHead
remitter
  where
      reviewer :: TypeFamilyHead -> Dec
reviewer = TypeFamilyHead -> Dec
OpenTypeFamilyD
      remitter :: Dec -> Maybe TypeFamilyHead
remitter (OpenTypeFamilyD TypeFamilyHead
x) = TypeFamilyHead -> Maybe TypeFamilyHead
forall a. a -> Maybe a
Just TypeFamilyHead
x
      remitter Dec
_ = Maybe TypeFamilyHead
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_PatSynD :: Prism' Dec (Name, PatSynArgs, PatSynDir, Pat)
_PatSynD :: Prism' Dec (Name, PatSynArgs, PatSynDir, Pat)
_PatSynD
  = ((Name, PatSynArgs, PatSynDir, Pat) -> Dec)
-> (Dec -> Maybe (Name, PatSynArgs, PatSynDir, Pat))
-> Prism' Dec (Name, PatSynArgs, PatSynDir, Pat)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, PatSynArgs, PatSynDir, Pat) -> Dec
reviewer Dec -> Maybe (Name, PatSynArgs, PatSynDir, Pat)
remitter
  where
      reviewer :: (Name, PatSynArgs, PatSynDir, Pat) -> Dec
reviewer (Name
x, PatSynArgs
y, PatSynDir
z, Pat
w) = Name -> PatSynArgs -> PatSynDir -> Pat -> Dec
PatSynD Name
x PatSynArgs
y PatSynDir
z Pat
w
      remitter :: Dec -> Maybe (Name, PatSynArgs, PatSynDir, Pat)
remitter (PatSynD Name
x PatSynArgs
y PatSynDir
z Pat
w) = (Name, PatSynArgs, PatSynDir, Pat)
-> Maybe (Name, PatSynArgs, PatSynDir, Pat)
forall a. a -> Maybe a
Just (Name
x, PatSynArgs
y, PatSynDir
z, Pat
w)
      remitter Dec
_ = Maybe (Name, PatSynArgs, PatSynDir, Pat)
forall a. Maybe a
Nothing

_PatSynSigD :: Prism' Dec (Name, PatSynType)
_PatSynSigD :: Prism' Dec (Name, Type)
_PatSynSigD
  = ((Name, Type) -> Dec)
-> (Dec -> Maybe (Name, Type)) -> Prism' Dec (Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type) -> Dec
reviewer Dec -> Maybe (Name, Type)
remitter
  where
      reviewer :: (Name, Type) -> Dec
reviewer (Name
x, Type
y) = Name -> Type -> Dec
PatSynSigD Name
x Type
y
      remitter :: Dec -> Maybe (Name, Type)
remitter (PatSynSigD Name
x Type
y) = (Name, Type) -> Maybe (Name, Type)
forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Dec
_ = Maybe (Name, Type)
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,15,0)
_ImplicitParamBindD :: Prism' Dec (String, Exp)
_ImplicitParamBindD :: Prism' Dec ([Char], Exp)
_ImplicitParamBindD
  = (([Char], Exp) -> Dec)
-> (Dec -> Maybe ([Char], Exp)) -> Prism' Dec ([Char], Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([Char], Exp) -> Dec
reviewer Dec -> Maybe ([Char], Exp)
remitter
  where
      reviewer :: ([Char], Exp) -> Dec
reviewer ([Char]
x, Exp
y) = [Char] -> Exp -> Dec
ImplicitParamBindD [Char]
x Exp
y
      remitter :: Dec -> Maybe ([Char], Exp)
remitter (ImplicitParamBindD [Char]
x Exp
y) = ([Char], Exp) -> Maybe ([Char], Exp)
forall a. a -> Maybe a
Just ([Char]
x, Exp
y)
      remitter Dec
_ = Maybe ([Char], Exp)
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,19,0)
_DefaultD :: Prism' Dec [Type]
_DefaultD :: Prism' Dec Cxt
_DefaultD
  = (Cxt -> Dec) -> (Dec -> Maybe Cxt) -> Prism' Dec Cxt
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Cxt -> Dec
reviewer Dec -> Maybe Cxt
remitter
  where
      reviewer :: Cxt -> Dec
reviewer = Cxt -> Dec
DefaultD
      remitter :: Dec -> Maybe Cxt
remitter (DefaultD Cxt
x) = Cxt -> Maybe Cxt
forall a. a -> Maybe a
Just Cxt
x
      remitter Dec
_ = Maybe Cxt
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,20,0)
_TypeDataD :: Prism' Dec (Name, [TyVarBndrVis], Maybe Kind, [Con])
_TypeDataD :: Prism' Dec (Name, [TyVarBndr BndrVis], Maybe Type, [Con])
_TypeDataD
  = ((Name, [TyVarBndr BndrVis], Maybe Type, [Con]) -> Dec)
-> (Dec -> Maybe (Name, [TyVarBndr BndrVis], Maybe Type, [Con]))
-> Prism' Dec (Name, [TyVarBndr BndrVis], Maybe Type, [Con])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [TyVarBndr BndrVis], Maybe Type, [Con]) -> Dec
reviewer Dec -> Maybe (Name, [TyVarBndr BndrVis], Maybe Type, [Con])
remitter
  where
      reviewer :: (Name, [TyVarBndr BndrVis], Maybe Type, [Con]) -> Dec
reviewer (Name
x, [TyVarBndr BndrVis]
y, Maybe Type
z, [Con]
u) = Name -> [TyVarBndr BndrVis] -> Maybe Type -> [Con] -> Dec
TypeDataD Name
x [TyVarBndr BndrVis]
y Maybe Type
z [Con]
u
      remitter :: Dec -> Maybe (Name, [TyVarBndr BndrVis], Maybe Type, [Con])
remitter (TypeDataD Name
x [TyVarBndr BndrVis]
y Maybe Type
z [Con]
u) = (Name, [TyVarBndr BndrVis], Maybe Type, [Con])
-> Maybe (Name, [TyVarBndr BndrVis], Maybe Type, [Con])
forall a. a -> Maybe a
Just (Name
x, [TyVarBndr BndrVis]
y, Maybe Type
z, [Con]
u)
      remitter Dec
_ = Maybe (Name, [TyVarBndr BndrVis], Maybe Type, [Con])
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,12,0)
_Unidir :: Prism' PatSynDir ()
_Unidir :: Prism' PatSynDir ()
_Unidir
  = (() -> PatSynDir) -> (PatSynDir -> Maybe ()) -> Prism' PatSynDir ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> PatSynDir
reviewer PatSynDir -> Maybe ()
remitter
  where
      reviewer :: () -> PatSynDir
reviewer () = PatSynDir
Unidir
      remitter :: PatSynDir -> Maybe ()
remitter PatSynDir
Unidir = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter PatSynDir
_ = Maybe ()
forall a. Maybe a
Nothing

_ImplBidir :: Prism' PatSynDir ()
_ImplBidir :: Prism' PatSynDir ()
_ImplBidir
  = (() -> PatSynDir) -> (PatSynDir -> Maybe ()) -> Prism' PatSynDir ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> PatSynDir
reviewer PatSynDir -> Maybe ()
remitter
  where
      reviewer :: () -> PatSynDir
reviewer () = PatSynDir
ImplBidir
      remitter :: PatSynDir -> Maybe ()
remitter PatSynDir
ImplBidir = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter PatSynDir
_ = Maybe ()
forall a. Maybe a
Nothing

_ExplBidir :: Prism' PatSynDir [Clause]
_ExplBidir :: Prism' PatSynDir [Clause]
_ExplBidir
  = ([Clause] -> PatSynDir)
-> (PatSynDir -> Maybe [Clause]) -> Prism' PatSynDir [Clause]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Clause] -> PatSynDir
reviewer PatSynDir -> Maybe [Clause]
remitter
  where
      reviewer :: [Clause] -> PatSynDir
reviewer = [Clause] -> PatSynDir
ExplBidir
      remitter :: PatSynDir -> Maybe [Clause]
remitter (ExplBidir [Clause]
x) = [Clause] -> Maybe [Clause]
forall a. a -> Maybe a
Just [Clause]
x
      remitter PatSynDir
_ = Maybe [Clause]
forall a. Maybe a
Nothing

_PrefixPatSyn :: Prism' PatSynArgs [Name]
_PrefixPatSyn :: Prism' PatSynArgs [Name]
_PrefixPatSyn
  = ([Name] -> PatSynArgs)
-> (PatSynArgs -> Maybe [Name]) -> Prism' PatSynArgs [Name]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Name] -> PatSynArgs
reviewer PatSynArgs -> Maybe [Name]
remitter
  where
      reviewer :: [Name] -> PatSynArgs
reviewer = [Name] -> PatSynArgs
PrefixPatSyn
      remitter :: PatSynArgs -> Maybe [Name]
remitter (PrefixPatSyn [Name]
x) = [Name] -> Maybe [Name]
forall a. a -> Maybe a
Just [Name]
x
      remitter PatSynArgs
_ = Maybe [Name]
forall a. Maybe a
Nothing

_InfixPatSyn :: Prism' PatSynArgs (Name, Name)
_InfixPatSyn :: Prism' PatSynArgs (Name, Name)
_InfixPatSyn
  = ((Name, Name) -> PatSynArgs)
-> (PatSynArgs -> Maybe (Name, Name))
-> Prism' PatSynArgs (Name, Name)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Name) -> PatSynArgs
reviewer PatSynArgs -> Maybe (Name, Name)
remitter
  where
      reviewer :: (Name, Name) -> PatSynArgs
reviewer (Name
x, Name
y) = Name -> Name -> PatSynArgs
InfixPatSyn Name
x Name
y
      remitter :: PatSynArgs -> Maybe (Name, Name)
remitter (InfixPatSyn Name
x Name
y) = (Name, Name) -> Maybe (Name, Name)
forall a. a -> Maybe a
Just (Name
x, Name
y)
      remitter PatSynArgs
_ = Maybe (Name, Name)
forall a. Maybe a
Nothing

_RecordPatSyn :: Prism' PatSynArgs [Name]
_RecordPatSyn :: Prism' PatSynArgs [Name]
_RecordPatSyn
  = ([Name] -> PatSynArgs)
-> (PatSynArgs -> Maybe [Name]) -> Prism' PatSynArgs [Name]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Name] -> PatSynArgs
reviewer PatSynArgs -> Maybe [Name]
remitter
  where
      reviewer :: [Name] -> PatSynArgs
reviewer = [Name] -> PatSynArgs
RecordPatSyn
      remitter :: PatSynArgs -> Maybe [Name]
remitter (RecordPatSyn [Name]
x) = [Name] -> Maybe [Name]
forall a. a -> Maybe a
Just [Name]
x
      remitter PatSynArgs
_ = Maybe [Name]
forall a. Maybe a
Nothing
#endif

_NormalC :: Prism' Con (Name, [BangType])
_NormalC :: Prism' Con (Name, [BangType])
_NormalC
  = ((Name, [BangType]) -> Con)
-> (Con -> Maybe (Name, [BangType]))
-> Prism' Con (Name, [BangType])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [BangType]) -> Con
reviewer Con -> Maybe (Name, [BangType])
remitter
  where
      reviewer :: (Name, [BangType]) -> Con
reviewer (Name
x, [BangType]
y) = Name -> [BangType] -> Con
NormalC Name
x [BangType]
y
      remitter :: Con -> Maybe (Name, [BangType])
remitter (NormalC Name
x [BangType]
y) = (Name, [BangType]) -> Maybe (Name, [BangType])
forall a. a -> Maybe a
Just (Name
x, [BangType]
y)
      remitter Con
_ = Maybe (Name, [BangType])
forall a. Maybe a
Nothing

_RecC :: Prism' Con (Name, [VarBangType])
_RecC :: Prism' Con (Name, [VarBangType])
_RecC
  = ((Name, [VarBangType]) -> Con)
-> (Con -> Maybe (Name, [VarBangType]))
-> Prism' Con (Name, [VarBangType])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [VarBangType]) -> Con
reviewer Con -> Maybe (Name, [VarBangType])
remitter
  where
      reviewer :: (Name, [VarBangType]) -> Con
reviewer (Name
x, [VarBangType]
y) = Name -> [VarBangType] -> Con
RecC Name
x [VarBangType]
y
      remitter :: Con -> Maybe (Name, [VarBangType])
remitter (RecC Name
x [VarBangType]
y) = (Name, [VarBangType]) -> Maybe (Name, [VarBangType])
forall a. a -> Maybe a
Just (Name
x, [VarBangType]
y)
      remitter Con
_ = Maybe (Name, [VarBangType])
forall a. Maybe a
Nothing

_InfixC :: Prism' Con (BangType, Name, BangType  )
_InfixC :: Prism' Con (BangType, Name, BangType)
_InfixC
  = ((BangType, Name, BangType) -> Con)
-> (Con -> Maybe (BangType, Name, BangType))
-> Prism' Con (BangType, Name, BangType)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (BangType, Name, BangType) -> Con
reviewer Con -> Maybe (BangType, Name, BangType)
remitter
  where
      reviewer :: (BangType, Name, BangType) -> Con
reviewer (BangType
x, Name
y, BangType
z) = BangType -> Name -> BangType -> Con
InfixC BangType
x Name
y BangType
z
      remitter :: Con -> Maybe (BangType, Name, BangType)
remitter (InfixC BangType
x Name
y BangType
z) = (BangType, Name, BangType) -> Maybe (BangType, Name, BangType)
forall a. a -> Maybe a
Just (BangType
x, Name
y, BangType
z)
      remitter Con
_ = Maybe (BangType, Name, BangType)
forall a. Maybe a
Nothing

_ForallC :: Prism' Con ([TyVarBndrSpec], Cxt, Con)
_ForallC :: Prism' Con ([TyVarBndr Specificity], Cxt, Con)
_ForallC
  = (([TyVarBndr Specificity], Cxt, Con) -> Con)
-> (Con -> Maybe ([TyVarBndr Specificity], Cxt, Con))
-> Prism' Con ([TyVarBndr Specificity], Cxt, Con)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([TyVarBndr Specificity], Cxt, Con) -> Con
reviewer Con -> Maybe ([TyVarBndr Specificity], Cxt, Con)
remitter
  where
      reviewer :: ([TyVarBndr Specificity], Cxt, Con) -> Con
reviewer ([TyVarBndr Specificity]
x, Cxt
y, Con
z) = [TyVarBndr Specificity] -> Cxt -> Con -> Con
ForallC [TyVarBndr Specificity]
x Cxt
y Con
z
      remitter :: Con -> Maybe ([TyVarBndr Specificity], Cxt, Con)
remitter (ForallC [TyVarBndr Specificity]
x Cxt
y Con
z) = ([TyVarBndr Specificity], Cxt, Con)
-> Maybe ([TyVarBndr Specificity], Cxt, Con)
forall a. a -> Maybe a
Just ([TyVarBndr Specificity]
x, Cxt
y, Con
z)
      remitter Con
_ = Maybe ([TyVarBndr Specificity], Cxt, Con)
forall a. Maybe a
Nothing

_GadtC :: Prism' Con ([Name], [BangType], Type)
_GadtC :: Prism' Con ([Name], [BangType], Type)
_GadtC
  = (([Name], [BangType], Type) -> Con)
-> (Con -> Maybe ([Name], [BangType], Type))
-> Prism' Con ([Name], [BangType], Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([Name], [BangType], Type) -> Con
reviewer Con -> Maybe ([Name], [BangType], Type)
remitter
  where
      reviewer :: ([Name], [BangType], Type) -> Con
reviewer ([Name]
x, [BangType]
y, Type
z) = [Name] -> [BangType] -> Type -> Con
GadtC [Name]
x [BangType]
y Type
z
      remitter :: Con -> Maybe ([Name], [BangType], Type)
remitter (GadtC [Name]
x [BangType]
y Type
z) = ([Name], [BangType], Type) -> Maybe ([Name], [BangType], Type)
forall a. a -> Maybe a
Just ([Name]
x, [BangType]
y, Type
z)
      remitter Con
_ = Maybe ([Name], [BangType], Type)
forall a. Maybe a
Nothing

_RecGadtC :: Prism' Con ([Name], [VarBangType], Type)
_RecGadtC :: Prism' Con ([Name], [VarBangType], Type)
_RecGadtC
  = (([Name], [VarBangType], Type) -> Con)
-> (Con -> Maybe ([Name], [VarBangType], Type))
-> Prism' Con ([Name], [VarBangType], Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([Name], [VarBangType], Type) -> Con
reviewer Con -> Maybe ([Name], [VarBangType], Type)
remitter
  where
      reviewer :: ([Name], [VarBangType], Type) -> Con
reviewer ([Name]
x, [VarBangType]
y, Type
z) = [Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
x [VarBangType]
y Type
z
      remitter :: Con -> Maybe ([Name], [VarBangType], Type)
remitter (RecGadtC [Name]
x [VarBangType]
y Type
z) = ([Name], [VarBangType], Type)
-> Maybe ([Name], [VarBangType], Type)
forall a. a -> Maybe a
Just ([Name]
x, [VarBangType]
y, Type
z)
      remitter Con
_ = Maybe ([Name], [VarBangType], Type)
forall a. Maybe a
Nothing

_NoSourceUnpackedness :: Prism' SourceUnpackedness ()
_NoSourceUnpackedness :: Prism' SourceUnpackedness ()
_NoSourceUnpackedness
  = (() -> SourceUnpackedness)
-> (SourceUnpackedness -> Maybe ()) -> Prism' SourceUnpackedness ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> SourceUnpackedness
reviewer SourceUnpackedness -> Maybe ()
remitter
  where
      reviewer :: () -> SourceUnpackedness
reviewer () = SourceUnpackedness
NoSourceUnpackedness
      remitter :: SourceUnpackedness -> Maybe ()
remitter SourceUnpackedness
NoSourceUnpackedness = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter SourceUnpackedness
_ = Maybe ()
forall a. Maybe a
Nothing

_SourceNoUnpack :: Prism' SourceUnpackedness ()
_SourceNoUnpack :: Prism' SourceUnpackedness ()
_SourceNoUnpack
  = (() -> SourceUnpackedness)
-> (SourceUnpackedness -> Maybe ()) -> Prism' SourceUnpackedness ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> SourceUnpackedness
reviewer SourceUnpackedness -> Maybe ()
remitter
  where
      reviewer :: () -> SourceUnpackedness
reviewer () = SourceUnpackedness
SourceNoUnpack
      remitter :: SourceUnpackedness -> Maybe ()
remitter SourceUnpackedness
SourceNoUnpack = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter SourceUnpackedness
_ = Maybe ()
forall a. Maybe a
Nothing

_SourceUnpack :: Prism' SourceUnpackedness ()
_SourceUnpack :: Prism' SourceUnpackedness ()
_SourceUnpack
  = (() -> SourceUnpackedness)
-> (SourceUnpackedness -> Maybe ()) -> Prism' SourceUnpackedness ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> SourceUnpackedness
reviewer SourceUnpackedness -> Maybe ()
remitter
  where
      reviewer :: () -> SourceUnpackedness
reviewer () = SourceUnpackedness
SourceUnpack
      remitter :: SourceUnpackedness -> Maybe ()
remitter SourceUnpackedness
SourceUnpack = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter SourceUnpackedness
_ = Maybe ()
forall a. Maybe a
Nothing

_NoSourceStrictness :: Prism' SourceStrictness ()
_NoSourceStrictness :: Prism' SourceStrictness ()
_NoSourceStrictness
  = (() -> SourceStrictness)
-> (SourceStrictness -> Maybe ()) -> Prism' SourceStrictness ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> SourceStrictness
reviewer SourceStrictness -> Maybe ()
remitter
  where
      reviewer :: () -> SourceStrictness
reviewer () = SourceStrictness
NoSourceStrictness
      remitter :: SourceStrictness -> Maybe ()
remitter SourceStrictness
NoSourceStrictness = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter SourceStrictness
_ = Maybe ()
forall a. Maybe a
Nothing

_SourceLazy :: Prism' SourceStrictness ()
_SourceLazy :: Prism' SourceStrictness ()
_SourceLazy
  = (() -> SourceStrictness)
-> (SourceStrictness -> Maybe ()) -> Prism' SourceStrictness ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> SourceStrictness
reviewer SourceStrictness -> Maybe ()
remitter
  where
      reviewer :: () -> SourceStrictness
reviewer () = SourceStrictness
SourceLazy
      remitter :: SourceStrictness -> Maybe ()
remitter SourceStrictness
SourceLazy = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter SourceStrictness
_ = Maybe ()
forall a. Maybe a
Nothing

_SourceStrict :: Prism' SourceStrictness ()
_SourceStrict :: Prism' SourceStrictness ()
_SourceStrict
  = (() -> SourceStrictness)
-> (SourceStrictness -> Maybe ()) -> Prism' SourceStrictness ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> SourceStrictness
reviewer SourceStrictness -> Maybe ()
remitter
  where
      reviewer :: () -> SourceStrictness
reviewer () = SourceStrictness
SourceStrict
      remitter :: SourceStrictness -> Maybe ()
remitter SourceStrictness
SourceStrict = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter SourceStrictness
_ = Maybe ()
forall a. Maybe a
Nothing

_DecidedLazy :: Prism' DecidedStrictness ()
_DecidedLazy :: Prism' DecidedStrictness ()
_DecidedLazy
  = (() -> DecidedStrictness)
-> (DecidedStrictness -> Maybe ()) -> Prism' DecidedStrictness ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> DecidedStrictness
reviewer DecidedStrictness -> Maybe ()
remitter
  where
      reviewer :: () -> DecidedStrictness
reviewer () = DecidedStrictness
DecidedLazy
      remitter :: DecidedStrictness -> Maybe ()
remitter DecidedStrictness
DecidedLazy = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter DecidedStrictness
_ = Maybe ()
forall a. Maybe a
Nothing

_DecidedStrict :: Prism' DecidedStrictness ()
_DecidedStrict :: Prism' DecidedStrictness ()
_DecidedStrict
  = (() -> DecidedStrictness)
-> (DecidedStrictness -> Maybe ()) -> Prism' DecidedStrictness ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> DecidedStrictness
reviewer DecidedStrictness -> Maybe ()
remitter
  where
      reviewer :: () -> DecidedStrictness
reviewer () = DecidedStrictness
DecidedStrict
      remitter :: DecidedStrictness -> Maybe ()
remitter DecidedStrictness
DecidedStrict = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter DecidedStrictness
_ = Maybe ()
forall a. Maybe a
Nothing

_DecidedUnpack :: Prism' DecidedStrictness ()
_DecidedUnpack :: Prism' DecidedStrictness ()
_DecidedUnpack
  = (() -> DecidedStrictness)
-> (DecidedStrictness -> Maybe ()) -> Prism' DecidedStrictness ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> DecidedStrictness
reviewer DecidedStrictness -> Maybe ()
remitter
  where
      reviewer :: () -> DecidedStrictness
reviewer () = DecidedStrictness
DecidedUnpack
      remitter :: DecidedStrictness -> Maybe ()
remitter DecidedStrictness
DecidedUnpack = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter DecidedStrictness
_ = Maybe ()
forall a. Maybe a
Nothing

_ImportF :: Prism' Foreign (Callconv, Safety, String, Name, Type)
_ImportF :: Prism' Foreign (Callconv, Safety, [Char], Name, Type)
_ImportF
  = ((Callconv, Safety, [Char], Name, Type) -> Foreign)
-> (Foreign -> Maybe (Callconv, Safety, [Char], Name, Type))
-> Prism' Foreign (Callconv, Safety, [Char], Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Callconv, Safety, [Char], Name, Type) -> Foreign
reviewer Foreign -> Maybe (Callconv, Safety, [Char], Name, Type)
remitter
  where
      reviewer :: (Callconv, Safety, [Char], Name, Type) -> Foreign
reviewer (Callconv
x, Safety
y, [Char]
z, Name
w, Type
u) = Callconv -> Safety -> [Char] -> Name -> Type -> Foreign
ImportF Callconv
x Safety
y [Char]
z Name
w Type
u
      remitter :: Foreign -> Maybe (Callconv, Safety, [Char], Name, Type)
remitter (ImportF Callconv
x Safety
y [Char]
z Name
w Type
u) = (Callconv, Safety, [Char], Name, Type)
-> Maybe (Callconv, Safety, [Char], Name, Type)
forall a. a -> Maybe a
Just (Callconv
x,Safety
y,[Char]
z,Name
w,Type
u)
      remitter Foreign
_ = Maybe (Callconv, Safety, [Char], Name, Type)
forall a. Maybe a
Nothing

_ExportF :: Prism' Foreign (Callconv, String, Name, Type)
_ExportF :: Prism' Foreign (Callconv, [Char], Name, Type)
_ExportF
  = ((Callconv, [Char], Name, Type) -> Foreign)
-> (Foreign -> Maybe (Callconv, [Char], Name, Type))
-> Prism' Foreign (Callconv, [Char], Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Callconv, [Char], Name, Type) -> Foreign
reviewer Foreign -> Maybe (Callconv, [Char], Name, Type)
remitter
  where
      reviewer :: (Callconv, [Char], Name, Type) -> Foreign
reviewer (Callconv
x, [Char]
y, Name
z, Type
w) = Callconv -> [Char] -> Name -> Type -> Foreign
ExportF Callconv
x [Char]
y Name
z Type
w
      remitter :: Foreign -> Maybe (Callconv, [Char], Name, Type)
remitter (ExportF Callconv
x [Char]
y Name
z Type
w) = (Callconv, [Char], Name, Type)
-> Maybe (Callconv, [Char], Name, Type)
forall a. a -> Maybe a
Just (Callconv
x, [Char]
y, Name
z, Type
w)
      remitter Foreign
_ = Maybe (Callconv, [Char], Name, Type)
forall a. Maybe a
Nothing

_CCall :: Prism' Callconv ()
_CCall :: Prism' Callconv ()
_CCall
  = (() -> Callconv) -> (Callconv -> Maybe ()) -> Prism' Callconv ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Callconv
reviewer Callconv -> Maybe ()
remitter
  where
      reviewer :: () -> Callconv
reviewer () = Callconv
CCall
      remitter :: Callconv -> Maybe ()
remitter Callconv
CCall = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = Maybe ()
forall a. Maybe a
Nothing

_StdCall :: Prism' Callconv ()
_StdCall :: Prism' Callconv ()
_StdCall
  = (() -> Callconv) -> (Callconv -> Maybe ()) -> Prism' Callconv ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Callconv
reviewer Callconv -> Maybe ()
remitter
  where
      reviewer :: () -> Callconv
reviewer () = Callconv
StdCall
      remitter :: Callconv -> Maybe ()
remitter Callconv
StdCall = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = Maybe ()
forall a. Maybe a
Nothing

_CApi :: Prism' Callconv ()
_CApi :: Prism' Callconv ()
_CApi
  = (() -> Callconv) -> (Callconv -> Maybe ()) -> Prism' Callconv ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Callconv
reviewer Callconv -> Maybe ()
remitter
  where
      reviewer :: () -> Callconv
reviewer () = Callconv
CApi
      remitter :: Callconv -> Maybe ()
remitter Callconv
CApi = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = Maybe ()
forall a. Maybe a
Nothing

_Prim :: Prism' Callconv ()
_Prim :: Prism' Callconv ()
_Prim
  = (() -> Callconv) -> (Callconv -> Maybe ()) -> Prism' Callconv ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Callconv
reviewer Callconv -> Maybe ()
remitter
  where
      reviewer :: () -> Callconv
reviewer () = Callconv
Prim
      remitter :: Callconv -> Maybe ()
remitter Callconv
Prim = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = Maybe ()
forall a. Maybe a
Nothing

_JavaScript :: Prism' Callconv ()
_JavaScript :: Prism' Callconv ()
_JavaScript
  = (() -> Callconv) -> (Callconv -> Maybe ()) -> Prism' Callconv ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Callconv
reviewer Callconv -> Maybe ()
remitter
  where
      reviewer :: () -> Callconv
reviewer () = Callconv
JavaScript
      remitter :: Callconv -> Maybe ()
remitter Callconv
JavaScript = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = Maybe ()
forall a. Maybe a
Nothing

_Unsafe :: Prism' Safety ()
_Unsafe :: Prism' Safety ()
_Unsafe
  = (() -> Safety) -> (Safety -> Maybe ()) -> Prism' Safety ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Safety
reviewer Safety -> Maybe ()
remitter
  where
      reviewer :: () -> Safety
reviewer () = Safety
Unsafe
      remitter :: Safety -> Maybe ()
remitter Safety
Unsafe = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Safety
_ = Maybe ()
forall a. Maybe a
Nothing

_Safe :: Prism' Safety ()
_Safe :: Prism' Safety ()
_Safe
  = (() -> Safety) -> (Safety -> Maybe ()) -> Prism' Safety ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Safety
reviewer Safety -> Maybe ()
remitter
  where
      reviewer :: () -> Safety
reviewer () = Safety
Safe
      remitter :: Safety -> Maybe ()
remitter Safety
Safe = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Safety
_ = Maybe ()
forall a. Maybe a
Nothing

_Interruptible :: Prism' Safety ()
_Interruptible :: Prism' Safety ()
_Interruptible
  = (() -> Safety) -> (Safety -> Maybe ()) -> Prism' Safety ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Safety
reviewer Safety -> Maybe ()
remitter
  where
      reviewer :: () -> Safety
reviewer () = Safety
Interruptible
      remitter :: Safety -> Maybe ()
remitter Safety
Interruptible = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Safety
_ = Maybe ()
forall a. Maybe a
Nothing

_InlineP :: Prism' Pragma (Name, Inline, RuleMatch, Phases)
_InlineP :: Prism' Pragma (Name, Inline, RuleMatch, Phases)
_InlineP
  = ((Name, Inline, RuleMatch, Phases) -> Pragma)
-> (Pragma -> Maybe (Name, Inline, RuleMatch, Phases))
-> Prism' Pragma (Name, Inline, RuleMatch, Phases)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Inline, RuleMatch, Phases) -> Pragma
reviewer Pragma -> Maybe (Name, Inline, RuleMatch, Phases)
remitter
  where
      reviewer :: (Name, Inline, RuleMatch, Phases) -> Pragma
reviewer (Name
x, Inline
y, RuleMatch
z, Phases
w) = Name -> Inline -> RuleMatch -> Phases -> Pragma
InlineP Name
x Inline
y RuleMatch
z Phases
w
      remitter :: Pragma -> Maybe (Name, Inline, RuleMatch, Phases)
remitter (InlineP Name
x Inline
y RuleMatch
z Phases
w) = (Name, Inline, RuleMatch, Phases)
-> Maybe (Name, Inline, RuleMatch, Phases)
forall a. a -> Maybe a
Just (Name
x, Inline
y, RuleMatch
z, Phases
w)
      remitter Pragma
_ = Maybe (Name, Inline, RuleMatch, Phases)
forall a. Maybe a
Nothing

_SpecialiseP :: Prism' Pragma (Name, Type, Maybe Inline, Phases)
_SpecialiseP :: Prism' Pragma (Name, Type, Maybe Inline, Phases)
_SpecialiseP
  = ((Name, Type, Maybe Inline, Phases) -> Pragma)
-> (Pragma -> Maybe (Name, Type, Maybe Inline, Phases))
-> Prism' Pragma (Name, Type, Maybe Inline, Phases)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type, Maybe Inline, Phases) -> Pragma
reviewer Pragma -> Maybe (Name, Type, Maybe Inline, Phases)
remitter
  where
      reviewer :: (Name, Type, Maybe Inline, Phases) -> Pragma
reviewer (Name
x, Type
y, Maybe Inline
z, Phases
w) = Name -> Type -> Maybe Inline -> Phases -> Pragma
SpecialiseP Name
x Type
y Maybe Inline
z Phases
w
      remitter :: Pragma -> Maybe (Name, Type, Maybe Inline, Phases)
remitter (SpecialiseP Name
x Type
y Maybe Inline
z Phases
w) = (Name, Type, Maybe Inline, Phases)
-> Maybe (Name, Type, Maybe Inline, Phases)
forall a. a -> Maybe a
Just (Name
x, Type
y, Maybe Inline
z, Phases
w)
      remitter Pragma
_ = Maybe (Name, Type, Maybe Inline, Phases)
forall a. Maybe a
Nothing

-- TODO add lenses for InlineSpec

_SpecialiseInstP :: Prism' Pragma Type
_SpecialiseInstP :: Prism' Pragma Type
_SpecialiseInstP
  = (Type -> Pragma) -> (Pragma -> Maybe Type) -> Prism' Pragma Type
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Type -> Pragma
reviewer Pragma -> Maybe Type
remitter
  where
      reviewer :: Type -> Pragma
reviewer = Type -> Pragma
SpecialiseInstP
      remitter :: Pragma -> Maybe Type
remitter (SpecialiseInstP Type
x) = Type -> Maybe Type
forall a. a -> Maybe a
Just Type
x
      remitter Pragma
_ = Maybe Type
forall a. Maybe a
Nothing

-- |
-- @
-- _RuleP :: 'Prism'' 'Pragma' ('String', 'Maybe' ['TyVarBndrUnit'], ['RuleBndr'], 'Exp', 'Exp', 'Phases') -- template-haskell-2.15+
-- _RuleP :: 'Prism'' 'Pragma' ('String',                        ['RuleBndr'], 'Exp', 'Exp', 'Phases') -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,15,0)
_RuleP :: Prism' Pragma (String, Maybe [TyVarBndrUnit], [RuleBndr], Exp, Exp, Phases)
_RuleP :: Prism'
  Pragma ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
_RuleP
  = (([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
 -> Pragma)
-> (Pragma
    -> Maybe
         ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases))
-> Prism'
     Pragma ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
-> Pragma
reviewer Pragma
-> Maybe
     ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
remitter
  where
      reviewer :: ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
-> Pragma
reviewer ([Char]
x, Maybe [TyVarBndr ()]
y, [RuleBndr]
z, Exp
w, Exp
u, Phases
v) = [Char]
-> Maybe [TyVarBndr ()]
-> [RuleBndr]
-> Exp
-> Exp
-> Phases
-> Pragma
RuleP [Char]
x Maybe [TyVarBndr ()]
y [RuleBndr]
z Exp
w Exp
u Phases
v
      remitter :: Pragma
-> Maybe
     ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
remitter (RuleP [Char]
x Maybe [TyVarBndr ()]
y [RuleBndr]
z Exp
w Exp
u Phases
v) = ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
-> Maybe
     ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
forall a. a -> Maybe a
Just ([Char]
x, Maybe [TyVarBndr ()]
y, [RuleBndr]
z, Exp
w, Exp
u, Phases
v)
      remitter Pragma
_ = Maybe ([Char], Maybe [TyVarBndr ()], [RuleBndr], Exp, Exp, Phases)
forall a. Maybe a
Nothing
#else
_RuleP :: Prism' Pragma (String, [RuleBndr], Exp, Exp, Phases)
_RuleP
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w, u) = RuleP x y z w u
      remitter (RuleP x y z w u) = Just (x, y, z, w, u)
      remitter _ = Nothing
#endif

_AnnP :: Prism' Pragma (AnnTarget, Exp)
_AnnP :: Prism' Pragma (AnnTarget, Exp)
_AnnP
  = ((AnnTarget, Exp) -> Pragma)
-> (Pragma -> Maybe (AnnTarget, Exp))
-> Prism' Pragma (AnnTarget, Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (AnnTarget, Exp) -> Pragma
reviewer Pragma -> Maybe (AnnTarget, Exp)
remitter
  where
      reviewer :: (AnnTarget, Exp) -> Pragma
reviewer (AnnTarget
x, Exp
y) = AnnTarget -> Exp -> Pragma
AnnP AnnTarget
x Exp
y
      remitter :: Pragma -> Maybe (AnnTarget, Exp)
remitter (AnnP AnnTarget
x Exp
y) = (AnnTarget, Exp) -> Maybe (AnnTarget, Exp)
forall a. a -> Maybe a
Just (AnnTarget
x, Exp
y)
      remitter Pragma
_ = Maybe (AnnTarget, Exp)
forall a. Maybe a
Nothing

_LineP :: Prism' Pragma (Int, String)
_LineP :: Prism' Pragma (Int, [Char])
_LineP
  = ((Int, [Char]) -> Pragma)
-> (Pragma -> Maybe (Int, [Char])) -> Prism' Pragma (Int, [Char])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Int, [Char]) -> Pragma
reviewer Pragma -> Maybe (Int, [Char])
remitter
  where
      reviewer :: (Int, [Char]) -> Pragma
reviewer (Int
x, [Char]
y) = Int -> [Char] -> Pragma
LineP Int
x [Char]
y
      remitter :: Pragma -> Maybe (Int, [Char])
remitter (LineP Int
x [Char]
y) = (Int, [Char]) -> Maybe (Int, [Char])
forall a. a -> Maybe a
Just (Int
x, [Char]
y)
      remitter Pragma
_ = Maybe (Int, [Char])
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_CompleteP :: Prism' Pragma ([Name], Maybe Name)
_CompleteP :: Prism' Pragma ([Name], Maybe Name)
_CompleteP
  = (([Name], Maybe Name) -> Pragma)
-> (Pragma -> Maybe ([Name], Maybe Name))
-> Prism' Pragma ([Name], Maybe Name)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([Name], Maybe Name) -> Pragma
reviewer Pragma -> Maybe ([Name], Maybe Name)
remitter
  where
      reviewer :: ([Name], Maybe Name) -> Pragma
reviewer ([Name]
x, Maybe Name
y) = [Name] -> Maybe Name -> Pragma
CompleteP [Name]
x Maybe Name
y
      remitter :: Pragma -> Maybe ([Name], Maybe Name)
remitter (CompleteP [Name]
x Maybe Name
y) = ([Name], Maybe Name) -> Maybe ([Name], Maybe Name)
forall a. a -> Maybe a
Just ([Name]
x, Maybe Name
y)
      remitter Pragma
_ = Maybe ([Name], Maybe Name)
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,19,0)
_OpaqueP :: Prism' Pragma Name
_OpaqueP :: Prism' Pragma Name
_OpaqueP
  = (Name -> Pragma) -> (Pragma -> Maybe Name) -> Prism' Pragma Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> Pragma
reviewer Pragma -> Maybe Name
remitter
  where
      reviewer :: Name -> Pragma
reviewer = Name -> Pragma
OpaqueP
      remitter :: Pragma -> Maybe Name
remitter (OpaqueP Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter Pragma
_ = Maybe Name
forall a. Maybe a
Nothing
#endif

_NoInline :: Prism' Inline ()
_NoInline :: Prism' Inline ()
_NoInline
  = (() -> Inline) -> (Inline -> Maybe ()) -> Prism' Inline ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Inline
reviewer Inline -> Maybe ()
remitter
  where
      reviewer :: () -> Inline
reviewer () = Inline
NoInline
      remitter :: Inline -> Maybe ()
remitter Inline
NoInline = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Inline
_ = Maybe ()
forall a. Maybe a
Nothing

_Inline :: Prism' Inline ()
_Inline :: Prism' Inline ()
_Inline
  = (() -> Inline) -> (Inline -> Maybe ()) -> Prism' Inline ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Inline
reviewer Inline -> Maybe ()
remitter
  where
      reviewer :: () -> Inline
reviewer () = Inline
Inline
      remitter :: Inline -> Maybe ()
remitter Inline
Inline = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Inline
_ = Maybe ()
forall a. Maybe a
Nothing

_Inlinable :: Prism' Inline ()
_Inlinable :: Prism' Inline ()
_Inlinable
  = (() -> Inline) -> (Inline -> Maybe ()) -> Prism' Inline ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Inline
reviewer Inline -> Maybe ()
remitter
  where
      reviewer :: () -> Inline
reviewer () = Inline
Inlinable
      remitter :: Inline -> Maybe ()
remitter Inline
Inlinable = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Inline
_ = Maybe ()
forall a. Maybe a
Nothing

_ConLike :: Prism' RuleMatch ()
_ConLike :: Prism' RuleMatch ()
_ConLike
  = (() -> RuleMatch) -> (RuleMatch -> Maybe ()) -> Prism' RuleMatch ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> RuleMatch
reviewer RuleMatch -> Maybe ()
remitter
  where
      reviewer :: () -> RuleMatch
reviewer () = RuleMatch
ConLike
      remitter :: RuleMatch -> Maybe ()
remitter RuleMatch
ConLike = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter RuleMatch
_ = Maybe ()
forall a. Maybe a
Nothing

_FunLike :: Prism' RuleMatch ()
_FunLike :: Prism' RuleMatch ()
_FunLike
  = (() -> RuleMatch) -> (RuleMatch -> Maybe ()) -> Prism' RuleMatch ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> RuleMatch
reviewer RuleMatch -> Maybe ()
remitter
  where
      reviewer :: () -> RuleMatch
reviewer () = RuleMatch
FunLike
      remitter :: RuleMatch -> Maybe ()
remitter RuleMatch
FunLike = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter RuleMatch
_ = Maybe ()
forall a. Maybe a
Nothing

_AllPhases :: Prism' Phases ()
_AllPhases :: Prism' Phases ()
_AllPhases
  = (() -> Phases) -> (Phases -> Maybe ()) -> Prism' Phases ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Phases
reviewer Phases -> Maybe ()
remitter
  where
      reviewer :: () -> Phases
reviewer () = Phases
AllPhases
      remitter :: Phases -> Maybe ()
remitter Phases
AllPhases = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Phases
_ = Maybe ()
forall a. Maybe a
Nothing

_FromPhase :: Prism' Phases Int
_FromPhase :: Prism' Phases Int
_FromPhase
  = (Int -> Phases) -> (Phases -> Maybe Int) -> Prism' Phases Int
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Int -> Phases
reviewer Phases -> Maybe Int
remitter
  where
      reviewer :: Int -> Phases
reviewer = Int -> Phases
FromPhase
      remitter :: Phases -> Maybe Int
remitter (FromPhase Int
x) = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
x
      remitter Phases
_ = Maybe Int
forall a. Maybe a
Nothing

_BeforePhase :: Prism' Phases Int
_BeforePhase :: Prism' Phases Int
_BeforePhase
  = (Int -> Phases) -> (Phases -> Maybe Int) -> Prism' Phases Int
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Int -> Phases
reviewer Phases -> Maybe Int
remitter
  where
      reviewer :: Int -> Phases
reviewer = Int -> Phases
BeforePhase
      remitter :: Phases -> Maybe Int
remitter (BeforePhase Int
x) = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
x
      remitter Phases
_ = Maybe Int
forall a. Maybe a
Nothing

_RuleVar :: Prism' RuleBndr Name
_RuleVar :: Prism' RuleBndr Name
_RuleVar
  = (Name -> RuleBndr)
-> (RuleBndr -> Maybe Name) -> Prism' RuleBndr Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> RuleBndr
reviewer RuleBndr -> Maybe Name
remitter
  where
      reviewer :: Name -> RuleBndr
reviewer = Name -> RuleBndr
RuleVar
      remitter :: RuleBndr -> Maybe Name
remitter (RuleVar Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter RuleBndr
_ = Maybe Name
forall a. Maybe a
Nothing

_TypedRuleVar :: Prism' RuleBndr (Name, Type)
_TypedRuleVar :: Prism' RuleBndr (Name, Type)
_TypedRuleVar
  = ((Name, Type) -> RuleBndr)
-> (RuleBndr -> Maybe (Name, Type)) -> Prism' RuleBndr (Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type) -> RuleBndr
reviewer RuleBndr -> Maybe (Name, Type)
remitter
  where
      reviewer :: (Name, Type) -> RuleBndr
reviewer (Name
x, Type
y) = Name -> Type -> RuleBndr
TypedRuleVar Name
x Type
y
      remitter :: RuleBndr -> Maybe (Name, Type)
remitter (TypedRuleVar Name
x Type
y) = (Name, Type) -> Maybe (Name, Type)
forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter RuleBndr
_ = Maybe (Name, Type)
forall a. Maybe a
Nothing

_ModuleAnnotation :: Prism' AnnTarget ()
_ModuleAnnotation :: Prism' AnnTarget ()
_ModuleAnnotation
  = (() -> AnnTarget) -> (AnnTarget -> Maybe ()) -> Prism' AnnTarget ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> AnnTarget
reviewer AnnTarget -> Maybe ()
remitter
  where
      reviewer :: () -> AnnTarget
reviewer () = AnnTarget
ModuleAnnotation
      remitter :: AnnTarget -> Maybe ()
remitter AnnTarget
ModuleAnnotation = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter AnnTarget
_ = Maybe ()
forall a. Maybe a
Nothing

_TypeAnnotation :: Prism' AnnTarget Name
_TypeAnnotation :: Prism' AnnTarget Name
_TypeAnnotation
  = (Name -> AnnTarget)
-> (AnnTarget -> Maybe Name) -> Prism' AnnTarget Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> AnnTarget
reviewer AnnTarget -> Maybe Name
remitter
  where
      reviewer :: Name -> AnnTarget
reviewer = Name -> AnnTarget
TypeAnnotation
      remitter :: AnnTarget -> Maybe Name
remitter (TypeAnnotation Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter AnnTarget
_ = Maybe Name
forall a. Maybe a
Nothing

_ValueAnnotation :: Prism' AnnTarget Name
_ValueAnnotation :: Prism' AnnTarget Name
_ValueAnnotation
  = (Name -> AnnTarget)
-> (AnnTarget -> Maybe Name) -> Prism' AnnTarget Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> AnnTarget
reviewer AnnTarget -> Maybe Name
remitter
  where
      reviewer :: Name -> AnnTarget
reviewer = Name -> AnnTarget
ValueAnnotation
      remitter :: AnnTarget -> Maybe Name
remitter (ValueAnnotation Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter AnnTarget
_ = Maybe Name
forall a. Maybe a
Nothing

_FunDep :: Iso' FunDep ([Name], [Name])
_FunDep :: Iso' FunDep ([Name], [Name])
_FunDep
  = (FunDep -> ([Name], [Name]))
-> (([Name], [Name]) -> FunDep) -> Iso' FunDep ([Name], [Name])
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso FunDep -> ([Name], [Name])
remitter ([Name], [Name]) -> FunDep
reviewer
  where
      reviewer :: ([Name], [Name]) -> FunDep
reviewer ([Name]
x, [Name]
y) = [Name] -> [Name] -> FunDep
FunDep [Name]
x [Name]
y
      remitter :: FunDep -> ([Name], [Name])
remitter (FunDep [Name]
x [Name]
y) = ([Name]
x, [Name]
y)

#if !(MIN_VERSION_template_haskell(2,13,0))
_TypeFam :: Prism' FamFlavour ()
_TypeFam
  = prism' reviewer remitter
  where
      reviewer () = TypeFam
      remitter TypeFam = Just ()
      remitter _ = Nothing

_DataFam :: Prism' FamFlavour ()
_DataFam
  = prism' reviewer remitter
  where
      reviewer () = DataFam
      remitter DataFam = Just ()
      remitter _ = Nothing
#endif

#if MIN_VERSION_template_haskell(2,15,0)
tySynEqnLHS :: Lens' TySynEqn Type
tySynEqnLHS :: Lens' TySynEqn Type
tySynEqnLHS = (TySynEqn -> Type)
-> (TySynEqn -> Type -> TySynEqn) -> Lens' TySynEqn Type
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TySynEqn -> Type
g TySynEqn -> Type -> TySynEqn
s where
   g :: TySynEqn -> Type
g (TySynEqn Maybe [TyVarBndr ()]
_     Type
lhs Type
_)       = Type
lhs
   s :: TySynEqn -> Type -> TySynEqn
s (TySynEqn Maybe [TyVarBndr ()]
mtvbs Type
_   Type
rhs) Type
lhs = Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn
TySynEqn Maybe [TyVarBndr ()]
mtvbs Type
lhs Type
rhs

tySynEqnPatterns :: Lens' TySynEqn [Type]
tySynEqnPatterns :: Lens' TySynEqn Cxt
tySynEqnPatterns = (TySynEqn -> Cxt)
-> (TySynEqn -> Cxt -> TySynEqn) -> Lens' TySynEqn Cxt
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TySynEqn -> Cxt
g TySynEqn -> Cxt -> TySynEqn
forall {t :: * -> *}. Foldable t => TySynEqn -> t Type -> TySynEqn
s where
   g :: TySynEqn -> Cxt
g (TySynEqn Maybe [TyVarBndr ()]
_     Type
lhs Type
_) = Cxt
pats
     where (Type
_n, Cxt
pats) = Type -> (Type, Cxt)
unfoldType Type
lhs
   s :: TySynEqn -> t Type -> TySynEqn
s (TySynEqn Maybe [TyVarBndr ()]
mtvbs Type
lhs Type
rhs) t Type
pats = Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn
TySynEqn Maybe [TyVarBndr ()]
mtvbs ((Type -> Type -> Type) -> Type -> t Type -> Type
forall b a. (b -> a -> b) -> b -> t a -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
F.foldl' Type -> Type -> Type
AppT Type
n t Type
pats) Type
rhs
     where (Type
n, Cxt
_pats) = Type -> (Type, Cxt)
unfoldType Type
lhs

tySynEqnResult :: Lens' TySynEqn Type
tySynEqnResult :: Lens' TySynEqn Type
tySynEqnResult = (TySynEqn -> Type)
-> (TySynEqn -> Type -> TySynEqn) -> Lens' TySynEqn Type
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TySynEqn -> Type
g TySynEqn -> Type -> TySynEqn
s where
   g :: TySynEqn -> Type
g (TySynEqn Maybe [TyVarBndr ()]
_     Type
_   Type
rhs) = Type
rhs
   s :: TySynEqn -> Type -> TySynEqn
s (TySynEqn Maybe [TyVarBndr ()]
mtvbs Type
lhs Type
_)   = Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn
TySynEqn Maybe [TyVarBndr ()]
mtvbs Type
lhs
#else
tySynEqnPatterns :: Lens' TySynEqn [Type]
tySynEqnPatterns = lens g s where
   g (TySynEqn xs _)    = xs
   s (TySynEqn _  y) xs = TySynEqn xs y

tySynEqnResult :: Lens' TySynEqn Type
tySynEqnResult = lens g s where
   g (TySynEqn _  x) = x
   s (TySynEqn xs _) = TySynEqn xs
#endif

_InfixL :: Prism' FixityDirection ()
_InfixL :: Prism' FixityDirection ()
_InfixL
  = (() -> FixityDirection)
-> (FixityDirection -> Maybe ()) -> Prism' FixityDirection ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> FixityDirection
reviewer FixityDirection -> Maybe ()
remitter
  where
      reviewer :: () -> FixityDirection
reviewer () = FixityDirection
InfixL
      remitter :: FixityDirection -> Maybe ()
remitter FixityDirection
InfixL = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter FixityDirection
_ = Maybe ()
forall a. Maybe a
Nothing

_InfixR :: Prism' FixityDirection ()
_InfixR :: Prism' FixityDirection ()
_InfixR
  = (() -> FixityDirection)
-> (FixityDirection -> Maybe ()) -> Prism' FixityDirection ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> FixityDirection
reviewer FixityDirection -> Maybe ()
remitter
  where
      reviewer :: () -> FixityDirection
reviewer () = FixityDirection
InfixR
      remitter :: FixityDirection -> Maybe ()
remitter FixityDirection
InfixR = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter FixityDirection
_ = Maybe ()
forall a. Maybe a
Nothing

_InfixN :: Prism' FixityDirection ()
_InfixN :: Prism' FixityDirection ()
_InfixN
  = (() -> FixityDirection)
-> (FixityDirection -> Maybe ()) -> Prism' FixityDirection ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> FixityDirection
reviewer FixityDirection -> Maybe ()
remitter
  where
      reviewer :: () -> FixityDirection
reviewer () = FixityDirection
InfixN
      remitter :: FixityDirection -> Maybe ()
remitter FixityDirection
InfixN = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter FixityDirection
_ = Maybe ()
forall a. Maybe a
Nothing

_VarE :: Prism' Exp Name
_VarE :: Prism' Exp Name
_VarE
  = (Name -> Exp) -> (Exp -> Maybe Name) -> Prism' Exp Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> Exp
reviewer Exp -> Maybe Name
remitter
  where
      reviewer :: Name -> Exp
reviewer = Name -> Exp
VarE
      remitter :: Exp -> Maybe Name
remitter (VarE Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter Exp
_ = Maybe Name
forall a. Maybe a
Nothing

_ConE :: Prism' Exp Name
_ConE :: Prism' Exp Name
_ConE
  = (Name -> Exp) -> (Exp -> Maybe Name) -> Prism' Exp Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> Exp
reviewer Exp -> Maybe Name
remitter
  where
      reviewer :: Name -> Exp
reviewer = Name -> Exp
ConE
      remitter :: Exp -> Maybe Name
remitter (ConE Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter Exp
_ = Maybe Name
forall a. Maybe a
Nothing

_LitE :: Prism' Exp Lit
_LitE :: Prism' Exp Lit
_LitE
  = (Lit -> Exp) -> (Exp -> Maybe Lit) -> Prism' Exp Lit
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Lit -> Exp
reviewer Exp -> Maybe Lit
remitter
  where
      reviewer :: Lit -> Exp
reviewer = Lit -> Exp
LitE
      remitter :: Exp -> Maybe Lit
remitter (LitE Lit
x) = Lit -> Maybe Lit
forall a. a -> Maybe a
Just Lit
x
      remitter Exp
_ = Maybe Lit
forall a. Maybe a
Nothing

_AppE :: Prism' Exp (Exp, Exp)
_AppE :: Prism' Exp (Exp, Exp)
_AppE
  = ((Exp, Exp) -> Exp)
-> (Exp -> Maybe (Exp, Exp)) -> Prism' Exp (Exp, Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Exp) -> Exp
reviewer Exp -> Maybe (Exp, Exp)
remitter
  where
      reviewer :: (Exp, Exp) -> Exp
reviewer (Exp
x, Exp
y) = Exp -> Exp -> Exp
AppE Exp
x Exp
y
      remitter :: Exp -> Maybe (Exp, Exp)
remitter (AppE Exp
x Exp
y) = (Exp, Exp) -> Maybe (Exp, Exp)
forall a. a -> Maybe a
Just (Exp
x, Exp
y)
      remitter Exp
_ = Maybe (Exp, Exp)
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_AppTypeE :: Prism' Exp (Exp, Type)
_AppTypeE :: Prism' Exp (Exp, Type)
_AppTypeE
  = ((Exp, Type) -> Exp)
-> (Exp -> Maybe (Exp, Type)) -> Prism' Exp (Exp, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Type) -> Exp
reviewer Exp -> Maybe (Exp, Type)
remitter
  where
      reviewer :: (Exp, Type) -> Exp
reviewer (Exp
x, Type
y) = Exp -> Type -> Exp
AppTypeE Exp
x Type
y
      remitter :: Exp -> Maybe (Exp, Type)
remitter (AppTypeE Exp
x Type
y) = (Exp, Type) -> Maybe (Exp, Type)
forall a. a -> Maybe a
Just (Exp
x, Type
y)
      remitter Exp
_ = Maybe (Exp, Type)
forall a. Maybe a
Nothing
#endif

_InfixE :: Prism' Exp (Maybe Exp, Exp, Maybe Exp)
_InfixE :: Prism' Exp (Maybe Exp, Exp, Maybe Exp)
_InfixE
  = ((Maybe Exp, Exp, Maybe Exp) -> Exp)
-> (Exp -> Maybe (Maybe Exp, Exp, Maybe Exp))
-> Prism' Exp (Maybe Exp, Exp, Maybe Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Maybe Exp, Exp, Maybe Exp) -> Exp
reviewer Exp -> Maybe (Maybe Exp, Exp, Maybe Exp)
remitter
  where
      reviewer :: (Maybe Exp, Exp, Maybe Exp) -> Exp
reviewer (Maybe Exp
x, Exp
y, Maybe Exp
z) = Maybe Exp -> Exp -> Maybe Exp -> Exp
InfixE Maybe Exp
x Exp
y Maybe Exp
z
      remitter :: Exp -> Maybe (Maybe Exp, Exp, Maybe Exp)
remitter (InfixE Maybe Exp
x Exp
y Maybe Exp
z) = (Maybe Exp, Exp, Maybe Exp) -> Maybe (Maybe Exp, Exp, Maybe Exp)
forall a. a -> Maybe a
Just (Maybe Exp
x, Exp
y, Maybe Exp
z)
      remitter Exp
_ = Maybe (Maybe Exp, Exp, Maybe Exp)
forall a. Maybe a
Nothing

_UInfixE :: Prism' Exp (Exp, Exp, Exp)
_UInfixE :: Prism' Exp (Exp, Exp, Exp)
_UInfixE
  = ((Exp, Exp, Exp) -> Exp)
-> (Exp -> Maybe (Exp, Exp, Exp)) -> Prism' Exp (Exp, Exp, Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Exp, Exp) -> Exp
reviewer Exp -> Maybe (Exp, Exp, Exp)
remitter
  where
      reviewer :: (Exp, Exp, Exp) -> Exp
reviewer (Exp
x, Exp
y, Exp
z) = Exp -> Exp -> Exp -> Exp
UInfixE Exp
x Exp
y Exp
z
      remitter :: Exp -> Maybe (Exp, Exp, Exp)
remitter (UInfixE Exp
x Exp
y Exp
z) = (Exp, Exp, Exp) -> Maybe (Exp, Exp, Exp)
forall a. a -> Maybe a
Just (Exp
x, Exp
y, Exp
z)
      remitter Exp
_ = Maybe (Exp, Exp, Exp)
forall a. Maybe a
Nothing

_ParensE :: Prism' Exp Exp
_ParensE :: Prism' Exp Exp
_ParensE
  = (Exp -> Exp) -> (Exp -> Maybe Exp) -> Prism' Exp Exp
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Exp -> Exp
reviewer Exp -> Maybe Exp
remitter
  where
      reviewer :: Exp -> Exp
reviewer = Exp -> Exp
ParensE
      remitter :: Exp -> Maybe Exp
remitter (ParensE Exp
x) = Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
x
      remitter Exp
_ = Maybe Exp
forall a. Maybe a
Nothing

_LamE :: Prism' Exp ([Pat], Exp)
_LamE :: Prism' Exp ([Pat], Exp)
_LamE
  = (([Pat], Exp) -> Exp)
-> (Exp -> Maybe ([Pat], Exp)) -> Prism' Exp ([Pat], Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([Pat], Exp) -> Exp
reviewer Exp -> Maybe ([Pat], Exp)
remitter
  where
      reviewer :: ([Pat], Exp) -> Exp
reviewer ([Pat]
x, Exp
y) = [Pat] -> Exp -> Exp
LamE [Pat]
x Exp
y
      remitter :: Exp -> Maybe ([Pat], Exp)
remitter (LamE [Pat]
x Exp
y) = ([Pat], Exp) -> Maybe ([Pat], Exp)
forall a. a -> Maybe a
Just ([Pat]
x, Exp
y)
      remitter Exp
_ = Maybe ([Pat], Exp)
forall a. Maybe a
Nothing

_LamCaseE :: Prism' Exp [Match]
_LamCaseE :: Prism' Exp [Match]
_LamCaseE
  = ([Match] -> Exp) -> (Exp -> Maybe [Match]) -> Prism' Exp [Match]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Match] -> Exp
reviewer Exp -> Maybe [Match]
remitter
  where
      reviewer :: [Match] -> Exp
reviewer = [Match] -> Exp
LamCaseE
      remitter :: Exp -> Maybe [Match]
remitter (LamCaseE [Match]
x) = [Match] -> Maybe [Match]
forall a. a -> Maybe a
Just [Match]
x
      remitter Exp
_ = Maybe [Match]
forall a. Maybe a
Nothing

-- |
-- @
-- _TupE :: 'Prism'' 'Exp' ['Maybe' 'Exp'] -- template-haskell-2.16+
-- _TupE :: 'Prism'' 'Exp' ['Exp']       -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,16,0)
_TupE :: Prism' Exp [Maybe Exp]
#else
_TupE :: Prism' Exp [Exp]
#endif
_TupE :: Prism' Exp [Maybe Exp]
_TupE
  = ([Maybe Exp] -> Exp)
-> (Exp -> Maybe [Maybe Exp]) -> Prism' Exp [Maybe Exp]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Maybe Exp] -> Exp
reviewer Exp -> Maybe [Maybe Exp]
remitter
  where
      reviewer :: [Maybe Exp] -> Exp
reviewer = [Maybe Exp] -> Exp
TupE
      remitter :: Exp -> Maybe [Maybe Exp]
remitter (TupE [Maybe Exp]
x) = [Maybe Exp] -> Maybe [Maybe Exp]
forall a. a -> Maybe a
Just [Maybe Exp]
x
      remitter Exp
_ = Maybe [Maybe Exp]
forall a. Maybe a
Nothing

-- |
-- @
-- _UnboxedTupE :: 'Prism'' 'Exp' ['Maybe' 'Exp'] -- template-haskell-2.16+
-- _UnboxedTupE :: 'Prism'' 'Exp' ['Exp']       -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,16,0)
_UnboxedTupE :: Prism' Exp [Maybe Exp]
#else
_UnboxedTupE :: Prism' Exp [Exp]
#endif
_UnboxedTupE :: Prism' Exp [Maybe Exp]
_UnboxedTupE
  = ([Maybe Exp] -> Exp)
-> (Exp -> Maybe [Maybe Exp]) -> Prism' Exp [Maybe Exp]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Maybe Exp] -> Exp
reviewer Exp -> Maybe [Maybe Exp]
remitter
  where
      reviewer :: [Maybe Exp] -> Exp
reviewer = [Maybe Exp] -> Exp
UnboxedTupE
      remitter :: Exp -> Maybe [Maybe Exp]
remitter (UnboxedTupE [Maybe Exp]
x) = [Maybe Exp] -> Maybe [Maybe Exp]
forall a. a -> Maybe a
Just [Maybe Exp]
x
      remitter Exp
_ = Maybe [Maybe Exp]
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_UnboxedSumE :: Prism' Exp (Exp, SumAlt, SumArity)
_UnboxedSumE :: Prism' Exp (Exp, Int, Int)
_UnboxedSumE
  = ((Exp, Int, Int) -> Exp)
-> (Exp -> Maybe (Exp, Int, Int)) -> Prism' Exp (Exp, Int, Int)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Int, Int) -> Exp
reviewer Exp -> Maybe (Exp, Int, Int)
remitter
  where
      reviewer :: (Exp, Int, Int) -> Exp
reviewer (Exp
x, Int
y, Int
z) = Exp -> Int -> Int -> Exp
UnboxedSumE Exp
x Int
y Int
z
      remitter :: Exp -> Maybe (Exp, Int, Int)
remitter (UnboxedSumE Exp
x Int
y Int
z) = (Exp, Int, Int) -> Maybe (Exp, Int, Int)
forall a. a -> Maybe a
Just (Exp
x, Int
y, Int
z)
      remitter Exp
_ = Maybe (Exp, Int, Int)
forall a. Maybe a
Nothing
#endif

_CondE :: Prism' Exp (Exp, Exp, Exp)
_CondE :: Prism' Exp (Exp, Exp, Exp)
_CondE
  = ((Exp, Exp, Exp) -> Exp)
-> (Exp -> Maybe (Exp, Exp, Exp)) -> Prism' Exp (Exp, Exp, Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Exp, Exp) -> Exp
reviewer Exp -> Maybe (Exp, Exp, Exp)
remitter
  where
      reviewer :: (Exp, Exp, Exp) -> Exp
reviewer (Exp
x, Exp
y, Exp
z) = Exp -> Exp -> Exp -> Exp
CondE Exp
x Exp
y Exp
z
      remitter :: Exp -> Maybe (Exp, Exp, Exp)
remitter (CondE Exp
x Exp
y Exp
z) = (Exp, Exp, Exp) -> Maybe (Exp, Exp, Exp)
forall a. a -> Maybe a
Just (Exp
x, Exp
y, Exp
z)
      remitter Exp
_ = Maybe (Exp, Exp, Exp)
forall a. Maybe a
Nothing

_MultiIfE :: Prism' Exp [(Guard, Exp)]
_MultiIfE :: Prism' Exp [(Guard, Exp)]
_MultiIfE
  = ([(Guard, Exp)] -> Exp)
-> (Exp -> Maybe [(Guard, Exp)]) -> Prism' Exp [(Guard, Exp)]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [(Guard, Exp)] -> Exp
reviewer Exp -> Maybe [(Guard, Exp)]
remitter
  where
      reviewer :: [(Guard, Exp)] -> Exp
reviewer = [(Guard, Exp)] -> Exp
MultiIfE
      remitter :: Exp -> Maybe [(Guard, Exp)]
remitter (MultiIfE [(Guard, Exp)]
x) = [(Guard, Exp)] -> Maybe [(Guard, Exp)]
forall a. a -> Maybe a
Just [(Guard, Exp)]
x
      remitter Exp
_ = Maybe [(Guard, Exp)]
forall a. Maybe a
Nothing

_LetE :: Prism' Exp ([Dec], Exp)
_LetE :: Prism' Exp ([Dec], Exp)
_LetE
  = (([Dec], Exp) -> Exp)
-> (Exp -> Maybe ([Dec], Exp)) -> Prism' Exp ([Dec], Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([Dec], Exp) -> Exp
reviewer Exp -> Maybe ([Dec], Exp)
remitter
  where
      reviewer :: ([Dec], Exp) -> Exp
reviewer ([Dec]
x, Exp
y) = [Dec] -> Exp -> Exp
LetE [Dec]
x Exp
y
      remitter :: Exp -> Maybe ([Dec], Exp)
remitter (LetE [Dec]
x Exp
y) = ([Dec], Exp) -> Maybe ([Dec], Exp)
forall a. a -> Maybe a
Just ([Dec]
x, Exp
y)
      remitter Exp
_ = Maybe ([Dec], Exp)
forall a. Maybe a
Nothing

_CaseE :: Prism' Exp (Exp, [Match])
_CaseE :: Prism' Exp (Exp, [Match])
_CaseE
  = ((Exp, [Match]) -> Exp)
-> (Exp -> Maybe (Exp, [Match])) -> Prism' Exp (Exp, [Match])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, [Match]) -> Exp
reviewer Exp -> Maybe (Exp, [Match])
remitter
  where
      reviewer :: (Exp, [Match]) -> Exp
reviewer (Exp
x, [Match]
y) = Exp -> [Match] -> Exp
CaseE Exp
x [Match]
y
      remitter :: Exp -> Maybe (Exp, [Match])
remitter (CaseE Exp
x [Match]
y) = (Exp, [Match]) -> Maybe (Exp, [Match])
forall a. a -> Maybe a
Just (Exp
x, [Match]
y)
      remitter Exp
_ = Maybe (Exp, [Match])
forall a. Maybe a
Nothing

-- |
-- @
-- _DoE :: 'Prism'' 'Exp' ('Maybe' 'ModName', ['Stmt']) -- template-haskell-2.17+
-- _DoE :: 'Prism'' 'Exp' ['Stmt']                  -- Earlier versions
-- @
# if MIN_VERSION_template_haskell(2,17,0)
_DoE :: Prism' Exp (Maybe ModName, [Stmt])
_DoE :: Prism' Exp (Maybe ModName, [Stmt])
_DoE
  = ((Maybe ModName, [Stmt]) -> Exp)
-> (Exp -> Maybe (Maybe ModName, [Stmt]))
-> Prism' Exp (Maybe ModName, [Stmt])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Maybe ModName, [Stmt]) -> Exp
reviewer Exp -> Maybe (Maybe ModName, [Stmt])
remitter
  where
      reviewer :: (Maybe ModName, [Stmt]) -> Exp
reviewer (Maybe ModName
x, [Stmt]
y) = Maybe ModName -> [Stmt] -> Exp
DoE Maybe ModName
x [Stmt]
y
      remitter :: Exp -> Maybe (Maybe ModName, [Stmt])
remitter (DoE Maybe ModName
x [Stmt]
y) = (Maybe ModName, [Stmt]) -> Maybe (Maybe ModName, [Stmt])
forall a. a -> Maybe a
Just (Maybe ModName
x, [Stmt]
y)
      remitter Exp
_ = Maybe (Maybe ModName, [Stmt])
forall a. Maybe a
Nothing
# else
_DoE :: Prism' Exp [Stmt]
_DoE
  = prism' reviewer remitter
  where
      reviewer = DoE
      remitter (DoE x) = Just x
      remitter _ = Nothing
# endif

_CompE :: Prism' Exp [Stmt]
_CompE :: Prism' Exp [Stmt]
_CompE
  = ([Stmt] -> Exp) -> (Exp -> Maybe [Stmt]) -> Prism' Exp [Stmt]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Stmt] -> Exp
reviewer Exp -> Maybe [Stmt]
remitter
  where
      reviewer :: [Stmt] -> Exp
reviewer = [Stmt] -> Exp
CompE
      remitter :: Exp -> Maybe [Stmt]
remitter (CompE [Stmt]
x) = [Stmt] -> Maybe [Stmt]
forall a. a -> Maybe a
Just [Stmt]
x
      remitter Exp
_ = Maybe [Stmt]
forall a. Maybe a
Nothing

_ArithSeqE :: Prism' Exp Range
_ArithSeqE :: Prism' Exp Range
_ArithSeqE
  = (Range -> Exp) -> (Exp -> Maybe Range) -> Prism' Exp Range
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Range -> Exp
reviewer Exp -> Maybe Range
remitter
  where
      reviewer :: Range -> Exp
reviewer = Range -> Exp
ArithSeqE
      remitter :: Exp -> Maybe Range
remitter (ArithSeqE Range
x) = Range -> Maybe Range
forall a. a -> Maybe a
Just Range
x
      remitter Exp
_ = Maybe Range
forall a. Maybe a
Nothing

_ListE :: Prism' Exp [Exp]
_ListE :: Prism' Exp [Exp]
_ListE
  = ([Exp] -> Exp) -> (Exp -> Maybe [Exp]) -> Prism' Exp [Exp]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Exp] -> Exp
reviewer Exp -> Maybe [Exp]
remitter
  where
      reviewer :: [Exp] -> Exp
reviewer = [Exp] -> Exp
ListE
      remitter :: Exp -> Maybe [Exp]
remitter (ListE [Exp]
x) = [Exp] -> Maybe [Exp]
forall a. a -> Maybe a
Just [Exp]
x
      remitter Exp
_ = Maybe [Exp]
forall a. Maybe a
Nothing

_SigE :: Prism' Exp (Exp, Type)
_SigE :: Prism' Exp (Exp, Type)
_SigE
  = ((Exp, Type) -> Exp)
-> (Exp -> Maybe (Exp, Type)) -> Prism' Exp (Exp, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Type) -> Exp
reviewer Exp -> Maybe (Exp, Type)
remitter
  where
      reviewer :: (Exp, Type) -> Exp
reviewer (Exp
x, Type
y) = Exp -> Type -> Exp
SigE Exp
x Type
y
      remitter :: Exp -> Maybe (Exp, Type)
remitter (SigE Exp
x Type
y) = (Exp, Type) -> Maybe (Exp, Type)
forall a. a -> Maybe a
Just (Exp
x, Type
y)
      remitter Exp
_ = Maybe (Exp, Type)
forall a. Maybe a
Nothing

_RecConE :: Prism' Exp (Name, [FieldExp])
_RecConE :: Prism' Exp (Name, [FieldExp])
_RecConE
  = ((Name, [FieldExp]) -> Exp)
-> (Exp -> Maybe (Name, [FieldExp]))
-> Prism' Exp (Name, [FieldExp])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [FieldExp]) -> Exp
reviewer Exp -> Maybe (Name, [FieldExp])
remitter
  where
      reviewer :: (Name, [FieldExp]) -> Exp
reviewer (Name
x, [FieldExp]
y) = Name -> [FieldExp] -> Exp
RecConE Name
x [FieldExp]
y
      remitter :: Exp -> Maybe (Name, [FieldExp])
remitter (RecConE Name
x [FieldExp]
y) = (Name, [FieldExp]) -> Maybe (Name, [FieldExp])
forall a. a -> Maybe a
Just (Name
x, [FieldExp]
y)
      remitter Exp
_ = Maybe (Name, [FieldExp])
forall a. Maybe a
Nothing

_RecUpdE :: Prism' Exp (Exp, [FieldExp])
_RecUpdE :: Prism' Exp (Exp, [FieldExp])
_RecUpdE
  = ((Exp, [FieldExp]) -> Exp)
-> (Exp -> Maybe (Exp, [FieldExp])) -> Prism' Exp (Exp, [FieldExp])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, [FieldExp]) -> Exp
reviewer Exp -> Maybe (Exp, [FieldExp])
remitter
  where
      reviewer :: (Exp, [FieldExp]) -> Exp
reviewer (Exp
x, [FieldExp]
y) = Exp -> [FieldExp] -> Exp
RecUpdE Exp
x [FieldExp]
y
      remitter :: Exp -> Maybe (Exp, [FieldExp])
remitter (RecUpdE Exp
x [FieldExp]
y) = (Exp, [FieldExp]) -> Maybe (Exp, [FieldExp])
forall a. a -> Maybe a
Just (Exp
x, [FieldExp]
y)
      remitter Exp
_ = Maybe (Exp, [FieldExp])
forall a. Maybe a
Nothing

_StaticE :: Prism' Exp Exp
_StaticE :: Prism' Exp Exp
_StaticE
  = (Exp -> Exp) -> (Exp -> Maybe Exp) -> Prism' Exp Exp
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Exp -> Exp
reviewer Exp -> Maybe Exp
remitter
  where
      reviewer :: Exp -> Exp
reviewer = Exp -> Exp
StaticE
      remitter :: Exp -> Maybe Exp
remitter (StaticE Exp
x) = Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
x
      remitter Exp
_ = Maybe Exp
forall a. Maybe a
Nothing

_UnboundVarE :: Prism' Exp Name
_UnboundVarE :: Prism' Exp Name
_UnboundVarE
  = (Name -> Exp) -> (Exp -> Maybe Name) -> Prism' Exp Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> Exp
reviewer Exp -> Maybe Name
remitter
  where
      reviewer :: Name -> Exp
reviewer = Name -> Exp
UnboundVarE
      remitter :: Exp -> Maybe Name
remitter (UnboundVarE Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter Exp
_ = Maybe Name
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,13,0)
_LabelE :: Prism' Exp String
_LabelE :: Prism' Exp [Char]
_LabelE
  = ([Char] -> Exp) -> (Exp -> Maybe [Char]) -> Prism' Exp [Char]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Char] -> Exp
reviewer Exp -> Maybe [Char]
remitter
  where
      reviewer :: [Char] -> Exp
reviewer = [Char] -> Exp
LabelE
      remitter :: Exp -> Maybe [Char]
remitter (LabelE [Char]
x) = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
x
      remitter Exp
_ = Maybe [Char]
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,15,0)
-- |
-- @
-- _MDoE :: 'Prism'' 'Exp' ('Maybe' 'ModName', ['Stmt']) -- template-haskell-2.17+
-- _MDoE :: 'Prism'' 'Exp' ['Stmt']                  -- Earlier versions
-- @
# if MIN_VERSION_template_haskell(2,17,0)
_MDoE :: Prism' Exp (Maybe ModName, [Stmt])
_MDoE :: Prism' Exp (Maybe ModName, [Stmt])
_MDoE
  = ((Maybe ModName, [Stmt]) -> Exp)
-> (Exp -> Maybe (Maybe ModName, [Stmt]))
-> Prism' Exp (Maybe ModName, [Stmt])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Maybe ModName, [Stmt]) -> Exp
reviewer Exp -> Maybe (Maybe ModName, [Stmt])
remitter
  where
      reviewer :: (Maybe ModName, [Stmt]) -> Exp
reviewer (Maybe ModName
x, [Stmt]
y) = Maybe ModName -> [Stmt] -> Exp
MDoE Maybe ModName
x [Stmt]
y
      remitter :: Exp -> Maybe (Maybe ModName, [Stmt])
remitter (MDoE Maybe ModName
x [Stmt]
y) = (Maybe ModName, [Stmt]) -> Maybe (Maybe ModName, [Stmt])
forall a. a -> Maybe a
Just (Maybe ModName
x, [Stmt]
y)
      remitter Exp
_ = Maybe (Maybe ModName, [Stmt])
forall a. Maybe a
Nothing
# else
_MDoE :: Prism' Exp [Stmt]
_MDoE
  = prism' reviewer remitter
  where
      reviewer = MDoE
      remitter (MDoE x) = Just x
      remitter _ = Nothing
# endif

_ImplicitParamVarE :: Prism' Exp String
_ImplicitParamVarE :: Prism' Exp [Char]
_ImplicitParamVarE
  = ([Char] -> Exp) -> (Exp -> Maybe [Char]) -> Prism' Exp [Char]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Char] -> Exp
reviewer Exp -> Maybe [Char]
remitter
  where
      reviewer :: [Char] -> Exp
reviewer = [Char] -> Exp
ImplicitParamVarE
      remitter :: Exp -> Maybe [Char]
remitter (ImplicitParamVarE [Char]
x) = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
x
      remitter Exp
_ = Maybe [Char]
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,18,0)
_GetFieldE :: Prism' Exp (Exp, String)
_GetFieldE :: Prism' Exp (Exp, [Char])
_GetFieldE
  = ((Exp, [Char]) -> Exp)
-> (Exp -> Maybe (Exp, [Char])) -> Prism' Exp (Exp, [Char])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, [Char]) -> Exp
reviewer Exp -> Maybe (Exp, [Char])
remitter
  where
      reviewer :: (Exp, [Char]) -> Exp
reviewer (Exp
x, [Char]
y) = Exp -> [Char] -> Exp
GetFieldE Exp
x [Char]
y
      remitter :: Exp -> Maybe (Exp, [Char])
remitter (GetFieldE Exp
x [Char]
y) = (Exp, [Char]) -> Maybe (Exp, [Char])
forall a. a -> Maybe a
Just (Exp
x, [Char]
y)
      remitter Exp
_ = Maybe (Exp, [Char])
forall a. Maybe a
Nothing

_ProjectionE :: Prism' Exp (NonEmpty String)
_ProjectionE :: Prism' Exp (NonEmpty [Char])
_ProjectionE
  = (NonEmpty [Char] -> Exp)
-> (Exp -> Maybe (NonEmpty [Char])) -> Prism' Exp (NonEmpty [Char])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' NonEmpty [Char] -> Exp
reviewer Exp -> Maybe (NonEmpty [Char])
remitter
  where
      reviewer :: NonEmpty [Char] -> Exp
reviewer = NonEmpty [Char] -> Exp
ProjectionE
      remitter :: Exp -> Maybe (NonEmpty [Char])
remitter (ProjectionE NonEmpty [Char]
x) = NonEmpty [Char] -> Maybe (NonEmpty [Char])
forall a. a -> Maybe a
Just NonEmpty [Char]
x
      remitter Exp
_ = Maybe (NonEmpty [Char])
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,19,0)
_LamCasesE :: Prism' Exp [Clause]
_LamCasesE :: Prism' Exp [Clause]
_LamCasesE
  = ([Clause] -> Exp) -> (Exp -> Maybe [Clause]) -> Prism' Exp [Clause]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Clause] -> Exp
reviewer Exp -> Maybe [Clause]
remitter
  where
      reviewer :: [Clause] -> Exp
reviewer = [Clause] -> Exp
LamCasesE
      remitter :: Exp -> Maybe [Clause]
remitter (LamCasesE [Clause]
x) = [Clause] -> Maybe [Clause]
forall a. a -> Maybe a
Just [Clause]
x
      remitter Exp
_ = Maybe [Clause]
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,21,0)
_TypedBracketE :: Prism' Exp Exp
_TypedBracketE :: Prism' Exp Exp
_TypedBracketE
  = (Exp -> Exp) -> (Exp -> Maybe Exp) -> Prism' Exp Exp
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Exp -> Exp
reviewer Exp -> Maybe Exp
remitter
  where
      reviewer :: Exp -> Exp
reviewer = Exp -> Exp
TypedBracketE
      remitter :: Exp -> Maybe Exp
remitter (TypedBracketE Exp
x) = Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
x
      remitter Exp
_ = Maybe Exp
forall a. Maybe a
Nothing

_TypedSpliceE :: Prism' Exp Exp
_TypedSpliceE :: Prism' Exp Exp
_TypedSpliceE
  = (Exp -> Exp) -> (Exp -> Maybe Exp) -> Prism' Exp Exp
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Exp -> Exp
reviewer Exp -> Maybe Exp
remitter
  where
      reviewer :: Exp -> Exp
reviewer = Exp -> Exp
TypedSpliceE
      remitter :: Exp -> Maybe Exp
remitter (TypedSpliceE Exp
x) = Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
x
      remitter Exp
_ = Maybe Exp
forall a. Maybe a
Nothing
#endif

_GuardedB :: Prism' Body [(Guard, Exp)]
_GuardedB :: Prism' Body [(Guard, Exp)]
_GuardedB
  = ([(Guard, Exp)] -> Body)
-> (Body -> Maybe [(Guard, Exp)]) -> Prism' Body [(Guard, Exp)]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [(Guard, Exp)] -> Body
reviewer Body -> Maybe [(Guard, Exp)]
remitter
  where
      reviewer :: [(Guard, Exp)] -> Body
reviewer = [(Guard, Exp)] -> Body
GuardedB
      remitter :: Body -> Maybe [(Guard, Exp)]
remitter (GuardedB [(Guard, Exp)]
x) = [(Guard, Exp)] -> Maybe [(Guard, Exp)]
forall a. a -> Maybe a
Just [(Guard, Exp)]
x
      remitter Body
_ = Maybe [(Guard, Exp)]
forall a. Maybe a
Nothing

_NormalB :: Prism' Body Exp
_NormalB :: Prism' Body Exp
_NormalB
  = (Exp -> Body) -> (Body -> Maybe Exp) -> Prism' Body Exp
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Exp -> Body
reviewer Body -> Maybe Exp
remitter
  where
      reviewer :: Exp -> Body
reviewer = Exp -> Body
NormalB
      remitter :: Body -> Maybe Exp
remitter (NormalB Exp
x) = Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
x
      remitter Body
_ = Maybe Exp
forall a. Maybe a
Nothing

_NormalG :: Prism' Guard Exp
_NormalG :: Prism' Guard Exp
_NormalG
  = (Exp -> Guard) -> (Guard -> Maybe Exp) -> Prism' Guard Exp
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Exp -> Guard
reviewer Guard -> Maybe Exp
remitter
  where
      reviewer :: Exp -> Guard
reviewer = Exp -> Guard
NormalG
      remitter :: Guard -> Maybe Exp
remitter (NormalG Exp
x) = Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
x
      remitter Guard
_ = Maybe Exp
forall a. Maybe a
Nothing

_PatG :: Prism' Guard [Stmt]
_PatG :: Prism' Guard [Stmt]
_PatG
  = ([Stmt] -> Guard) -> (Guard -> Maybe [Stmt]) -> Prism' Guard [Stmt]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Stmt] -> Guard
reviewer Guard -> Maybe [Stmt]
remitter
  where
      reviewer :: [Stmt] -> Guard
reviewer = [Stmt] -> Guard
PatG
      remitter :: Guard -> Maybe [Stmt]
remitter (PatG [Stmt]
x) = [Stmt] -> Maybe [Stmt]
forall a. a -> Maybe a
Just [Stmt]
x
      remitter Guard
_ = Maybe [Stmt]
forall a. Maybe a
Nothing

_BindS :: Prism' Stmt (Pat, Exp)
_BindS :: Prism' Stmt (Pat, Exp)
_BindS
  = ((Pat, Exp) -> Stmt)
-> (Stmt -> Maybe (Pat, Exp)) -> Prism' Stmt (Pat, Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Pat, Exp) -> Stmt
reviewer Stmt -> Maybe (Pat, Exp)
remitter
  where
      reviewer :: (Pat, Exp) -> Stmt
reviewer (Pat
x, Exp
y) = Pat -> Exp -> Stmt
BindS Pat
x Exp
y
      remitter :: Stmt -> Maybe (Pat, Exp)
remitter (BindS Pat
x Exp
y) = (Pat, Exp) -> Maybe (Pat, Exp)
forall a. a -> Maybe a
Just (Pat
x, Exp
y)
      remitter Stmt
_ = Maybe (Pat, Exp)
forall a. Maybe a
Nothing

_LetS :: Prism' Stmt [Dec]
_LetS :: Prism' Stmt [Dec]
_LetS
  = ([Dec] -> Stmt) -> (Stmt -> Maybe [Dec]) -> Prism' Stmt [Dec]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Dec] -> Stmt
reviewer Stmt -> Maybe [Dec]
remitter
  where
      reviewer :: [Dec] -> Stmt
reviewer = [Dec] -> Stmt
LetS
      remitter :: Stmt -> Maybe [Dec]
remitter (LetS [Dec]
x) = [Dec] -> Maybe [Dec]
forall a. a -> Maybe a
Just [Dec]
x
      remitter Stmt
_ = Maybe [Dec]
forall a. Maybe a
Nothing

_NoBindS :: Prism' Stmt Exp
_NoBindS :: Prism' Stmt Exp
_NoBindS
  = (Exp -> Stmt) -> (Stmt -> Maybe Exp) -> Prism' Stmt Exp
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Exp -> Stmt
reviewer Stmt -> Maybe Exp
remitter
  where
      reviewer :: Exp -> Stmt
reviewer = Exp -> Stmt
NoBindS
      remitter :: Stmt -> Maybe Exp
remitter (NoBindS Exp
x) = Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
x
      remitter Stmt
_ = Maybe Exp
forall a. Maybe a
Nothing

_ParS :: Prism' Stmt [[Stmt]]
_ParS :: Prism' Stmt [[Stmt]]
_ParS
  = ([[Stmt]] -> Stmt)
-> (Stmt -> Maybe [[Stmt]]) -> Prism' Stmt [[Stmt]]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [[Stmt]] -> Stmt
reviewer Stmt -> Maybe [[Stmt]]
remitter
  where
      reviewer :: [[Stmt]] -> Stmt
reviewer = [[Stmt]] -> Stmt
ParS
      remitter :: Stmt -> Maybe [[Stmt]]
remitter (ParS [[Stmt]]
x) = [[Stmt]] -> Maybe [[Stmt]]
forall a. a -> Maybe a
Just [[Stmt]]
x
      remitter Stmt
_ = Maybe [[Stmt]]
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,15,0)
_RecS :: Prism' Stmt [Stmt]
_RecS :: Prism' Stmt [Stmt]
_RecS
  = ([Stmt] -> Stmt) -> (Stmt -> Maybe [Stmt]) -> Prism' Stmt [Stmt]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Stmt] -> Stmt
reviewer Stmt -> Maybe [Stmt]
remitter
  where
      reviewer :: [Stmt] -> Stmt
reviewer = [Stmt] -> Stmt
RecS
      remitter :: Stmt -> Maybe [Stmt]
remitter (RecS [Stmt]
x) = [Stmt] -> Maybe [Stmt]
forall a. a -> Maybe a
Just [Stmt]
x
      remitter Stmt
_ = Maybe [Stmt]
forall a. Maybe a
Nothing
#endif

_FromR :: Prism' Range Exp
_FromR :: Prism' Range Exp
_FromR
  = (Exp -> Range) -> (Range -> Maybe Exp) -> Prism' Range Exp
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Exp -> Range
reviewer Range -> Maybe Exp
remitter
  where
      reviewer :: Exp -> Range
reviewer = Exp -> Range
FromR
      remitter :: Range -> Maybe Exp
remitter (FromR Exp
x) = Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
x
      remitter Range
_ = Maybe Exp
forall a. Maybe a
Nothing

_FromThenR :: Prism' Range (Exp, Exp)
_FromThenR :: Prism' Range (Exp, Exp)
_FromThenR
  = ((Exp, Exp) -> Range)
-> (Range -> Maybe (Exp, Exp)) -> Prism' Range (Exp, Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Exp) -> Range
reviewer Range -> Maybe (Exp, Exp)
remitter
  where
      reviewer :: (Exp, Exp) -> Range
reviewer (Exp
x, Exp
y) = Exp -> Exp -> Range
FromThenR Exp
x Exp
y
      remitter :: Range -> Maybe (Exp, Exp)
remitter (FromThenR Exp
x Exp
y) = (Exp, Exp) -> Maybe (Exp, Exp)
forall a. a -> Maybe a
Just (Exp
x, Exp
y)
      remitter Range
_ = Maybe (Exp, Exp)
forall a. Maybe a
Nothing

_FromToR :: Prism' Range (Exp, Exp)
_FromToR :: Prism' Range (Exp, Exp)
_FromToR
  = ((Exp, Exp) -> Range)
-> (Range -> Maybe (Exp, Exp)) -> Prism' Range (Exp, Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Exp) -> Range
reviewer Range -> Maybe (Exp, Exp)
remitter
  where
      reviewer :: (Exp, Exp) -> Range
reviewer (Exp
x, Exp
y) = Exp -> Exp -> Range
FromToR Exp
x Exp
y
      remitter :: Range -> Maybe (Exp, Exp)
remitter (FromToR Exp
x Exp
y) = (Exp, Exp) -> Maybe (Exp, Exp)
forall a. a -> Maybe a
Just (Exp
x, Exp
y)
      remitter Range
_ = Maybe (Exp, Exp)
forall a. Maybe a
Nothing

_FromThenToR :: Prism' Range (Exp, Exp, Exp)
_FromThenToR :: Prism' Range (Exp, Exp, Exp)
_FromThenToR
  = ((Exp, Exp, Exp) -> Range)
-> (Range -> Maybe (Exp, Exp, Exp)) -> Prism' Range (Exp, Exp, Exp)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Exp, Exp) -> Range
reviewer Range -> Maybe (Exp, Exp, Exp)
remitter
  where
      reviewer :: (Exp, Exp, Exp) -> Range
reviewer (Exp
x, Exp
y, Exp
z) = Exp -> Exp -> Exp -> Range
FromThenToR Exp
x Exp
y Exp
z
      remitter :: Range -> Maybe (Exp, Exp, Exp)
remitter (FromThenToR Exp
x Exp
y Exp
z) = (Exp, Exp, Exp) -> Maybe (Exp, Exp, Exp)
forall a. a -> Maybe a
Just (Exp
x, Exp
y, Exp
z)
      remitter Range
_ = Maybe (Exp, Exp, Exp)
forall a. Maybe a
Nothing

_CharL :: Prism' Lit Char
_CharL :: Prism' Lit Char
_CharL
  = (Char -> Lit) -> (Lit -> Maybe Char) -> Prism' Lit Char
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Char -> Lit
reviewer Lit -> Maybe Char
remitter
  where
      reviewer :: Char -> Lit
reviewer = Char -> Lit
CharL
      remitter :: Lit -> Maybe Char
remitter (CharL Char
x) = Char -> Maybe Char
forall a. a -> Maybe a
Just Char
x
      remitter Lit
_ = Maybe Char
forall a. Maybe a
Nothing

_StringL :: Prism' Lit String
_StringL :: Prism' Lit [Char]
_StringL
  = ([Char] -> Lit) -> (Lit -> Maybe [Char]) -> Prism' Lit [Char]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Char] -> Lit
reviewer Lit -> Maybe [Char]
remitter
  where
      reviewer :: [Char] -> Lit
reviewer = [Char] -> Lit
StringL
      remitter :: Lit -> Maybe [Char]
remitter (StringL [Char]
x) = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
x
      remitter Lit
_ = Maybe [Char]
forall a. Maybe a
Nothing

_IntegerL :: Prism' Lit Integer
_IntegerL :: Prism' Lit Integer
_IntegerL
  = (Integer -> Lit) -> (Lit -> Maybe Integer) -> Prism' Lit Integer
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Integer -> Lit
reviewer Lit -> Maybe Integer
remitter
  where
      reviewer :: Integer -> Lit
reviewer = Integer -> Lit
IntegerL
      remitter :: Lit -> Maybe Integer
remitter (IntegerL Integer
x) = Integer -> Maybe Integer
forall a. a -> Maybe a
Just Integer
x
      remitter Lit
_ = Maybe Integer
forall a. Maybe a
Nothing

_RationalL :: Prism' Lit Rational
_RationalL :: Prism' Lit Rational
_RationalL
  = (Rational -> Lit) -> (Lit -> Maybe Rational) -> Prism' Lit Rational
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Rational -> Lit
reviewer Lit -> Maybe Rational
remitter
  where
      reviewer :: Rational -> Lit
reviewer = Rational -> Lit
RationalL
      remitter :: Lit -> Maybe Rational
remitter (RationalL Rational
x) = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
x
      remitter Lit
_ = Maybe Rational
forall a. Maybe a
Nothing

_IntPrimL :: Prism' Lit Integer
_IntPrimL :: Prism' Lit Integer
_IntPrimL
  = (Integer -> Lit) -> (Lit -> Maybe Integer) -> Prism' Lit Integer
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Integer -> Lit
reviewer Lit -> Maybe Integer
remitter
  where
      reviewer :: Integer -> Lit
reviewer = Integer -> Lit
IntPrimL
      remitter :: Lit -> Maybe Integer
remitter (IntPrimL Integer
x) = Integer -> Maybe Integer
forall a. a -> Maybe a
Just Integer
x
      remitter Lit
_ = Maybe Integer
forall a. Maybe a
Nothing

_WordPrimL :: Prism' Lit Integer
_WordPrimL :: Prism' Lit Integer
_WordPrimL
  = (Integer -> Lit) -> (Lit -> Maybe Integer) -> Prism' Lit Integer
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Integer -> Lit
reviewer Lit -> Maybe Integer
remitter
  where
      reviewer :: Integer -> Lit
reviewer = Integer -> Lit
WordPrimL
      remitter :: Lit -> Maybe Integer
remitter (WordPrimL Integer
x) = Integer -> Maybe Integer
forall a. a -> Maybe a
Just Integer
x
      remitter Lit
_ = Maybe Integer
forall a. Maybe a
Nothing

_FloatPrimL :: Prism' Lit Rational
_FloatPrimL :: Prism' Lit Rational
_FloatPrimL
  = (Rational -> Lit) -> (Lit -> Maybe Rational) -> Prism' Lit Rational
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Rational -> Lit
reviewer Lit -> Maybe Rational
remitter
  where
      reviewer :: Rational -> Lit
reviewer = Rational -> Lit
FloatPrimL
      remitter :: Lit -> Maybe Rational
remitter (FloatPrimL Rational
x) = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
x
      remitter Lit
_ = Maybe Rational
forall a. Maybe a
Nothing

_DoublePrimL :: Prism' Lit Rational
_DoublePrimL :: Prism' Lit Rational
_DoublePrimL
  = (Rational -> Lit) -> (Lit -> Maybe Rational) -> Prism' Lit Rational
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Rational -> Lit
reviewer Lit -> Maybe Rational
remitter
  where
      reviewer :: Rational -> Lit
reviewer = Rational -> Lit
DoublePrimL
      remitter :: Lit -> Maybe Rational
remitter (DoublePrimL Rational
x) = Rational -> Maybe Rational
forall a. a -> Maybe a
Just Rational
x
      remitter Lit
_ = Maybe Rational
forall a. Maybe a
Nothing

_StringPrimL :: Prism' Lit [Word8]
_StringPrimL :: Prism' Lit [Word8]
_StringPrimL
  = ([Word8] -> Lit) -> (Lit -> Maybe [Word8]) -> Prism' Lit [Word8]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Word8] -> Lit
reviewer Lit -> Maybe [Word8]
remitter
  where
      reviewer :: [Word8] -> Lit
reviewer = [Word8] -> Lit
StringPrimL
      remitter :: Lit -> Maybe [Word8]
remitter (StringPrimL [Word8]
x) = [Word8] -> Maybe [Word8]
forall a. a -> Maybe a
Just [Word8]
x
      remitter Lit
_ = Maybe [Word8]
forall a. Maybe a
Nothing

_CharPrimL :: Prism' Lit Char
_CharPrimL :: Prism' Lit Char
_CharPrimL
  = (Char -> Lit) -> (Lit -> Maybe Char) -> Prism' Lit Char
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Char -> Lit
reviewer Lit -> Maybe Char
remitter
  where
      reviewer :: Char -> Lit
reviewer = Char -> Lit
CharPrimL
      remitter :: Lit -> Maybe Char
remitter (CharPrimL Char
x) = Char -> Maybe Char
forall a. a -> Maybe a
Just Char
x
      remitter Lit
_ = Maybe Char
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,16,0)
_BytesPrimL :: Prism' Lit Bytes
_BytesPrimL :: Prism' Lit Bytes
_BytesPrimL
  = (Bytes -> Lit) -> (Lit -> Maybe Bytes) -> Prism' Lit Bytes
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Bytes -> Lit
reviewer Lit -> Maybe Bytes
remitter
  where
      reviewer :: Bytes -> Lit
reviewer = Bytes -> Lit
BytesPrimL
      remitter :: Lit -> Maybe Bytes
remitter (BytesPrimL Bytes
x) = Bytes -> Maybe Bytes
forall a. a -> Maybe a
Just Bytes
x
      remitter Lit
_ = Maybe Bytes
forall a. Maybe a
Nothing
#endif

_LitP :: Prism' Pat Lit
_LitP :: Prism' Pat Lit
_LitP
  = (Lit -> Pat) -> (Pat -> Maybe Lit) -> Prism' Pat Lit
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Lit -> Pat
reviewer Pat -> Maybe Lit
remitter
  where
      reviewer :: Lit -> Pat
reviewer = Lit -> Pat
LitP
      remitter :: Pat -> Maybe Lit
remitter (LitP Lit
x) = Lit -> Maybe Lit
forall a. a -> Maybe a
Just Lit
x
      remitter Pat
_ = Maybe Lit
forall a. Maybe a
Nothing

_VarP :: Prism' Pat Name
_VarP :: Prism' Pat Name
_VarP
  = (Name -> Pat) -> (Pat -> Maybe Name) -> Prism' Pat Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> Pat
reviewer Pat -> Maybe Name
remitter
  where
      reviewer :: Name -> Pat
reviewer = Name -> Pat
VarP
      remitter :: Pat -> Maybe Name
remitter (VarP Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter Pat
_ = Maybe Name
forall a. Maybe a
Nothing

_TupP :: Prism' Pat [Pat]
_TupP :: Prism' Pat [Pat]
_TupP
  = ([Pat] -> Pat) -> (Pat -> Maybe [Pat]) -> Prism' Pat [Pat]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Pat] -> Pat
reviewer Pat -> Maybe [Pat]
remitter
  where
      reviewer :: [Pat] -> Pat
reviewer = [Pat] -> Pat
TupP
      remitter :: Pat -> Maybe [Pat]
remitter (TupP [Pat]
x) = [Pat] -> Maybe [Pat]
forall a. a -> Maybe a
Just [Pat]
x
      remitter Pat
_ = Maybe [Pat]
forall a. Maybe a
Nothing

_UnboxedTupP :: Prism' Pat [Pat]
_UnboxedTupP :: Prism' Pat [Pat]
_UnboxedTupP
  = ([Pat] -> Pat) -> (Pat -> Maybe [Pat]) -> Prism' Pat [Pat]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Pat] -> Pat
reviewer Pat -> Maybe [Pat]
remitter
  where
      reviewer :: [Pat] -> Pat
reviewer = [Pat] -> Pat
UnboxedTupP
      remitter :: Pat -> Maybe [Pat]
remitter (UnboxedTupP [Pat]
x) = [Pat] -> Maybe [Pat]
forall a. a -> Maybe a
Just [Pat]
x
      remitter Pat
_ = Maybe [Pat]
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_UnboxedSumP :: Prism' Pat (Pat, SumAlt, SumArity)
_UnboxedSumP :: Prism' Pat (Pat, Int, Int)
_UnboxedSumP
  = ((Pat, Int, Int) -> Pat)
-> (Pat -> Maybe (Pat, Int, Int)) -> Prism' Pat (Pat, Int, Int)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Pat, Int, Int) -> Pat
reviewer Pat -> Maybe (Pat, Int, Int)
remitter
  where
      reviewer :: (Pat, Int, Int) -> Pat
reviewer (Pat
x, Int
y, Int
z) = Pat -> Int -> Int -> Pat
UnboxedSumP Pat
x Int
y Int
z
      remitter :: Pat -> Maybe (Pat, Int, Int)
remitter (UnboxedSumP Pat
x Int
y Int
z) = (Pat, Int, Int) -> Maybe (Pat, Int, Int)
forall a. a -> Maybe a
Just (Pat
x, Int
y, Int
z)
      remitter Pat
_ = Maybe (Pat, Int, Int)
forall a. Maybe a
Nothing
#endif

-- |
-- @
-- _ConP :: 'Prism'' 'Pat' ('Name', ['Type'], ['Pat']) -- template-haskell-2.18+
-- _ConP :: 'Prism'' 'Pat' ('Name',         ['Pat']) -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,18,0)
_ConP :: Prism' Pat (Name, [Type], [Pat])
_ConP :: Prism' Pat (Name, Cxt, [Pat])
_ConP
  = ((Name, Cxt, [Pat]) -> Pat)
-> (Pat -> Maybe (Name, Cxt, [Pat]))
-> Prism' Pat (Name, Cxt, [Pat])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Cxt, [Pat]) -> Pat
reviewer Pat -> Maybe (Name, Cxt, [Pat])
remitter
  where
      reviewer :: (Name, Cxt, [Pat]) -> Pat
reviewer (Name
x, Cxt
y, [Pat]
z) = Name -> Cxt -> [Pat] -> Pat
ConP Name
x Cxt
y [Pat]
z
      remitter :: Pat -> Maybe (Name, Cxt, [Pat])
remitter (ConP Name
x Cxt
y [Pat]
z) = (Name, Cxt, [Pat]) -> Maybe (Name, Cxt, [Pat])
forall a. a -> Maybe a
Just (Name
x, Cxt
y, [Pat]
z)
      remitter Pat
_ = Maybe (Name, Cxt, [Pat])
forall a. Maybe a
Nothing
#else
_ConP :: Prism' Pat (Name, [Pat])
_ConP
  = prism' reviewer remitter
  where
      reviewer (x, y) = ConP x y
      remitter (ConP x y) = Just (x, y)
      remitter _ = Nothing
#endif

_InfixP :: Prism' Pat (Pat, Name, Pat)
_InfixP :: Prism' Pat (Pat, Name, Pat)
_InfixP
  = ((Pat, Name, Pat) -> Pat)
-> (Pat -> Maybe (Pat, Name, Pat)) -> Prism' Pat (Pat, Name, Pat)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Pat, Name, Pat) -> Pat
reviewer Pat -> Maybe (Pat, Name, Pat)
remitter
  where
      reviewer :: (Pat, Name, Pat) -> Pat
reviewer (Pat
x, Name
y, Pat
z) = Pat -> Name -> Pat -> Pat
InfixP Pat
x Name
y Pat
z
      remitter :: Pat -> Maybe (Pat, Name, Pat)
remitter (InfixP Pat
x Name
y Pat
z) = (Pat, Name, Pat) -> Maybe (Pat, Name, Pat)
forall a. a -> Maybe a
Just (Pat
x, Name
y, Pat
z)
      remitter Pat
_ = Maybe (Pat, Name, Pat)
forall a. Maybe a
Nothing

_UInfixP :: Prism' Pat (Pat, Name, Pat)
_UInfixP :: Prism' Pat (Pat, Name, Pat)
_UInfixP
  = ((Pat, Name, Pat) -> Pat)
-> (Pat -> Maybe (Pat, Name, Pat)) -> Prism' Pat (Pat, Name, Pat)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Pat, Name, Pat) -> Pat
reviewer Pat -> Maybe (Pat, Name, Pat)
remitter
  where
      reviewer :: (Pat, Name, Pat) -> Pat
reviewer (Pat
x, Name
y, Pat
z) = Pat -> Name -> Pat -> Pat
UInfixP Pat
x Name
y Pat
z
      remitter :: Pat -> Maybe (Pat, Name, Pat)
remitter (UInfixP Pat
x Name
y Pat
z) = (Pat, Name, Pat) -> Maybe (Pat, Name, Pat)
forall a. a -> Maybe a
Just (Pat
x, Name
y, Pat
z)
      remitter Pat
_ = Maybe (Pat, Name, Pat)
forall a. Maybe a
Nothing

_ParensP :: Prism' Pat Pat
_ParensP :: Prism' Pat Pat
_ParensP
  = (Pat -> Pat) -> (Pat -> Maybe Pat) -> Prism' Pat Pat
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Pat -> Pat
reviewer Pat -> Maybe Pat
remitter
  where
      reviewer :: Pat -> Pat
reviewer = Pat -> Pat
ParensP
      remitter :: Pat -> Maybe Pat
remitter (ParensP Pat
x) = Pat -> Maybe Pat
forall a. a -> Maybe a
Just Pat
x
      remitter Pat
_ = Maybe Pat
forall a. Maybe a
Nothing

_TildeP :: Prism' Pat Pat
_TildeP :: Prism' Pat Pat
_TildeP
  = (Pat -> Pat) -> (Pat -> Maybe Pat) -> Prism' Pat Pat
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Pat -> Pat
reviewer Pat -> Maybe Pat
remitter
  where
      reviewer :: Pat -> Pat
reviewer = Pat -> Pat
TildeP
      remitter :: Pat -> Maybe Pat
remitter (TildeP Pat
x) = Pat -> Maybe Pat
forall a. a -> Maybe a
Just Pat
x
      remitter Pat
_ = Maybe Pat
forall a. Maybe a
Nothing

_BangP :: Prism' Pat Pat
_BangP :: Prism' Pat Pat
_BangP
  = (Pat -> Pat) -> (Pat -> Maybe Pat) -> Prism' Pat Pat
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Pat -> Pat
reviewer Pat -> Maybe Pat
remitter
  where
      reviewer :: Pat -> Pat
reviewer = Pat -> Pat
BangP
      remitter :: Pat -> Maybe Pat
remitter (BangP Pat
x) = Pat -> Maybe Pat
forall a. a -> Maybe a
Just Pat
x
      remitter Pat
_ = Maybe Pat
forall a. Maybe a
Nothing

_AsP :: Prism' Pat (Name, Pat)
_AsP :: Prism' Pat FieldPat
_AsP
  = (FieldPat -> Pat) -> (Pat -> Maybe FieldPat) -> Prism' Pat FieldPat
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' FieldPat -> Pat
reviewer Pat -> Maybe FieldPat
remitter
  where
      reviewer :: FieldPat -> Pat
reviewer (Name
x, Pat
y) = Name -> Pat -> Pat
AsP Name
x Pat
y
      remitter :: Pat -> Maybe FieldPat
remitter (AsP Name
x Pat
y) = FieldPat -> Maybe FieldPat
forall a. a -> Maybe a
Just (Name
x, Pat
y)
      remitter Pat
_ = Maybe FieldPat
forall a. Maybe a
Nothing

_WildP :: Prism' Pat ()
_WildP :: Prism' Pat ()
_WildP
  = (() -> Pat) -> (Pat -> Maybe ()) -> Prism' Pat ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Pat
reviewer Pat -> Maybe ()
remitter
  where
      reviewer :: () -> Pat
reviewer () = Pat
WildP
      remitter :: Pat -> Maybe ()
remitter Pat
WildP = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Pat
_ = Maybe ()
forall a. Maybe a
Nothing

_RecP :: Prism' Pat (Name, [FieldPat])
_RecP :: Prism' Pat (Name, [FieldPat])
_RecP
  = ((Name, [FieldPat]) -> Pat)
-> (Pat -> Maybe (Name, [FieldPat]))
-> Prism' Pat (Name, [FieldPat])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [FieldPat]) -> Pat
reviewer Pat -> Maybe (Name, [FieldPat])
remitter
  where
      reviewer :: (Name, [FieldPat]) -> Pat
reviewer (Name
x, [FieldPat]
y) = Name -> [FieldPat] -> Pat
RecP Name
x [FieldPat]
y
      remitter :: Pat -> Maybe (Name, [FieldPat])
remitter (RecP Name
x [FieldPat]
y) = (Name, [FieldPat]) -> Maybe (Name, [FieldPat])
forall a. a -> Maybe a
Just (Name
x, [FieldPat]
y)
      remitter Pat
_ = Maybe (Name, [FieldPat])
forall a. Maybe a
Nothing

_ListP :: Prism' Pat [Pat]
_ListP :: Prism' Pat [Pat]
_ListP
  = ([Pat] -> Pat) -> (Pat -> Maybe [Pat]) -> Prism' Pat [Pat]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Pat] -> Pat
reviewer Pat -> Maybe [Pat]
remitter
  where
      reviewer :: [Pat] -> Pat
reviewer = [Pat] -> Pat
ListP
      remitter :: Pat -> Maybe [Pat]
remitter (ListP [Pat]
x) = [Pat] -> Maybe [Pat]
forall a. a -> Maybe a
Just [Pat]
x
      remitter Pat
_ = Maybe [Pat]
forall a. Maybe a
Nothing

_SigP :: Prism' Pat (Pat, Type)
_SigP :: Prism' Pat (Pat, Type)
_SigP
  = ((Pat, Type) -> Pat)
-> (Pat -> Maybe (Pat, Type)) -> Prism' Pat (Pat, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Pat, Type) -> Pat
reviewer Pat -> Maybe (Pat, Type)
remitter
  where
      reviewer :: (Pat, Type) -> Pat
reviewer (Pat
x, Type
y) = Pat -> Type -> Pat
SigP Pat
x Type
y
      remitter :: Pat -> Maybe (Pat, Type)
remitter (SigP Pat
x Type
y) = (Pat, Type) -> Maybe (Pat, Type)
forall a. a -> Maybe a
Just (Pat
x, Type
y)
      remitter Pat
_ = Maybe (Pat, Type)
forall a. Maybe a
Nothing

_ViewP :: Prism' Pat (Exp, Pat)
_ViewP :: Prism' Pat (Exp, Pat)
_ViewP
  = ((Exp, Pat) -> Pat)
-> (Pat -> Maybe (Exp, Pat)) -> Prism' Pat (Exp, Pat)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Exp, Pat) -> Pat
reviewer Pat -> Maybe (Exp, Pat)
remitter
  where
      reviewer :: (Exp, Pat) -> Pat
reviewer (Exp
x, Pat
y) = Exp -> Pat -> Pat
ViewP Exp
x Pat
y
      remitter :: Pat -> Maybe (Exp, Pat)
remitter (ViewP Exp
x Pat
y) = (Exp, Pat) -> Maybe (Exp, Pat)
forall a. a -> Maybe a
Just (Exp
x, Pat
y)
      remitter Pat
_ = Maybe (Exp, Pat)
forall a. Maybe a
Nothing

_ForallT :: Prism' Type ([TyVarBndrSpec], Cxt, Type)
_ForallT :: Prism' Type ([TyVarBndr Specificity], Cxt, Type)
_ForallT
  = (([TyVarBndr Specificity], Cxt, Type) -> Type)
-> (Type -> Maybe ([TyVarBndr Specificity], Cxt, Type))
-> Prism' Type ([TyVarBndr Specificity], Cxt, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([TyVarBndr Specificity], Cxt, Type) -> Type
reviewer Type -> Maybe ([TyVarBndr Specificity], Cxt, Type)
remitter
  where
      reviewer :: ([TyVarBndr Specificity], Cxt, Type) -> Type
reviewer ([TyVarBndr Specificity]
x, Cxt
y, Type
z) = [TyVarBndr Specificity] -> Cxt -> Type -> Type
ForallT [TyVarBndr Specificity]
x Cxt
y Type
z
      remitter :: Type -> Maybe ([TyVarBndr Specificity], Cxt, Type)
remitter (ForallT [TyVarBndr Specificity]
x Cxt
y Type
z) = ([TyVarBndr Specificity], Cxt, Type)
-> Maybe ([TyVarBndr Specificity], Cxt, Type)
forall a. a -> Maybe a
Just ([TyVarBndr Specificity]
x, Cxt
y, Type
z)
      remitter Type
_ = Maybe ([TyVarBndr Specificity], Cxt, Type)
forall a. Maybe a
Nothing

_AppT :: Prism' Type (Type, Type)
_AppT :: Prism' Type (Type, Type)
_AppT
  = ((Type, Type) -> Type)
-> (Type -> Maybe (Type, Type)) -> Prism' Type (Type, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Type, Type) -> Type
reviewer Type -> Maybe (Type, Type)
remitter
  where
      reviewer :: (Type, Type) -> Type
reviewer (Type
x, Type
y) = Type -> Type -> Type
AppT Type
x Type
y
      remitter :: Type -> Maybe (Type, Type)
remitter (AppT Type
x Type
y) = (Type, Type) -> Maybe (Type, Type)
forall a. a -> Maybe a
Just (Type
x, Type
y)
      remitter Type
_ = Maybe (Type, Type)
forall a. Maybe a
Nothing

_SigT :: Prism' Type (Type, Kind)
_SigT :: Prism' Type (Type, Type)
_SigT
  = ((Type, Type) -> Type)
-> (Type -> Maybe (Type, Type)) -> Prism' Type (Type, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Type, Type) -> Type
reviewer Type -> Maybe (Type, Type)
remitter
  where
      reviewer :: (Type, Type) -> Type
reviewer (Type
x, Type
y) = Type -> Type -> Type
SigT Type
x Type
y
      remitter :: Type -> Maybe (Type, Type)
remitter (SigT Type
x Type
y) = (Type, Type) -> Maybe (Type, Type)
forall a. a -> Maybe a
Just (Type
x, Type
y)
      remitter Type
_ = Maybe (Type, Type)
forall a. Maybe a
Nothing

_VarT :: Prism' Type Name
_VarT :: Prism' Type Name
_VarT
  = (Name -> Type) -> (Type -> Maybe Name) -> Prism' Type Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> Type
reviewer Type -> Maybe Name
remitter
  where
      reviewer :: Name -> Type
reviewer = Name -> Type
VarT
      remitter :: Type -> Maybe Name
remitter (VarT Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter Type
_ = Maybe Name
forall a. Maybe a
Nothing

_ConT :: Prism' Type Name
_ConT :: Prism' Type Name
_ConT
  = (Name -> Type) -> (Type -> Maybe Name) -> Prism' Type Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> Type
reviewer Type -> Maybe Name
remitter
  where
      reviewer :: Name -> Type
reviewer = Name -> Type
ConT
      remitter :: Type -> Maybe Name
remitter (ConT Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter Type
_ = Maybe Name
forall a. Maybe a
Nothing

_PromotedT :: Prism' Type Name
_PromotedT :: Prism' Type Name
_PromotedT
  = (Name -> Type) -> (Type -> Maybe Name) -> Prism' Type Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> Type
reviewer Type -> Maybe Name
remitter
  where
      reviewer :: Name -> Type
reviewer = Name -> Type
PromotedT
      remitter :: Type -> Maybe Name
remitter (PromotedT Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter Type
_ = Maybe Name
forall a. Maybe a
Nothing

_TupleT :: Prism' Type Int
_TupleT :: Prism' Type Int
_TupleT
  = (Int -> Type) -> (Type -> Maybe Int) -> Prism' Type Int
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Int -> Type
reviewer Type -> Maybe Int
remitter
  where
      reviewer :: Int -> Type
reviewer = Int -> Type
TupleT
      remitter :: Type -> Maybe Int
remitter (TupleT Int
x) = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
x
      remitter Type
_ = Maybe Int
forall a. Maybe a
Nothing

_UnboxedTupleT :: Prism' Type Int
_UnboxedTupleT :: Prism' Type Int
_UnboxedTupleT
  = (Int -> Type) -> (Type -> Maybe Int) -> Prism' Type Int
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Int -> Type
reviewer Type -> Maybe Int
remitter
  where
      reviewer :: Int -> Type
reviewer = Int -> Type
UnboxedTupleT
      remitter :: Type -> Maybe Int
remitter (UnboxedTupleT Int
x) = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
x
      remitter Type
_ = Maybe Int
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_UnboxedSumT :: Prism' Type SumArity
_UnboxedSumT :: Prism' Type Int
_UnboxedSumT
  = (Int -> Type) -> (Type -> Maybe Int) -> Prism' Type Int
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Int -> Type
reviewer Type -> Maybe Int
remitter
  where
      reviewer :: Int -> Type
reviewer = Int -> Type
UnboxedSumT
      remitter :: Type -> Maybe Int
remitter (UnboxedSumT Int
x) = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
x
      remitter Type
_ = Maybe Int
forall a. Maybe a
Nothing
#endif

_ArrowT :: Prism' Type ()
_ArrowT :: Prism' Type ()
_ArrowT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism' Type ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
ArrowT
      remitter :: Type -> Maybe ()
remitter Type
ArrowT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing

_EqualityT :: Prism' Type ()
_EqualityT :: Prism' Type ()
_EqualityT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism' Type ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
EqualityT
      remitter :: Type -> Maybe ()
remitter Type
EqualityT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing

_ListT :: Prism' Type ()
_ListT :: Prism' Type ()
_ListT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism' Type ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
ListT
      remitter :: Type -> Maybe ()
remitter Type
ListT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing

_PromotedTupleT :: Prism' Type Int
_PromotedTupleT :: Prism' Type Int
_PromotedTupleT
  = (Int -> Type) -> (Type -> Maybe Int) -> Prism' Type Int
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Int -> Type
reviewer Type -> Maybe Int
remitter
  where
      reviewer :: Int -> Type
reviewer = Int -> Type
PromotedTupleT
      remitter :: Type -> Maybe Int
remitter (PromotedTupleT Int
x) = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
x
      remitter Type
_ = Maybe Int
forall a. Maybe a
Nothing

_PromotedNilT :: Prism' Type ()
_PromotedNilT :: Prism' Type ()
_PromotedNilT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism' Type ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
PromotedNilT
      remitter :: Type -> Maybe ()
remitter Type
PromotedNilT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing

_PromotedConsT :: Prism' Type ()
_PromotedConsT :: Prism' Type ()
_PromotedConsT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism' Type ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
PromotedConsT
      remitter :: Type -> Maybe ()
remitter Type
PromotedConsT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing

_StarT :: Prism' Type ()
_StarT :: Prism' Type ()
_StarT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism' Type ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
StarT
      remitter :: Type -> Maybe ()
remitter Type
StarT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing

_ConstraintT :: Prism' Type ()
_ConstraintT :: Prism' Type ()
_ConstraintT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism' Type ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
ConstraintT
      remitter :: Type -> Maybe ()
remitter Type
ConstraintT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing

_LitT :: Prism' Type TyLit
_LitT :: Prism' Type TyLit
_LitT
  = (TyLit -> Type) -> (Type -> Maybe TyLit) -> Prism' Type TyLit
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' TyLit -> Type
reviewer Type -> Maybe TyLit
remitter
  where
      reviewer :: TyLit -> Type
reviewer = TyLit -> Type
LitT
      remitter :: Type -> Maybe TyLit
remitter (LitT TyLit
x) = TyLit -> Maybe TyLit
forall a. a -> Maybe a
Just TyLit
x
      remitter Type
_ = Maybe TyLit
forall a. Maybe a
Nothing

_InfixT :: Prism' Type (Type, Name, Type)
_InfixT :: Prism' Type (Type, Name, Type)
_InfixT
  = ((Type, Name, Type) -> Type)
-> (Type -> Maybe (Type, Name, Type))
-> Prism' Type (Type, Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Type, Name, Type) -> Type
reviewer Type -> Maybe (Type, Name, Type)
remitter
  where
      reviewer :: (Type, Name, Type) -> Type
reviewer (Type
x, Name
y, Type
z) = Type -> Name -> Type -> Type
InfixT Type
x Name
y Type
z
      remitter :: Type -> Maybe (Type, Name, Type)
remitter (InfixT Type
x Name
y Type
z) = (Type, Name, Type) -> Maybe (Type, Name, Type)
forall a. a -> Maybe a
Just (Type
x, Name
y, Type
z)
      remitter Type
_ = Maybe (Type, Name, Type)
forall a. Maybe a
Nothing

_UInfixT :: Prism' Type (Type, Name, Type)
_UInfixT :: Prism' Type (Type, Name, Type)
_UInfixT
  = ((Type, Name, Type) -> Type)
-> (Type -> Maybe (Type, Name, Type))
-> Prism' Type (Type, Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Type, Name, Type) -> Type
reviewer Type -> Maybe (Type, Name, Type)
remitter
  where
      reviewer :: (Type, Name, Type) -> Type
reviewer (Type
x, Name
y, Type
z) = Type -> Name -> Type -> Type
UInfixT Type
x Name
y Type
z
      remitter :: Type -> Maybe (Type, Name, Type)
remitter (UInfixT Type
x Name
y Type
z) = (Type, Name, Type) -> Maybe (Type, Name, Type)
forall a. a -> Maybe a
Just (Type
x, Name
y, Type
z)
      remitter Type
_ = Maybe (Type, Name, Type)
forall a. Maybe a
Nothing

_ParensT :: Prism' Type Type
_ParensT :: Prism' Type Type
_ParensT
  = (Type -> Type) -> (Type -> Maybe Type) -> Prism' Type Type
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Type -> Type
reviewer Type -> Maybe Type
remitter
  where
      reviewer :: Type -> Type
reviewer = Type -> Type
ParensT
      remitter :: Type -> Maybe Type
remitter (ParensT Type
x) = Type -> Maybe Type
forall a. a -> Maybe a
Just Type
x
      remitter Type
_ = Maybe Type
forall a. Maybe a
Nothing

_WildCardT :: Prism' Type ()
_WildCardT :: Prism' Type ()
_WildCardT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism' Type ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
WildCardT
      remitter :: Type -> Maybe ()
remitter Type
WildCardT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,15,0)
_AppKindT :: Prism' Type (Type, Kind)
_AppKindT :: Prism' Type (Type, Type)
_AppKindT
  = ((Type, Type) -> Type)
-> (Type -> Maybe (Type, Type)) -> Prism' Type (Type, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Type, Type) -> Type
reviewer Type -> Maybe (Type, Type)
remitter
  where
      reviewer :: (Type, Type) -> Type
reviewer (Type
x, Type
y) = Type -> Type -> Type
AppKindT Type
x Type
y
      remitter :: Type -> Maybe (Type, Type)
remitter (AppKindT Type
x Type
y) = (Type, Type) -> Maybe (Type, Type)
forall a. a -> Maybe a
Just (Type
x, Type
y)
      remitter Type
_ = Maybe (Type, Type)
forall a. Maybe a
Nothing

_ImplicitParamT :: Prism' Type (String, Type)
_ImplicitParamT :: Prism' Type ([Char], Type)
_ImplicitParamT
  = (([Char], Type) -> Type)
-> (Type -> Maybe ([Char], Type)) -> Prism' Type ([Char], Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([Char], Type) -> Type
reviewer Type -> Maybe ([Char], Type)
remitter
  where
      reviewer :: ([Char], Type) -> Type
reviewer ([Char]
x, Type
y) = [Char] -> Type -> Type
ImplicitParamT [Char]
x Type
y
      remitter :: Type -> Maybe ([Char], Type)
remitter (ImplicitParamT [Char]
x Type
y) = ([Char], Type) -> Maybe ([Char], Type)
forall a. a -> Maybe a
Just ([Char]
x, Type
y)
      remitter Type
_ = Maybe ([Char], Type)
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,16,0)
_ForallVisT :: Prism' Type ([TyVarBndrUnit], Type)
_ForallVisT :: Prism' Type ([TyVarBndr ()], Type)
_ForallVisT
  = (([TyVarBndr ()], Type) -> Type)
-> (Type -> Maybe ([TyVarBndr ()], Type))
-> Prism' Type ([TyVarBndr ()], Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ([TyVarBndr ()], Type) -> Type
reviewer Type -> Maybe ([TyVarBndr ()], Type)
remitter
  where
      reviewer :: ([TyVarBndr ()], Type) -> Type
reviewer ([TyVarBndr ()]
x, Type
y) = [TyVarBndr ()] -> Type -> Type
ForallVisT [TyVarBndr ()]
x Type
y
      remitter :: Type -> Maybe ([TyVarBndr ()], Type)
remitter (ForallVisT [TyVarBndr ()]
x Type
y) = ([TyVarBndr ()], Type) -> Maybe ([TyVarBndr ()], Type)
forall a. a -> Maybe a
Just ([TyVarBndr ()]
x, Type
y)
      remitter Type
_ = Maybe ([TyVarBndr ()], Type)
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,17,0)
_MulArrowT :: Prism' Type ()
_MulArrowT :: Prism' Type ()
_MulArrowT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism' Type ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
MulArrowT
      remitter :: Type -> Maybe ()
remitter Type
MulArrowT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,19,0)
_PromotedInfixT :: Prism' Type (Type, Name, Type)
_PromotedInfixT :: Prism' Type (Type, Name, Type)
_PromotedInfixT
  = ((Type, Name, Type) -> Type)
-> (Type -> Maybe (Type, Name, Type))
-> Prism' Type (Type, Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Type, Name, Type) -> Type
reviewer Type -> Maybe (Type, Name, Type)
remitter
  where
      reviewer :: (Type, Name, Type) -> Type
reviewer (Type
x, Name
y, Type
z) = Type -> Name -> Type -> Type
PromotedInfixT Type
x Name
y Type
z
      remitter :: Type -> Maybe (Type, Name, Type)
remitter (PromotedInfixT Type
x Name
y Type
z) = (Type, Name, Type) -> Maybe (Type, Name, Type)
forall a. a -> Maybe a
Just (Type
x, Name
y, Type
z)
      remitter Type
_ = Maybe (Type, Name, Type)
forall a. Maybe a
Nothing

_PromotedUInfixT :: Prism' Type (Type, Name, Type)
_PromotedUInfixT :: Prism' Type (Type, Name, Type)
_PromotedUInfixT
  = ((Type, Name, Type) -> Type)
-> (Type -> Maybe (Type, Name, Type))
-> Prism' Type (Type, Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Type, Name, Type) -> Type
reviewer Type -> Maybe (Type, Name, Type)
remitter
  where
      reviewer :: (Type, Name, Type) -> Type
reviewer (Type
x, Name
y, Type
z) = Type -> Name -> Type -> Type
PromotedUInfixT Type
x Name
y Type
z
      remitter :: Type -> Maybe (Type, Name, Type)
remitter (PromotedUInfixT Type
x Name
y Type
z) = (Type, Name, Type) -> Maybe (Type, Name, Type)
forall a. a -> Maybe a
Just (Type
x, Name
y, Type
z)
      remitter Type
_ = Maybe (Type, Name, Type)
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,17,0)
_SpecifiedSpec :: Prism' Specificity ()
_SpecifiedSpec :: Prism' Specificity ()
_SpecifiedSpec
  = (() -> Specificity)
-> (Specificity -> Maybe ()) -> Prism' Specificity ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Specificity
reviewer Specificity -> Maybe ()
remitter
  where
      reviewer :: () -> Specificity
reviewer () = Specificity
SpecifiedSpec
      remitter :: Specificity -> Maybe ()
remitter Specificity
SpecifiedSpec = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Specificity
_ = Maybe ()
forall a. Maybe a
Nothing

_InferredSpec :: Prism' Specificity ()
_InferredSpec :: Prism' Specificity ()
_InferredSpec
  = (() -> Specificity)
-> (Specificity -> Maybe ()) -> Prism' Specificity ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Specificity
reviewer Specificity -> Maybe ()
remitter
  where
      reviewer :: () -> Specificity
reviewer () = Specificity
InferredSpec
      remitter :: Specificity -> Maybe ()
remitter Specificity
InferredSpec = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Specificity
_ = Maybe ()
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,21,0)
_BndrReq :: Prism' BndrVis ()
_BndrReq :: Prism' BndrVis ()
_BndrReq
  = (() -> BndrVis) -> (BndrVis -> Maybe ()) -> Prism' BndrVis ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> BndrVis
reviewer BndrVis -> Maybe ()
remitter
  where
      reviewer :: () -> BndrVis
reviewer () = BndrVis
BndrReq
      remitter :: BndrVis -> Maybe ()
remitter BndrVis
BndrReq = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter BndrVis
_ = Maybe ()
forall a. Maybe a
Nothing

_BndrInvis :: Prism' BndrVis ()
_BndrInvis :: Prism' BndrVis ()
_BndrInvis
  = (() -> BndrVis) -> (BndrVis -> Maybe ()) -> Prism' BndrVis ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> BndrVis
reviewer BndrVis -> Maybe ()
remitter
  where
      reviewer :: () -> BndrVis
reviewer () = BndrVis
BndrInvis
      remitter :: BndrVis -> Maybe ()
remitter BndrVis
BndrInvis = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter BndrVis
_ = Maybe ()
forall a. Maybe a
Nothing
#endif

-- |
-- @
-- _PlainTV :: 'Prism'' ('TyVarBndr' flag) ('Name', flag) -- template-haskell-2.17+
-- _PlainTV :: 'Prism''  'TyVarBndr'        'Name'        -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,17,0)
_PlainTV :: Prism' (TyVarBndr flag) (Name, flag)
_PlainTV :: forall flag (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p (Name, flag) (f (Name, flag))
-> p (TyVarBndr flag) (f (TyVarBndr flag))
_PlainTV
  = ((Name, flag) -> TyVarBndr flag)
-> (TyVarBndr flag -> Maybe (Name, flag))
-> Prism
     (TyVarBndr flag) (TyVarBndr flag) (Name, flag) (Name, flag)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, flag) -> TyVarBndr flag
forall {flag}. (Name, flag) -> TyVarBndr flag
reviewer TyVarBndr flag -> Maybe (Name, flag)
forall {b}. TyVarBndr b -> Maybe (Name, b)
remitter
  where
      reviewer :: (Name, flag) -> TyVarBndr flag
reviewer (Name
x, flag
y) = Name -> flag -> TyVarBndr flag
forall flag. Name -> flag -> TyVarBndr flag
PlainTV Name
x flag
y
      remitter :: TyVarBndr b -> Maybe (Name, b)
remitter (PlainTV Name
x b
y) = (Name, b) -> Maybe (Name, b)
forall a. a -> Maybe a
Just (Name
x, b
y)
      remitter TyVarBndr b
_ = Maybe (Name, b)
forall a. Maybe a
Nothing
#else
_PlainTV :: Prism' TyVarBndr Name
_PlainTV
  = prism' reviewer remitter
  where
      reviewer = PlainTV
      remitter (PlainTV x) = Just x
      remitter _ = Nothing
#endif

-- |
-- @
-- _KindedTV :: 'Prism'' ('TyVarBndr' flag) ('Name', flag, 'Kind') -- template-haskell-2.17+
-- _KindedTV :: 'Prism''  'TyVarBndr'       ('Name',       'Kind') -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,17,0)
_KindedTV :: Prism' (TyVarBndr flag) (Name, flag, Kind)
_KindedTV :: forall flag (p :: * -> * -> *) (f :: * -> *).
(Choice p, Applicative f) =>
p (Name, flag, Type) (f (Name, flag, Type))
-> p (TyVarBndr flag) (f (TyVarBndr flag))
_KindedTV
  = ((Name, flag, Type) -> TyVarBndr flag)
-> (TyVarBndr flag -> Maybe (Name, flag, Type))
-> Prism
     (TyVarBndr flag)
     (TyVarBndr flag)
     (Name, flag, Type)
     (Name, flag, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, flag, Type) -> TyVarBndr flag
forall {flag}. (Name, flag, Type) -> TyVarBndr flag
reviewer TyVarBndr flag -> Maybe (Name, flag, Type)
forall {b}. TyVarBndr b -> Maybe (Name, b, Type)
remitter
  where
      reviewer :: (Name, flag, Type) -> TyVarBndr flag
reviewer (Name
x, flag
y, Type
z) = Name -> flag -> Type -> TyVarBndr flag
forall flag. Name -> flag -> Type -> TyVarBndr flag
KindedTV Name
x flag
y Type
z
      remitter :: TyVarBndr b -> Maybe (Name, b, Type)
remitter (KindedTV Name
x b
y Type
z) = (Name, b, Type) -> Maybe (Name, b, Type)
forall a. a -> Maybe a
Just (Name
x, b
y, Type
z)
      remitter TyVarBndr b
_ = Maybe (Name, b, Type)
forall a. Maybe a
Nothing
#else
_KindedTV :: Prism' TyVarBndr (Name, Kind)
_KindedTV
  = prism' reviewer remitter
  where
      reviewer (x, y) = KindedTV x y
      remitter (KindedTV x y) = Just (x, y)
      remitter _ = Nothing
#endif

_NoSig :: Prism' FamilyResultSig ()
_NoSig :: Prism' FamilyResultSig ()
_NoSig
  = (() -> FamilyResultSig)
-> (FamilyResultSig -> Maybe ()) -> Prism' FamilyResultSig ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> FamilyResultSig
reviewer FamilyResultSig -> Maybe ()
remitter
  where
      reviewer :: () -> FamilyResultSig
reviewer () = FamilyResultSig
NoSig
      remitter :: FamilyResultSig -> Maybe ()
remitter FamilyResultSig
NoSig = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter FamilyResultSig
_ = Maybe ()
forall a. Maybe a
Nothing

_KindSig :: Prism' FamilyResultSig Kind
_KindSig :: Prism' FamilyResultSig Type
_KindSig
  = (Type -> FamilyResultSig)
-> (FamilyResultSig -> Maybe Type) -> Prism' FamilyResultSig Type
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Type -> FamilyResultSig
reviewer FamilyResultSig -> Maybe Type
remitter
  where
      reviewer :: Type -> FamilyResultSig
reviewer = Type -> FamilyResultSig
KindSig
      remitter :: FamilyResultSig -> Maybe Type
remitter (KindSig Type
x) = Type -> Maybe Type
forall a. a -> Maybe a
Just Type
x
      remitter FamilyResultSig
_ = Maybe Type
forall a. Maybe a
Nothing

_TyVarSig :: Prism' FamilyResultSig TyVarBndrUnit
_TyVarSig :: Prism' FamilyResultSig (TyVarBndr ())
_TyVarSig
  = (TyVarBndr () -> FamilyResultSig)
-> (FamilyResultSig -> Maybe (TyVarBndr ()))
-> Prism' FamilyResultSig (TyVarBndr ())
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' TyVarBndr () -> FamilyResultSig
reviewer FamilyResultSig -> Maybe (TyVarBndr ())
remitter
  where
      reviewer :: TyVarBndr () -> FamilyResultSig
reviewer = TyVarBndr () -> FamilyResultSig
TyVarSig
      remitter :: FamilyResultSig -> Maybe (TyVarBndr ())
remitter (TyVarSig TyVarBndr ()
x) = TyVarBndr () -> Maybe (TyVarBndr ())
forall a. a -> Maybe a
Just TyVarBndr ()
x
      remitter FamilyResultSig
_ = Maybe (TyVarBndr ())
forall a. Maybe a
Nothing

_NumTyLit :: Prism' TyLit Integer
_NumTyLit :: Prism' TyLit Integer
_NumTyLit
  = (Integer -> TyLit)
-> (TyLit -> Maybe Integer) -> Prism' TyLit Integer
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Integer -> TyLit
reviewer TyLit -> Maybe Integer
remitter
  where
      reviewer :: Integer -> TyLit
reviewer = Integer -> TyLit
NumTyLit
      remitter :: TyLit -> Maybe Integer
remitter (NumTyLit Integer
x) = Integer -> Maybe Integer
forall a. a -> Maybe a
Just Integer
x
      remitter TyLit
_ = Maybe Integer
forall a. Maybe a
Nothing

_StrTyLit :: Prism' TyLit String
_StrTyLit :: Prism' TyLit [Char]
_StrTyLit
  = ([Char] -> TyLit) -> (TyLit -> Maybe [Char]) -> Prism' TyLit [Char]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Char] -> TyLit
reviewer TyLit -> Maybe [Char]
remitter
  where
      reviewer :: [Char] -> TyLit
reviewer = [Char] -> TyLit
StrTyLit
      remitter :: TyLit -> Maybe [Char]
remitter (StrTyLit [Char]
x) = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
x
      remitter TyLit
_ = Maybe [Char]
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,18,0)
_CharTyLit :: Prism' TyLit Char
_CharTyLit :: Prism' TyLit Char
_CharTyLit
  = (Char -> TyLit) -> (TyLit -> Maybe Char) -> Prism' TyLit Char
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Char -> TyLit
reviewer TyLit -> Maybe Char
remitter
  where
      reviewer :: Char -> TyLit
reviewer = Char -> TyLit
CharTyLit
      remitter :: TyLit -> Maybe Char
remitter (CharTyLit Char
x) = Char -> Maybe Char
forall a. a -> Maybe a
Just Char
x
      remitter TyLit
_ = Maybe Char
forall a. Maybe a
Nothing
#endif

_NominalR :: Prism' Role ()
_NominalR :: Prism' Role ()
_NominalR
  = (() -> Role) -> (Role -> Maybe ()) -> Prism' Role ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Role
reviewer Role -> Maybe ()
remitter
  where
      reviewer :: () -> Role
reviewer () = Role
NominalR
      remitter :: Role -> Maybe ()
remitter Role
NominalR = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Role
_ = Maybe ()
forall a. Maybe a
Nothing

_RepresentationalR :: Prism' Role ()
_RepresentationalR :: Prism' Role ()
_RepresentationalR
  = (() -> Role) -> (Role -> Maybe ()) -> Prism' Role ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Role
reviewer Role -> Maybe ()
remitter
  where
      reviewer :: () -> Role
reviewer () = Role
RepresentationalR
      remitter :: Role -> Maybe ()
remitter Role
RepresentationalR = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Role
_ = Maybe ()
forall a. Maybe a
Nothing

_PhantomR :: Prism' Role ()
_PhantomR :: Prism' Role ()
_PhantomR
  = (() -> Role) -> (Role -> Maybe ()) -> Prism' Role ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Role
reviewer Role -> Maybe ()
remitter
  where
      reviewer :: () -> Role
reviewer () = Role
PhantomR
      remitter :: Role -> Maybe ()
remitter Role
PhantomR = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Role
_ = Maybe ()
forall a. Maybe a
Nothing

_InferR :: Prism' Role ()
_InferR :: Prism' Role ()
_InferR
  = (() -> Role) -> (Role -> Maybe ()) -> Prism' Role ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Role
reviewer Role -> Maybe ()
remitter
  where
      reviewer :: () -> Role
reviewer () = Role
InferR
      remitter :: Role -> Maybe ()
remitter Role
InferR = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Role
_ = Maybe ()
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_StockStrategy :: Prism' DerivStrategy ()
_StockStrategy :: Prism' DerivStrategy ()
_StockStrategy
  = (() -> DerivStrategy)
-> (DerivStrategy -> Maybe ()) -> Prism' DerivStrategy ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> DerivStrategy
reviewer DerivStrategy -> Maybe ()
remitter
  where
      reviewer :: () -> DerivStrategy
reviewer () = DerivStrategy
StockStrategy
      remitter :: DerivStrategy -> Maybe ()
remitter DerivStrategy
StockStrategy = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter DerivStrategy
_ = Maybe ()
forall a. Maybe a
Nothing

_AnyclassStrategy :: Prism' DerivStrategy ()
_AnyclassStrategy :: Prism' DerivStrategy ()
_AnyclassStrategy
  = (() -> DerivStrategy)
-> (DerivStrategy -> Maybe ()) -> Prism' DerivStrategy ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> DerivStrategy
reviewer DerivStrategy -> Maybe ()
remitter
  where
      reviewer :: () -> DerivStrategy
reviewer () = DerivStrategy
AnyclassStrategy
      remitter :: DerivStrategy -> Maybe ()
remitter DerivStrategy
AnyclassStrategy = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter DerivStrategy
_ = Maybe ()
forall a. Maybe a
Nothing

_NewtypeStrategy :: Prism' DerivStrategy ()
_NewtypeStrategy :: Prism' DerivStrategy ()
_NewtypeStrategy
  = (() -> DerivStrategy)
-> (DerivStrategy -> Maybe ()) -> Prism' DerivStrategy ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> DerivStrategy
reviewer DerivStrategy -> Maybe ()
remitter
  where
      reviewer :: () -> DerivStrategy
reviewer () = DerivStrategy
NewtypeStrategy
      remitter :: DerivStrategy -> Maybe ()
remitter DerivStrategy
NewtypeStrategy = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter DerivStrategy
_ = Maybe ()
forall a. Maybe a
Nothing
#endif