{-# 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 = forall (f :: * -> *) flag.
Functor f =>
(Name -> f Name) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
traverseTVName

instance HasName Name where
  name :: Lens' Name Name
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) 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) 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) 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasName t => Lens' t 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) 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) 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
    [] -> 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) 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) 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 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) 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 ()]
tvbs FamilyResultSig
frs Maybe InjectivityAnn
mia) =
    (\Name
n' -> Name
-> [TyVarBndr ()]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n' [TyVarBndr ()]
tvbs FamilyResultSig
frs Maybe InjectivityAnn
mia) 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) 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 = 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (forall s t a b. Field2 s t a b => Lens s t a b
_2 (forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f)) [BangType]
t
  types Type -> f Type
f (RecC Name
n [VarBangType]
t)         = Name -> [VarBangType] -> Con
RecC Name
n forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (forall s t a b. Field3 s t a b => Lens s t a b
_3 (forall t. HasTypes t => Traversal' t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall s t a b. Field2 s t a b => Lens s t a b
_2 (forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f) BangType
t1
                                       forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall s t a b. Field2 s t a b => Lens s t a b
_2 (forall t. HasTypes t => Traversal' t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypes t => Traversal' t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (forall s t a b. Field2 s t a b => Lens s t a b
_2 (forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f)) [BangType]
argTys forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. HasTypes t => Traversal' t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (forall s t a b. Field3 s t a b => Lens s t a b
_3 (forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f)) [VarBangType]
argTys forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. HasTypes t => Traversal' t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypes t => Traversal' t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypes t => Traversal' t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall {flag}. TyVarBndr_ flag -> f (TyVarBndr_ flag)
go) Maybe [TyVarBndr ()]
mtvbs
                                              forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f Type
lhs
                                              forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f Type
rhs
    where
      go :: TyVarBndr_ flag -> f (TyVarBndr_ flag)
go = 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 = forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall t. HasTypes t => 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
sforall s a. s -> Getting a s a -> a
^.forall m. Contains m => Index m -> Lens' m Bool
contains (TyVarBndr_ flag
bforall s a. s -> Getting a s a -> a
^.forall t. HasName t => Lens' t Name
name) = forall (f :: * -> *) a. Applicative f => a -> f a
pure TyVarBndr_ flag
b
    | Bool
otherwise             = forall t. HasName t => Lens' t 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
sforall s a. s -> Getting a s a -> a
^.forall m. Contains m => Index m -> Lens' m Bool
contains Name
n = 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
l forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s' Name -> f Name
f Cxt
ctx forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 forall a. Ord a => Set a -> Set a -> Set a
`Set.union` forall a s. Getting (Set a) s a -> s -> Set a
setOf forall t. HasTypeVars t => Traversal' t Name
typeVars [TyVarBndr Specificity]
bs
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@ConT{}             = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@TupleT{}           = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@ListT{}            = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@ArrowT{}           = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@UnboxedTupleT{}    = 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t
                                             forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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{}        = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@PromotedTupleT{}   = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@PromotedNilT{}     = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@PromotedConsT{}    = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@StarT{}            = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@ConstraintT{}      = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@LitT{}             = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@EqualityT{}        = 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  forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t1
                                                forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n
                                                forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t1
                                                forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n
                                                forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> 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{}        = 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{}      = 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f Type
t
                                                 forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> 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 forall a. Ord a => Set a -> Set a -> Set a
`Set.union` forall a s. Getting (Set a) s a -> s -> Set a
setOf forall t. HasTypeVars t => Traversal' t Name
typeVars [TyVarBndr ()]
bs
#endif
#if MIN_VERSION_template_haskell(2,17,0)
  typeVarsEx Set Name
_ Name -> f Name
_ t :: Type
t@MulArrowT{}        = forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
t
#endif
#if MIN_VERSION_template_haskell(2,19,0)
  typeVarsEx s f (PromotedInfixT  t1 n t2) = PromotedInfixT  <$> typeVarsEx s f t1
                                                             <*> pure n
                                                             <*> typeVarsEx s f t2
  typeVarsEx s f (PromotedUInfixT t1 n t2) = PromotedUInfixT <$> typeVarsEx s f t1
                                                             <*> pure n
                                                             <*> typeVarsEx s f 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s t a b. Field2 s t a b => Lens s t a b
_2) (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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s t a b. Field3 s t a b => Lens s t a b
_3) (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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall {a} {a}. HasTypeVars a => (a, a) -> f (a, a)
g BangType
l forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s' Name -> f Name
f Cxt
ctx forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 forall a. Ord a => Set a -> Set a -> Set a
`Set.union` forall a s. Getting (Set a) s a -> s -> Set a
setOf forall t. HasTypeVars t => Traversal' t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s t a b. Field2 s t a b => Lens s t a b
_2) (forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f) [BangType]
argTys
             forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s t a b. Field3 s t a b => Lens s t a b
_3) (forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx Set Name
s Name -> f Name
f) [VarBangType]
argTys
                forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 = forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 = forall t. HasTypeVars t => Set Name -> Traversal' t Name
typeVarsEx 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 = forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over forall t. HasTypeVars t => Traversal' t Name
typeVars forall a b. (a -> b) -> a -> b
$ \Name
n -> forall a. a -> Maybe a -> a
fromMaybe Name
n (Map Name Name
mforall s a. s -> Getting a s a -> a
^.forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at 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)           = forall a. a -> Maybe a -> a
fromMaybe Type
t (Map Name Type
mforall s a. s -> Getting a s a -> a
^.forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Name
n)
  substType Map Name Type
m (ForallT [TyVarBndr Specificity]
bs Cxt
ctx Type
ty)  = [TyVarBndr Specificity] -> Cxt -> Type -> Type
ForallT [TyVarBndr Specificity]
bs (forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m' Cxt
ctx) (forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m' Type
ty)
    where m' :: Map Name Type
m' = forall r s a. Getting (Endo r) s a -> (a -> r -> r) -> r -> s -> r
foldrOf forall t. HasTypeVars t => Traversal' t Name
typeVars 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 (forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
l) (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 (forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t)
                                          (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  (forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t1) Name
n (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 (forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t1) Name
n (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 (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 (forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m Type
t) (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 (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 (forall t. SubstType t => Map Name Type -> t -> t
substType Map Name Type
m' Type
ty)
    where m' :: Map Name Type
m' = forall r s a. Getting (Endo r) s a -> (a -> r -> r) -> r -> s -> r
foldrOf forall t. HasTypeVars t => Traversal' t Name
typeVars 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 m (PromotedInfixT  t1 n t2) = PromotedInfixT  (substType m t1) n (substType m t2)
  substType m (PromotedUInfixT t1 n t2) = PromotedUInfixT (substType m t1) n (substType m t2)
#endif

instance SubstType t => SubstType [t] where
  substType :: Map Name Type -> [t] -> [t]
substType = forall a b. (a -> b) -> [a] -> [b]
map forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse BangType -> f BangType
f [BangType]
fs
conFields BangType -> f BangType
f (RecC Name
n [VarBangType]
fs)         = Name -> [VarBangType] -> Con
RecC Name
n forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BangType -> f BangType
f BangType
l forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse BangType -> f BangType
f [BangType]
argTys forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (Traversal' VarBangType BangType
sansVar BangType -> f BangType
f) [VarBangType]
argTys forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> 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')) 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{}      = forall (f :: * -> *) a. Applicative f => a -> f a
pure Con
c
conNamedFields VarBangType -> f VarBangType
_ c :: Con
c@InfixC{}       = 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Traversal' Con VarBangType
conNamedFields VarBangType -> f VarBangType
f Con
fs
conNamedFields VarBangType -> f VarBangType
_ c :: Con
c@GadtC{}        = 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 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse VarBangType -> f VarBangType
f [VarBangType]
argTys forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
retTy

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

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

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

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

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

funDepInputs :: Lens' FunDep [Name]
funDepInputs :: Lens' FunDep [Name]
funDepInputs = 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 = 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 = forall s t a b. Field1 s t a b => Lens s t a b
_1

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

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

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

matchPattern :: Lens' Match Pat
matchPattern :: Lens' Match Pat
matchPattern = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 ()]
_    FamilyResultSig
_  Maybe InjectivityAnn
_ )   = Name
n
  s :: TypeFamilyHead -> Name -> TypeFamilyHead
s (TypeFamilyHead Name
_ [TyVarBndr ()]
tvbs FamilyResultSig
rs Maybe InjectivityAnn
ia) Name
n = Name
-> [TyVarBndr ()]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n [TyVarBndr ()]
tvbs FamilyResultSig
rs Maybe InjectivityAnn
ia

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

typeFamilyHeadResultSig :: Lens' TypeFamilyHead FamilyResultSig
typeFamilyHeadResultSig :: Lens' TypeFamilyHead FamilyResultSig
typeFamilyHeadResultSig = 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 ()]
_    FamilyResultSig
rs Maybe InjectivityAnn
_ )    = FamilyResultSig
rs
  s :: TypeFamilyHead -> FamilyResultSig -> TypeFamilyHead
s (TypeFamilyHead Name
n [TyVarBndr ()]
tvbs FamilyResultSig
_  Maybe InjectivityAnn
ia) FamilyResultSig
rs = Name
-> [TyVarBndr ()]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n [TyVarBndr ()]
tvbs FamilyResultSig
rs Maybe InjectivityAnn
ia

typeFamilyHeadInjectivityAnn :: Lens' TypeFamilyHead (Maybe InjectivityAnn)
typeFamilyHeadInjectivityAnn :: Lens' TypeFamilyHead (Maybe InjectivityAnn)
typeFamilyHeadInjectivityAnn = 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 ()]
_    FamilyResultSig
_  Maybe InjectivityAnn
ia) = Maybe InjectivityAnn
ia
  s :: TypeFamilyHead -> Maybe InjectivityAnn -> TypeFamilyHead
s (TypeFamilyHead Name
n [TyVarBndr ()]
tvbs FamilyResultSig
rs Maybe InjectivityAnn
_ ) = Name
-> [TyVarBndr ()]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n [TyVarBndr ()]
tvbs FamilyResultSig
rs

bangSourceUnpackedness :: Lens' Bang SourceUnpackedness
bangSourceUnpackedness :: Lens' Bang SourceUnpackedness
bangSourceUnpackedness = 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 = 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 = 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 = 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
  = 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) = forall a. a -> Maybe a
Just (Dec
x, [Dec]
y)
      remitter Info
_ = forall a. Maybe a
Nothing

_ClassOpI :: Prism' Info (Name, Type, ParentName)
_ClassOpI :: Prism' Info (Name, Type, Name)
_ClassOpI
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y, Name
z)
      remitter Info
_ = forall a. Maybe a
Nothing

_TyConI :: Prism' Info Dec
_TyConI :: Prism' Info Dec
_TyConI
  = 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) = forall a. a -> Maybe a
Just Dec
x
      remitter Info
_ = forall a. Maybe a
Nothing

_FamilyI :: Prism' Info (Dec, [InstanceDec])
_FamilyI :: Prism' Info (Dec, [Dec])
_FamilyI
  = 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) = forall a. a -> Maybe a
Just (Dec
x, [Dec]
y)
      remitter Info
_ = forall a. Maybe a
Nothing

_PrimTyConI :: Prism' Info (Name, Arity, Unlifted)
_PrimTyConI :: Prism' Info (Name, Int, Bool)
_PrimTyConI
  = 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) = forall a. a -> Maybe a
Just (Name
x, Int
y, Bool
z)
      remitter Info
_ = forall a. Maybe a
Nothing

_DataConI :: Prism' Info (Name, Type, ParentName)
_DataConI :: Prism' Info (Name, Type, Name)
_DataConI
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y, Name
z)
      remitter Info
_ = forall a. Maybe a
Nothing

_VarI :: Prism' Info (Name, Type, Maybe Dec)
_VarI :: Prism' Info (Name, Type, Maybe Dec)
_VarI
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y, Maybe Dec
z)
      remitter Info
_ = forall a. Maybe a
Nothing

_TyVarI :: Prism' Info (Name, Type)
_TyVarI :: Prism' Info (Name, Type)
_TyVarI
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Info
_ = forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_PatSynI :: Prism' Info (Name, PatSynType)
_PatSynI :: Prism' Info (Name, Type)
_PatSynI
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Info
_ = forall a. Maybe a
Nothing
#endif

_FunD :: Prism' Dec (Name, [Clause])
_FunD :: Prism' Dec (Name, [Clause])
_FunD
  = 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) = forall a. a -> Maybe a
Just (Name
x,[Clause]
y)
      remitter Dec
_ = forall a. Maybe a
Nothing

_ValD :: Prism' Dec (Pat, Body, [Dec])
_ValD :: Prism' Dec (Pat, Body, [Dec])
_ValD
  = 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) = forall a. a -> Maybe a
Just (Pat
x, Body
y, [Dec]
z)
      remitter Dec
_ = forall a. Maybe a
Nothing

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

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

_InstanceD :: Prism' Dec (Maybe Overlap, Cxt, Type, [Dec])
_InstanceD :: Prism' Dec (Maybe Overlap, Cxt, Type, [Dec])
_InstanceD
  = 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) = forall a. a -> Maybe a
Just (Maybe Overlap
x, Cxt
y, Type
z, [Dec]
w)
      remitter Dec
_ = forall a. Maybe a
Nothing

_Overlappable  :: Prism' Overlap  ()
_Overlappable :: Prism' Overlap ()
_Overlappable  = 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 = forall a. a -> Maybe a
Just  ()
      remitter Overlap
_ = forall a. Maybe a
Nothing

_Overlapping :: Prism' Overlap ()
_Overlapping :: Prism' Overlap ()
_Overlapping = 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 = forall a. a -> Maybe a
Just ()
      remitter Overlap
_ = forall a. Maybe a
Nothing

_Overlaps ::  Prism' Overlap  ()
_Overlaps :: Prism' Overlap ()
_Overlaps =  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 = forall a. a -> Maybe a
Just ()
      remitter Overlap
_ = forall a. Maybe a
Nothing

_Incoherent  :: Prism' Overlap ()
_Incoherent :: Prism' Overlap ()
_Incoherent  = 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 = forall a. a -> Maybe a
Just ()
      remitter Overlap
_ = forall a. Maybe a
Nothing

_SigD :: Prism' Dec (Name, Type)
_SigD :: Prism' Dec (Name, Type)
_SigD
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Dec
_ = forall a. Maybe a
Nothing

_ForeignD :: Prism' Dec Foreign
_ForeignD :: Prism' Dec Foreign
_ForeignD
  = 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) = forall a. a -> Maybe a
Just Foreign
x
      remitter Dec
_ = forall a. Maybe a
Nothing

_InfixD :: Prism' Dec (Fixity, Name)
_InfixD :: Prism' Dec (Fixity, Name)
_InfixD
  = 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) = forall a. a -> Maybe a
Just (Fixity
x, Name
y)
      remitter Dec
_ = forall a. Maybe a
Nothing

_PragmaD :: Prism' Dec Pragma
_PragmaD :: Prism' Dec Pragma
_PragmaD
  = 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) = forall a. a -> Maybe a
Just Pragma
x
      remitter Dec
_ = 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
  = 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) = forall a. a -> Maybe a
Just TySynEqn
x
      remitter Dec
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Name
x, [Role]
y)
      remitter Dec
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Maybe DerivStrategy
x, Cxt
y, Type
z)
      remitter Dec
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Dec
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Cxt
x, Maybe [TyVarBndr ()]
y, Type
z, Maybe Type
w, [Con]
u, [DerivClause]
v)
      remitter Dec
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Cxt
x, Maybe [TyVarBndr ()]
y, Type
z, Maybe Type
w, Con
u, [DerivClause]
v)
      remitter Dec
_ = 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
  = 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) = forall a. a -> Maybe a
Just (TypeFamilyHead
x, [TySynEqn]
y)
      remitter Dec
_ = 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 ()] [Con]
_DataD
  = forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Name, [TyVarBndr ()], Maybe Type, [Con], [DerivClause])
-> Dec
reviewer Dec
-> Maybe
     (Cxt, Name, [TyVarBndr ()], Maybe Type, [Con], [DerivClause])
remitter
  where
      reviewer :: (Cxt, Name, [TyVarBndr ()], Maybe Type, [Con], [DerivClause])
-> Dec
reviewer (Cxt
x, Name
y, [TyVarBndr ()]
z, Maybe Type
w, [Con]
u, [DerivClause]
v) = Cxt
-> Name
-> [TyVarBndr ()]
-> Maybe Type
-> [Con]
-> [DerivClause]
-> Dec
DataD Cxt
x Name
y [TyVarBndr ()]
z Maybe Type
w [Con]
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Name, [TyVarBndr ()], Maybe Type, [Con], [DerivClause])
remitter (DataD Cxt
x Name
y [TyVarBndr ()]
z Maybe Type
w [Con]
u [DerivClause]
v) = forall a. a -> Maybe a
Just (Cxt
x, Name
y, [TyVarBndr ()]
z, Maybe Type
w, [Con]
u, [DerivClause]
v)
      remitter Dec
_ = 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 ()] Con
_NewtypeD
  = forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Name, [TyVarBndr ()], Maybe Type, Con, [DerivClause]) -> Dec
reviewer Dec
-> Maybe
     (Cxt, Name, [TyVarBndr ()], Maybe Type, Con, [DerivClause])
remitter
  where
      reviewer :: (Cxt, Name, [TyVarBndr ()], Maybe Type, Con, [DerivClause]) -> Dec
reviewer (Cxt
x, Name
y, [TyVarBndr ()]
z, Maybe Type
w, Con
u, [DerivClause]
v) = Cxt
-> Name
-> [TyVarBndr ()]
-> Maybe Type
-> Con
-> [DerivClause]
-> Dec
NewtypeD Cxt
x Name
y [TyVarBndr ()]
z Maybe Type
w Con
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Name, [TyVarBndr ()], Maybe Type, Con, [DerivClause])
remitter (NewtypeD Cxt
x Name
y [TyVarBndr ()]
z Maybe Type
w Con
u [DerivClause]
v) = forall a. a -> Maybe a
Just (Cxt
x, Name
y, [TyVarBndr ()]
z, Maybe Type
w, Con
u, [DerivClause]
v)
      remitter Dec
_ = forall a. Maybe a
Nothing

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

_OpenTypeFamilyD :: Prism' Dec TypeFamilyHead
_OpenTypeFamilyD :: Prism' Dec TypeFamilyHead
_OpenTypeFamilyD
  = 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) = forall a. a -> Maybe a
Just TypeFamilyHead
x
      remitter Dec
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Name
x, PatSynArgs
y, PatSynDir
z, Pat
w)
      remitter Dec
_ = forall a. Maybe a
Nothing

_PatSynSigD :: Prism' Dec (Name, PatSynType)
_PatSynSigD :: Prism' Dec (Name, Type)
_PatSynSigD
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Dec
_ = 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
  = 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) = forall a. a -> Maybe a
Just ([Char]
x, Exp
y)
      remitter Dec
_ = forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,19,0)
_DefaultD :: Prism' Dec [Type]
_DefaultD
  = prism' reviewer remitter
  where
      reviewer = DefaultD
      remitter (DefaultD x) = Just x
      remitter _ = Nothing
#endif

#if MIN_VERSION_template_haskell(2,20,0)
_TypeDataD :: Prism' Dec (Name, [TyVarBndrVis], Maybe Kind, [Con])
_TypeDataD
  = prism' reviewer remitter
  where
      reviewer (x, y, z, u) = TypeDataD x y z u
      remitter (TypeDataD x y z u) = Just (x, y, z, u)
      remitter _ = Nothing
#endif

#if MIN_VERSION_template_haskell(2,12,0)
_Unidir :: Prism' PatSynDir ()
_Unidir :: Prism' PatSynDir ()
_Unidir
  = 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 = forall a. a -> Maybe a
Just ()
      remitter PatSynDir
_ = forall a. Maybe a
Nothing

_ImplBidir :: Prism' PatSynDir ()
_ImplBidir :: Prism' PatSynDir ()
_ImplBidir
  = 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 = forall a. a -> Maybe a
Just ()
      remitter PatSynDir
_ = forall a. Maybe a
Nothing

_ExplBidir :: Prism' PatSynDir [Clause]
_ExplBidir :: Prism' PatSynDir [Clause]
_ExplBidir
  = 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) = forall a. a -> Maybe a
Just [Clause]
x
      remitter PatSynDir
_ = forall a. Maybe a
Nothing

_PrefixPatSyn :: Prism' PatSynArgs [Name]
_PrefixPatSyn :: Prism' PatSynArgs [Name]
_PrefixPatSyn
  = 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) = forall a. a -> Maybe a
Just [Name]
x
      remitter PatSynArgs
_ = forall a. Maybe a
Nothing

_InfixPatSyn :: Prism' PatSynArgs (Name, Name)
_InfixPatSyn :: Prism' PatSynArgs (Name, Name)
_InfixPatSyn
  = 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) = forall a. a -> Maybe a
Just (Name
x, Name
y)
      remitter PatSynArgs
_ = forall a. Maybe a
Nothing

_RecordPatSyn :: Prism' PatSynArgs [Name]
_RecordPatSyn :: Prism' PatSynArgs [Name]
_RecordPatSyn
  = 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) = forall a. a -> Maybe a
Just [Name]
x
      remitter PatSynArgs
_ = forall a. Maybe a
Nothing
#endif

_NormalC :: Prism' Con (Name, [BangType])
_NormalC :: Prism' Con (Name, [BangType])
_NormalC
  = 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) = forall a. a -> Maybe a
Just (Name
x, [BangType]
y)
      remitter Con
_ = forall a. Maybe a
Nothing

_RecC :: Prism' Con (Name, [VarBangType])
_RecC :: Prism' Con (Name, [VarBangType])
_RecC
  = 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) = forall a. a -> Maybe a
Just (Name
x, [VarBangType]
y)
      remitter Con
_ = forall a. Maybe a
Nothing

_InfixC :: Prism' Con (BangType, Name, BangType  )
_InfixC :: Prism' Con (BangType, Name, BangType)
_InfixC
  = 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) = forall a. a -> Maybe a
Just (BangType
x, Name
y, BangType
z)
      remitter Con
_ = forall a. Maybe a
Nothing

_ForallC :: Prism' Con ([TyVarBndrSpec], Cxt, Con)
_ForallC :: Prism' Con ([TyVarBndr Specificity], Cxt, Con)
_ForallC
  = 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) = forall a. a -> Maybe a
Just ([TyVarBndr Specificity]
x, Cxt
y, Con
z)
      remitter Con
_ = forall a. Maybe a
Nothing

_GadtC :: Prism' Con ([Name], [BangType], Type)
_GadtC :: Prism' Con ([Name], [BangType], Type)
_GadtC
  = 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) = forall a. a -> Maybe a
Just ([Name]
x, [BangType]
y, Type
z)
      remitter Con
_ = forall a. Maybe a
Nothing

_RecGadtC :: Prism' Con ([Name], [VarBangType], Type)
_RecGadtC :: Prism' Con ([Name], [VarBangType], Type)
_RecGadtC
  = 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) = forall a. a -> Maybe a
Just ([Name]
x, [VarBangType]
y, Type
z)
      remitter Con
_ = forall a. Maybe a
Nothing

_NoSourceUnpackedness :: Prism' SourceUnpackedness ()
_NoSourceUnpackedness :: Prism' SourceUnpackedness ()
_NoSourceUnpackedness
  = 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 = forall a. a -> Maybe a
Just ()
      remitter SourceUnpackedness
_ = forall a. Maybe a
Nothing

_SourceNoUnpack :: Prism' SourceUnpackedness ()
_SourceNoUnpack :: Prism' SourceUnpackedness ()
_SourceNoUnpack
  = 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 = forall a. a -> Maybe a
Just ()
      remitter SourceUnpackedness
_ = forall a. Maybe a
Nothing

_SourceUnpack :: Prism' SourceUnpackedness ()
_SourceUnpack :: Prism' SourceUnpackedness ()
_SourceUnpack
  = 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 = forall a. a -> Maybe a
Just ()
      remitter SourceUnpackedness
_ = forall a. Maybe a
Nothing

_NoSourceStrictness :: Prism' SourceStrictness ()
_NoSourceStrictness :: Prism' SourceStrictness ()
_NoSourceStrictness
  = 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 = forall a. a -> Maybe a
Just ()
      remitter SourceStrictness
_ = forall a. Maybe a
Nothing

_SourceLazy :: Prism' SourceStrictness ()
_SourceLazy :: Prism' SourceStrictness ()
_SourceLazy
  = 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 = forall a. a -> Maybe a
Just ()
      remitter SourceStrictness
_ = forall a. Maybe a
Nothing

_SourceStrict :: Prism' SourceStrictness ()
_SourceStrict :: Prism' SourceStrictness ()
_SourceStrict
  = 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 = forall a. a -> Maybe a
Just ()
      remitter SourceStrictness
_ = forall a. Maybe a
Nothing

_DecidedLazy :: Prism' DecidedStrictness ()
_DecidedLazy :: Prism' DecidedStrictness ()
_DecidedLazy
  = 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 = forall a. a -> Maybe a
Just ()
      remitter DecidedStrictness
_ = forall a. Maybe a
Nothing

_DecidedStrict :: Prism' DecidedStrictness ()
_DecidedStrict :: Prism' DecidedStrictness ()
_DecidedStrict
  = 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 = forall a. a -> Maybe a
Just ()
      remitter DecidedStrictness
_ = forall a. Maybe a
Nothing

_DecidedUnpack :: Prism' DecidedStrictness ()
_DecidedUnpack :: Prism' DecidedStrictness ()
_DecidedUnpack
  = 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 = forall a. a -> Maybe a
Just ()
      remitter DecidedStrictness
_ = forall a. Maybe a
Nothing

_ImportF :: Prism' Foreign (Callconv, Safety, String, Name, Type)
_ImportF :: Prism' Foreign (Callconv, Safety, [Char], Name, Type)
_ImportF
  = 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) = forall a. a -> Maybe a
Just (Callconv
x,Safety
y,[Char]
z,Name
w,Type
u)
      remitter Foreign
_ = forall a. Maybe a
Nothing

_ExportF :: Prism' Foreign (Callconv, String, Name, Type)
_ExportF :: Prism' Foreign (Callconv, [Char], Name, Type)
_ExportF
  = 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) = forall a. a -> Maybe a
Just (Callconv
x, [Char]
y, Name
z, Type
w)
      remitter Foreign
_ = forall a. Maybe a
Nothing

_CCall :: Prism' Callconv ()
_CCall :: Prism' Callconv ()
_CCall
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = forall a. Maybe a
Nothing

_StdCall :: Prism' Callconv ()
_StdCall :: Prism' Callconv ()
_StdCall
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = forall a. Maybe a
Nothing

_CApi :: Prism' Callconv ()
_CApi :: Prism' Callconv ()
_CApi
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = forall a. Maybe a
Nothing

_Prim :: Prism' Callconv ()
_Prim :: Prism' Callconv ()
_Prim
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = forall a. Maybe a
Nothing

_JavaScript :: Prism' Callconv ()
_JavaScript :: Prism' Callconv ()
_JavaScript
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = forall a. Maybe a
Nothing

_Unsafe :: Prism' Safety ()
_Unsafe :: Prism' Safety ()
_Unsafe
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Safety
_ = forall a. Maybe a
Nothing

_Safe :: Prism' Safety ()
_Safe :: Prism' Safety ()
_Safe
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Safety
_ = forall a. Maybe a
Nothing

_Interruptible :: Prism' Safety ()
_Interruptible :: Prism' Safety ()
_Interruptible
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Safety
_ = forall a. Maybe a
Nothing

_InlineP :: Prism' Pragma (Name, Inline, RuleMatch, Phases)
_InlineP :: Prism' Pragma (Name, Inline, RuleMatch, Phases)
_InlineP
  = 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) = forall a. a -> Maybe a
Just (Name
x, Inline
y, RuleMatch
z, Phases
w)
      remitter Pragma
_ = forall a. Maybe a
Nothing

_SpecialiseP :: Prism' Pragma (Name, Type, Maybe Inline, Phases)
_SpecialiseP :: Prism' Pragma (Name, Type, Maybe Inline, Phases)
_SpecialiseP
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y, Maybe Inline
z, Phases
w)
      remitter Pragma
_ = forall a. Maybe a
Nothing

-- TODO add lenses for InlineSpec

_SpecialiseInstP :: Prism' Pragma Type
_SpecialiseInstP :: Prism' Pragma Type
_SpecialiseInstP
  = 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) = forall a. a -> Maybe a
Just Type
x
      remitter Pragma
_ = 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
  = 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) = forall a. a -> Maybe a
Just ([Char]
x, Maybe [TyVarBndr ()]
y, [RuleBndr]
z, Exp
w, Exp
u, Phases
v)
      remitter Pragma
_ = 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
  = 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) = forall a. a -> Maybe a
Just (AnnTarget
x, Exp
y)
      remitter Pragma
_ = forall a. Maybe a
Nothing

_LineP :: Prism' Pragma (Int, String)
_LineP :: Prism' Pragma (Int, [Char])
_LineP
  = 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) = forall a. a -> Maybe a
Just (Int
x, [Char]
y)
      remitter Pragma
_ = 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
  = 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) = forall a. a -> Maybe a
Just ([Name]
x, Maybe Name
y)
      remitter Pragma
_ = forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,19,0)
_OpaqueP :: Prism' Pragma Name
_OpaqueP
  = prism' reviewer remitter
  where
      reviewer = OpaqueP
      remitter (OpaqueP x) = Just x
      remitter _ = Nothing
#endif

_NoInline :: Prism' Inline ()
_NoInline :: Prism' Inline ()
_NoInline
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Inline
_ = forall a. Maybe a
Nothing

_Inline :: Prism' Inline ()
_Inline :: Prism' Inline ()
_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 = forall a. a -> Maybe a
Just ()
      remitter Inline
_ = forall a. Maybe a
Nothing

_Inlinable :: Prism' Inline ()
_Inlinable :: Prism' Inline ()
_Inlinable
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Inline
_ = forall a. Maybe a
Nothing

_ConLike :: Prism' RuleMatch ()
_ConLike :: Prism' RuleMatch ()
_ConLike
  = 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 = forall a. a -> Maybe a
Just ()
      remitter RuleMatch
_ = forall a. Maybe a
Nothing

_FunLike :: Prism' RuleMatch ()
_FunLike :: Prism' RuleMatch ()
_FunLike
  = 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 = forall a. a -> Maybe a
Just ()
      remitter RuleMatch
_ = forall a. Maybe a
Nothing

_AllPhases :: Prism' Phases ()
_AllPhases :: Prism' Phases ()
_AllPhases
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Phases
_ = forall a. Maybe a
Nothing

_FromPhase :: Prism' Phases Int
_FromPhase :: Prism' Phases Int
_FromPhase
  = 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) = forall a. a -> Maybe a
Just Int
x
      remitter Phases
_ = forall a. Maybe a
Nothing

_BeforePhase :: Prism' Phases Int
_BeforePhase :: Prism' Phases Int
_BeforePhase
  = 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) = forall a. a -> Maybe a
Just Int
x
      remitter Phases
_ = forall a. Maybe a
Nothing

_RuleVar :: Prism' RuleBndr Name
_RuleVar :: Prism' RuleBndr Name
_RuleVar
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter RuleBndr
_ = forall a. Maybe a
Nothing

_TypedRuleVar :: Prism' RuleBndr (Name, Type)
_TypedRuleVar :: Prism' RuleBndr (Name, Type)
_TypedRuleVar
  = 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) = forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter RuleBndr
_ = forall a. Maybe a
Nothing

_ModuleAnnotation :: Prism' AnnTarget ()
_ModuleAnnotation :: Prism' AnnTarget ()
_ModuleAnnotation
  = 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 = forall a. a -> Maybe a
Just ()
      remitter AnnTarget
_ = forall a. Maybe a
Nothing

_TypeAnnotation :: Prism' AnnTarget Name
_TypeAnnotation :: Prism' AnnTarget Name
_TypeAnnotation
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter AnnTarget
_ = forall a. Maybe a
Nothing

_ValueAnnotation :: Prism' AnnTarget Name
_ValueAnnotation :: Prism' AnnTarget Name
_ValueAnnotation
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter AnnTarget
_ = forall a. Maybe a
Nothing

_FunDep :: Iso' FunDep ([Name], [Name])
_FunDep :: Iso' FunDep ([Name], [Name])
_FunDep
  = 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 = 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 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TySynEqn -> Cxt
g 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 (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 = 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
  = 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 = forall a. a -> Maybe a
Just ()
      remitter FixityDirection
_ = forall a. Maybe a
Nothing

_InfixR :: Prism' FixityDirection ()
_InfixR :: Prism' FixityDirection ()
_InfixR
  = 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 = forall a. a -> Maybe a
Just ()
      remitter FixityDirection
_ = forall a. Maybe a
Nothing

_InfixN :: Prism' FixityDirection ()
_InfixN :: Prism' FixityDirection ()
_InfixN
  = 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 = forall a. a -> Maybe a
Just ()
      remitter FixityDirection
_ = forall a. Maybe a
Nothing

_VarE :: Prism' Exp Name
_VarE :: Prism' Exp Name
_VarE
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter Exp
_ = forall a. Maybe a
Nothing

_ConE :: Prism' Exp Name
_ConE :: Prism' Exp Name
_ConE
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter Exp
_ = forall a. Maybe a
Nothing

_LitE :: Prism' Exp Lit
_LitE :: Prism' Exp Lit
_LitE
  = 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) = forall a. a -> Maybe a
Just Lit
x
      remitter Exp
_ = forall a. Maybe a
Nothing

_AppE :: Prism' Exp (Exp, Exp)
_AppE :: Prism' Exp (Exp, Exp)
_AppE
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Exp
y)
      remitter 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
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Type
y)
      remitter Exp
_ = forall a. Maybe a
Nothing
#endif

_InfixE :: Prism' Exp (Maybe Exp, Exp, Maybe Exp)
_InfixE :: Prism' Exp (Maybe Exp, Exp, Maybe Exp)
_InfixE
  = 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) = forall a. a -> Maybe a
Just (Maybe Exp
x, Exp
y, Maybe Exp
z)
      remitter Exp
_ = forall a. Maybe a
Nothing

_UInfixE :: Prism' Exp (Exp, Exp, Exp)
_UInfixE :: Prism' Exp (Exp, Exp, Exp)
_UInfixE
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Exp
y, Exp
z)
      remitter Exp
_ = forall a. Maybe a
Nothing

_ParensE :: Prism' Exp Exp
_ParensE :: Prism' Exp Exp
_ParensE
  = 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) = forall a. a -> Maybe a
Just Exp
x
      remitter Exp
_ = forall a. Maybe a
Nothing

_LamE :: Prism' Exp ([Pat], Exp)
_LamE :: Prism' Exp ([Pat], Exp)
_LamE
  = 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) = forall a. a -> Maybe a
Just ([Pat]
x, Exp
y)
      remitter Exp
_ = forall a. Maybe a
Nothing

_LamCaseE :: Prism' Exp [Match]
_LamCaseE :: Prism' Exp [Match]
_LamCaseE
  = 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) = forall a. a -> Maybe a
Just [Match]
x
      remitter Exp
_ = 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
  = 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) = forall a. a -> Maybe a
Just [Maybe Exp]
x
      remitter 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
  = 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) = forall a. a -> Maybe a
Just [Maybe Exp]
x
      remitter 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
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Int
y, Int
z)
      remitter Exp
_ = forall a. Maybe a
Nothing
#endif

_CondE :: Prism' Exp (Exp, Exp, Exp)
_CondE :: Prism' Exp (Exp, Exp, Exp)
_CondE
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Exp
y, Exp
z)
      remitter Exp
_ = forall a. Maybe a
Nothing

_MultiIfE :: Prism' Exp [(Guard, Exp)]
_MultiIfE :: Prism' Exp [(Guard, Exp)]
_MultiIfE
  = 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) = forall a. a -> Maybe a
Just [(Guard, Exp)]
x
      remitter Exp
_ = forall a. Maybe a
Nothing

_LetE :: Prism' Exp ([Dec], Exp)
_LetE :: Prism' Exp ([Dec], Exp)
_LetE
  = 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) = forall a. a -> Maybe a
Just ([Dec]
x, Exp
y)
      remitter Exp
_ = forall a. Maybe a
Nothing

_CaseE :: Prism' Exp (Exp, [Match])
_CaseE :: Prism' Exp (Exp, [Match])
_CaseE
  = 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) = forall a. a -> Maybe a
Just (Exp
x, [Match]
y)
      remitter Exp
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Maybe ModName
x, [Stmt]
y)
      remitter Exp
_ = 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
  = 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) = forall a. a -> Maybe a
Just [Stmt]
x
      remitter Exp
_ = forall a. Maybe a
Nothing

_ArithSeqE :: Prism' Exp Range
_ArithSeqE :: Prism' Exp Range
_ArithSeqE
  = 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) = forall a. a -> Maybe a
Just Range
x
      remitter Exp
_ = forall a. Maybe a
Nothing

_ListE :: Prism' Exp [Exp]
_ListE :: Prism' Exp [Exp]
_ListE
  = 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) = forall a. a -> Maybe a
Just [Exp]
x
      remitter Exp
_ = forall a. Maybe a
Nothing

_SigE :: Prism' Exp (Exp, Type)
_SigE :: Prism' Exp (Exp, Type)
_SigE
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Type
y)
      remitter Exp
_ = forall a. Maybe a
Nothing

_RecConE :: Prism' Exp (Name, [FieldExp])
_RecConE :: Prism' Exp (Name, [FieldExp])
_RecConE
  = 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) = forall a. a -> Maybe a
Just (Name
x, [FieldExp]
y)
      remitter Exp
_ = forall a. Maybe a
Nothing

_RecUpdE :: Prism' Exp (Exp, [FieldExp])
_RecUpdE :: Prism' Exp (Exp, [FieldExp])
_RecUpdE
  = 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) = forall a. a -> Maybe a
Just (Exp
x, [FieldExp]
y)
      remitter Exp
_ = forall a. Maybe a
Nothing

_StaticE :: Prism' Exp Exp
_StaticE :: Prism' Exp Exp
_StaticE
  = 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) = forall a. a -> Maybe a
Just Exp
x
      remitter Exp
_ = forall a. Maybe a
Nothing

_UnboundVarE :: Prism' Exp Name
_UnboundVarE :: Prism' Exp Name
_UnboundVarE
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter Exp
_ = forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,13,0)
_LabelE :: Prism' Exp String
_LabelE :: Prism' Exp [Char]
_LabelE
  = 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) = forall a. a -> Maybe a
Just [Char]
x
      remitter Exp
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Maybe ModName
x, [Stmt]
y)
      remitter Exp
_ = 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
  = 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) = forall a. a -> Maybe a
Just [Char]
x
      remitter Exp
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Exp
x, [Char]
y)
      remitter Exp
_ = forall a. Maybe a
Nothing

_ProjectionE :: Prism' Exp (NonEmpty String)
_ProjectionE :: Prism' Exp (NonEmpty [Char])
_ProjectionE
  = 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) = forall a. a -> Maybe a
Just NonEmpty [Char]
x
      remitter Exp
_ = forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,19,0)
_LamCasesE :: Prism' Exp [Clause]
_LamCasesE
  = prism' reviewer remitter
  where
      reviewer = LamCasesE
      remitter (LamCasesE x) = Just x
      remitter _ = Nothing
#endif

#if MIN_VERSION_template_haskell(2,21,0)
_TypedBracketE :: Prism' Exp Exp
_TypedBracketE
  = prism' reviewer remitter
  where
      reviewer = TypedBracketE
      remitter (TypedBracketE x) = Just x
      remitter _ = Nothing

_TypedSpliceE :: Prism' Exp Exp
_TypedSpliceE
  = prism' reviewer remitter
  where
      reviewer = TypedSpliceE
      remitter (TypedSpliceE x) = Just x
      remitter _ = Nothing
#endif

_GuardedB :: Prism' Body [(Guard, Exp)]
_GuardedB :: Prism' Body [(Guard, Exp)]
_GuardedB
  = 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) = forall a. a -> Maybe a
Just [(Guard, Exp)]
x
      remitter Body
_ = forall a. Maybe a
Nothing

_NormalB :: Prism' Body Exp
_NormalB :: Prism' Body Exp
_NormalB
  = 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) = forall a. a -> Maybe a
Just Exp
x
      remitter Body
_ = forall a. Maybe a
Nothing

_NormalG :: Prism' Guard Exp
_NormalG :: Prism' Guard Exp
_NormalG
  = 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) = forall a. a -> Maybe a
Just Exp
x
      remitter Guard
_ = forall a. Maybe a
Nothing

_PatG :: Prism' Guard [Stmt]
_PatG :: Prism' Guard [Stmt]
_PatG
  = 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) = forall a. a -> Maybe a
Just [Stmt]
x
      remitter Guard
_ = forall a. Maybe a
Nothing

_BindS :: Prism' Stmt (Pat, Exp)
_BindS :: Prism' Stmt (Pat, Exp)
_BindS
  = 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) = forall a. a -> Maybe a
Just (Pat
x, Exp
y)
      remitter Stmt
_ = forall a. Maybe a
Nothing

_LetS :: Prism' Stmt [Dec]
_LetS :: Prism' Stmt [Dec]
_LetS
  = 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) = forall a. a -> Maybe a
Just [Dec]
x
      remitter Stmt
_ = forall a. Maybe a
Nothing

_NoBindS :: Prism' Stmt Exp
_NoBindS :: Prism' Stmt Exp
_NoBindS
  = 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) = forall a. a -> Maybe a
Just Exp
x
      remitter Stmt
_ = forall a. Maybe a
Nothing

_ParS :: Prism' Stmt [[Stmt]]
_ParS :: Prism' Stmt [[Stmt]]
_ParS
  = 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) = forall a. a -> Maybe a
Just [[Stmt]]
x
      remitter Stmt
_ = forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,15,0)
_RecS :: Prism' Stmt [Stmt]
_RecS :: Prism' Stmt [Stmt]
_RecS
  = 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) = forall a. a -> Maybe a
Just [Stmt]
x
      remitter Stmt
_ = forall a. Maybe a
Nothing
#endif

_FromR :: Prism' Range Exp
_FromR :: Prism' Range Exp
_FromR
  = 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) = forall a. a -> Maybe a
Just Exp
x
      remitter Range
_ = forall a. Maybe a
Nothing

_FromThenR :: Prism' Range (Exp, Exp)
_FromThenR :: Prism' Range (Exp, Exp)
_FromThenR
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Exp
y)
      remitter Range
_ = forall a. Maybe a
Nothing

_FromToR :: Prism' Range (Exp, Exp)
_FromToR :: Prism' Range (Exp, Exp)
_FromToR
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Exp
y)
      remitter Range
_ = forall a. Maybe a
Nothing

_FromThenToR :: Prism' Range (Exp, Exp, Exp)
_FromThenToR :: Prism' Range (Exp, Exp, Exp)
_FromThenToR
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Exp
y, Exp
z)
      remitter Range
_ = forall a. Maybe a
Nothing

_CharL :: Prism' Lit Char
_CharL :: Prism' Lit Char
_CharL
  = 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) = forall a. a -> Maybe a
Just Char
x
      remitter Lit
_ = forall a. Maybe a
Nothing

_StringL :: Prism' Lit String
_StringL :: Prism' Lit [Char]
_StringL
  = 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) = forall a. a -> Maybe a
Just [Char]
x
      remitter Lit
_ = forall a. Maybe a
Nothing

_IntegerL :: Prism' Lit Integer
_IntegerL :: Prism' Lit Integer
_IntegerL
  = 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) = forall a. a -> Maybe a
Just Integer
x
      remitter Lit
_ = forall a. Maybe a
Nothing

_RationalL :: Prism' Lit Rational
_RationalL :: Prism' Lit Rational
_RationalL
  = 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) = forall a. a -> Maybe a
Just Rational
x
      remitter Lit
_ = forall a. Maybe a
Nothing

_IntPrimL :: Prism' Lit Integer
_IntPrimL :: Prism' Lit Integer
_IntPrimL
  = 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) = forall a. a -> Maybe a
Just Integer
x
      remitter Lit
_ = forall a. Maybe a
Nothing

_WordPrimL :: Prism' Lit Integer
_WordPrimL :: Prism' Lit Integer
_WordPrimL
  = 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) = forall a. a -> Maybe a
Just Integer
x
      remitter Lit
_ = forall a. Maybe a
Nothing

_FloatPrimL :: Prism' Lit Rational
_FloatPrimL :: Prism' Lit Rational
_FloatPrimL
  = 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) = forall a. a -> Maybe a
Just Rational
x
      remitter Lit
_ = forall a. Maybe a
Nothing

_DoublePrimL :: Prism' Lit Rational
_DoublePrimL :: Prism' Lit Rational
_DoublePrimL
  = 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) = forall a. a -> Maybe a
Just Rational
x
      remitter Lit
_ = forall a. Maybe a
Nothing

_StringPrimL :: Prism' Lit [Word8]
_StringPrimL :: Prism' Lit [Word8]
_StringPrimL
  = 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) = forall a. a -> Maybe a
Just [Word8]
x
      remitter Lit
_ = forall a. Maybe a
Nothing

_CharPrimL :: Prism' Lit Char
_CharPrimL :: Prism' Lit Char
_CharPrimL
  = 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) = forall a. a -> Maybe a
Just Char
x
      remitter Lit
_ = forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,16,0)
_BytesPrimL :: Prism' Lit Bytes
_BytesPrimL :: Prism' Lit Bytes
_BytesPrimL
  = 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) = forall a. a -> Maybe a
Just Bytes
x
      remitter Lit
_ = forall a. Maybe a
Nothing
#endif

_LitP :: Prism' Pat Lit
_LitP :: Prism' Pat Lit
_LitP
  = 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) = forall a. a -> Maybe a
Just Lit
x
      remitter Pat
_ = forall a. Maybe a
Nothing

_VarP :: Prism' Pat Name
_VarP :: Prism' Pat Name
_VarP
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter Pat
_ = forall a. Maybe a
Nothing

_TupP :: Prism' Pat [Pat]
_TupP :: Prism' Pat [Pat]
_TupP
  = 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) = forall a. a -> Maybe a
Just [Pat]
x
      remitter Pat
_ = forall a. Maybe a
Nothing

_UnboxedTupP :: Prism' Pat [Pat]
_UnboxedTupP :: Prism' Pat [Pat]
_UnboxedTupP
  = 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) = forall a. a -> Maybe a
Just [Pat]
x
      remitter 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
  = 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) = forall a. a -> Maybe a
Just (Pat
x, Int
y, Int
z)
      remitter Pat
_ = 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
  = 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) = forall a. a -> Maybe a
Just (Name
x, Cxt
y, [Pat]
z)
      remitter 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
  = 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) = forall a. a -> Maybe a
Just (Pat
x, Name
y, Pat
z)
      remitter Pat
_ = forall a. Maybe a
Nothing

_UInfixP :: Prism' Pat (Pat, Name, Pat)
_UInfixP :: Prism' Pat (Pat, Name, Pat)
_UInfixP
  = 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) = forall a. a -> Maybe a
Just (Pat
x, Name
y, Pat
z)
      remitter Pat
_ = forall a. Maybe a
Nothing

_ParensP :: Prism' Pat Pat
_ParensP :: Prism' Pat Pat
_ParensP
  = 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) = forall a. a -> Maybe a
Just Pat
x
      remitter Pat
_ = forall a. Maybe a
Nothing

_TildeP :: Prism' Pat Pat
_TildeP :: Prism' Pat Pat
_TildeP
  = 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) = forall a. a -> Maybe a
Just Pat
x
      remitter Pat
_ = forall a. Maybe a
Nothing

_BangP :: Prism' Pat Pat
_BangP :: Prism' Pat Pat
_BangP
  = 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) = forall a. a -> Maybe a
Just Pat
x
      remitter Pat
_ = forall a. Maybe a
Nothing

_AsP :: Prism' Pat (Name, Pat)
_AsP :: Prism' Pat FieldPat
_AsP
  = 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) = forall a. a -> Maybe a
Just (Name
x, Pat
y)
      remitter Pat
_ = forall a. Maybe a
Nothing

_WildP :: Prism' Pat ()
_WildP :: Prism' Pat ()
_WildP
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Pat
_ = forall a. Maybe a
Nothing

_RecP :: Prism' Pat (Name, [FieldPat])
_RecP :: Prism' Pat (Name, [FieldPat])
_RecP
  = 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) = forall a. a -> Maybe a
Just (Name
x, [FieldPat]
y)
      remitter Pat
_ = forall a. Maybe a
Nothing

_ListP :: Prism' Pat [Pat]
_ListP :: Prism' Pat [Pat]
_ListP
  = 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) = forall a. a -> Maybe a
Just [Pat]
x
      remitter Pat
_ = forall a. Maybe a
Nothing

_SigP :: Prism' Pat (Pat, Type)
_SigP :: Prism' Pat (Pat, Type)
_SigP
  = 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) = forall a. a -> Maybe a
Just (Pat
x, Type
y)
      remitter Pat
_ = forall a. Maybe a
Nothing

_ViewP :: Prism' Pat (Exp, Pat)
_ViewP :: Prism' Pat (Exp, Pat)
_ViewP
  = 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) = forall a. a -> Maybe a
Just (Exp
x, Pat
y)
      remitter Pat
_ = forall a. Maybe a
Nothing

_ForallT :: Prism' Type ([TyVarBndrSpec], Cxt, Type)
_ForallT :: Prism' Type ([TyVarBndr Specificity], Cxt, Type)
_ForallT
  = 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) = forall a. a -> Maybe a
Just ([TyVarBndr Specificity]
x, Cxt
y, Type
z)
      remitter Type
_ = forall a. Maybe a
Nothing

_AppT :: Prism' Type (Type, Type)
_AppT :: Prism' Type (Type, Type)
_AppT
  = 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) = forall a. a -> Maybe a
Just (Type
x, Type
y)
      remitter Type
_ = forall a. Maybe a
Nothing

_SigT :: Prism' Type (Type, Kind)
_SigT :: Prism' Type (Type, Type)
_SigT
  = 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) = forall a. a -> Maybe a
Just (Type
x, Type
y)
      remitter Type
_ = forall a. Maybe a
Nothing

_VarT :: Prism' Type Name
_VarT :: Prism' Type Name
_VarT
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter Type
_ = forall a. Maybe a
Nothing

_ConT :: Prism' Type Name
_ConT :: Prism' Type Name
_ConT
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter Type
_ = forall a. Maybe a
Nothing

_PromotedT :: Prism' Type Name
_PromotedT :: Prism' Type Name
_PromotedT
  = 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) = forall a. a -> Maybe a
Just Name
x
      remitter Type
_ = forall a. Maybe a
Nothing

_TupleT :: Prism' Type Int
_TupleT :: Prism' Type Int
_TupleT
  = 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) = forall a. a -> Maybe a
Just Int
x
      remitter Type
_ = forall a. Maybe a
Nothing

_UnboxedTupleT :: Prism' Type Int
_UnboxedTupleT :: Prism' Type Int
_UnboxedTupleT
  = 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) = forall a. a -> Maybe a
Just Int
x
      remitter Type
_ = forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_UnboxedSumT :: Prism' Type SumArity
_UnboxedSumT :: Prism' Type Int
_UnboxedSumT
  = 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) = forall a. a -> Maybe a
Just Int
x
      remitter Type
_ = forall a. Maybe a
Nothing
#endif

_ArrowT :: Prism' Type ()
_ArrowT :: Prism' Type ()
_ArrowT
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Type
_ = forall a. Maybe a
Nothing

_EqualityT :: Prism' Type ()
_EqualityT :: Prism' Type ()
_EqualityT
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Type
_ = forall a. Maybe a
Nothing

_ListT :: Prism' Type ()
_ListT :: Prism' Type ()
_ListT
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Type
_ = forall a. Maybe a
Nothing

_PromotedTupleT :: Prism' Type Int
_PromotedTupleT :: Prism' Type Int
_PromotedTupleT
  = 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) = forall a. a -> Maybe a
Just Int
x
      remitter Type
_ = forall a. Maybe a
Nothing

_PromotedNilT :: Prism' Type ()
_PromotedNilT :: Prism' Type ()
_PromotedNilT
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Type
_ = forall a. Maybe a
Nothing

_PromotedConsT :: Prism' Type ()
_PromotedConsT :: Prism' Type ()
_PromotedConsT
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Type
_ = forall a. Maybe a
Nothing

_StarT :: Prism' Type ()
_StarT :: Prism' Type ()
_StarT
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Type
_ = forall a. Maybe a
Nothing

_ConstraintT :: Prism' Type ()
_ConstraintT :: Prism' Type ()
_ConstraintT
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Type
_ = forall a. Maybe a
Nothing

_LitT :: Prism' Type TyLit
_LitT :: Prism' Type TyLit
_LitT
  = 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) = forall a. a -> Maybe a
Just TyLit
x
      remitter Type
_ = forall a. Maybe a
Nothing

_InfixT :: Prism' Type (Type, Name, Type)
_InfixT :: Prism' Type (Type, Name, Type)
_InfixT
  = 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) = forall a. a -> Maybe a
Just (Type
x, Name
y, Type
z)
      remitter Type
_ = forall a. Maybe a
Nothing

_UInfixT :: Prism' Type (Type, Name, Type)
_UInfixT :: Prism' Type (Type, Name, Type)
_UInfixT
  = 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) = forall a. a -> Maybe a
Just (Type
x, Name
y, Type
z)
      remitter Type
_ = forall a. Maybe a
Nothing

_ParensT :: Prism' Type Type
_ParensT :: Prism' Type Type
_ParensT
  = 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) = forall a. a -> Maybe a
Just Type
x
      remitter Type
_ = forall a. Maybe a
Nothing

_WildCardT :: Prism' Type ()
_WildCardT :: Prism' Type ()
_WildCardT
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Type
_ = forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,15,0)
_AppKindT :: Prism' Type (Type, Kind)
_AppKindT :: Prism' Type (Type, Type)
_AppKindT
  = 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) = forall a. a -> Maybe a
Just (Type
x, Type
y)
      remitter Type
_ = forall a. Maybe a
Nothing

_ImplicitParamT :: Prism' Type (String, Type)
_ImplicitParamT :: Prism' Type ([Char], Type)
_ImplicitParamT
  = 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) = forall a. a -> Maybe a
Just ([Char]
x, Type
y)
      remitter 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
  = 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) = forall a. a -> Maybe a
Just ([TyVarBndr ()]
x, Type
y)
      remitter Type
_ = forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,17,0)
_MulArrowT :: Prism' Type ()
_MulArrowT :: Prism' Type ()
_MulArrowT
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Type
_ = forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,19,0)
_PromotedInfixT :: Prism' Type (Type, Name, Type)
_PromotedInfixT
  = prism' reviewer remitter
  where
      reviewer (x, y, z) = PromotedInfixT x y z
      remitter (PromotedInfixT x y z) = Just (x, y, z)
      remitter _ = Nothing

_PromotedUInfixT :: Prism' Type (Type, Name, Type)
_PromotedUInfixT
  = prism' reviewer remitter
  where
      reviewer (x, y, z) = PromotedUInfixT x y z
      remitter (PromotedUInfixT x y z) = Just (x, y, z)
      remitter _ = Nothing
#endif

#if MIN_VERSION_template_haskell(2,17,0)
_SpecifiedSpec :: Prism' Specificity ()
_SpecifiedSpec :: Prism' Specificity ()
_SpecifiedSpec
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Specificity
_ = forall a. Maybe a
Nothing

_InferredSpec :: Prism' Specificity ()
_InferredSpec :: Prism' Specificity ()
_InferredSpec
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Specificity
_ = forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,21,0)
_BndrReq :: Prism' BndrVis ()
_BndrReq
  = prism' reviewer remitter
  where
      reviewer () = BndrReq
      remitter BndrReq = Just ()
      remitter _ = Nothing

_BndrInvis :: Prism' BndrVis ()
_BndrInvis
  = prism' reviewer remitter
  where
      reviewer () = BndrInvis
      remitter BndrInvis = Just ()
      remitter _ = 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. Prism' (TyVarBndr flag) (Name, flag)
_PlainTV
  = forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' forall {flag}. (Name, flag) -> TyVarBndr flag
reviewer forall {b}. TyVarBndr b -> Maybe (Name, b)
remitter
  where
      reviewer :: (Name, flag) -> TyVarBndr flag
reviewer (Name
x, flag
y) = forall flag. Name -> flag -> TyVarBndr flag
PlainTV Name
x flag
y
      remitter :: TyVarBndr b -> Maybe (Name, b)
remitter (PlainTV Name
x b
y) = forall a. a -> Maybe a
Just (Name
x, b
y)
      remitter TyVarBndr 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. Prism' (TyVarBndr flag) (Name, flag, Type)
_KindedTV
  = forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' forall {flag}. (Name, flag, Type) -> TyVarBndr flag
reviewer forall {b}. TyVarBndr b -> Maybe (Name, b, Type)
remitter
  where
      reviewer :: (Name, flag, Type) -> TyVarBndr flag
reviewer (Name
x, flag
y, Type
z) = 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) = forall a. a -> Maybe a
Just (Name
x, b
y, Type
z)
      remitter TyVarBndr b
_ = 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
  = 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 = forall a. a -> Maybe a
Just ()
      remitter FamilyResultSig
_ = forall a. Maybe a
Nothing

_KindSig :: Prism' FamilyResultSig Kind
_KindSig :: Prism' FamilyResultSig Type
_KindSig
  = 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) = forall a. a -> Maybe a
Just Type
x
      remitter FamilyResultSig
_ = forall a. Maybe a
Nothing

_TyVarSig :: Prism' FamilyResultSig TyVarBndrUnit
_TyVarSig :: Prism' FamilyResultSig (TyVarBndr ())
_TyVarSig
  = 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) = forall a. a -> Maybe a
Just TyVarBndr ()
x
      remitter FamilyResultSig
_ = forall a. Maybe a
Nothing

_NumTyLit :: Prism' TyLit Integer
_NumTyLit :: Prism' TyLit Integer
_NumTyLit
  = 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) = forall a. a -> Maybe a
Just Integer
x
      remitter TyLit
_ = forall a. Maybe a
Nothing

_StrTyLit :: Prism' TyLit String
_StrTyLit :: Prism' TyLit [Char]
_StrTyLit
  = 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) = forall a. a -> Maybe a
Just [Char]
x
      remitter TyLit
_ = forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,18,0)
_CharTyLit :: Prism' TyLit Char
_CharTyLit :: Prism' TyLit Char
_CharTyLit
  = 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) = forall a. a -> Maybe a
Just Char
x
      remitter TyLit
_ = forall a. Maybe a
Nothing
#endif

_NominalR :: Prism' Role ()
_NominalR :: Prism' Role ()
_NominalR
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Role
_ = forall a. Maybe a
Nothing

_RepresentationalR :: Prism' Role ()
_RepresentationalR :: Prism' Role ()
_RepresentationalR
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Role
_ = forall a. Maybe a
Nothing

_PhantomR :: Prism' Role ()
_PhantomR :: Prism' Role ()
_PhantomR
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Role
_ = forall a. Maybe a
Nothing

_InferR :: Prism' Role ()
_InferR :: Prism' Role ()
_InferR
  = 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 = forall a. a -> Maybe a
Just ()
      remitter Role
_ = forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,12,0)
_StockStrategy :: Prism' DerivStrategy ()
_StockStrategy :: Prism' DerivStrategy ()
_StockStrategy
  = 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 = forall a. a -> Maybe a
Just ()
      remitter DerivStrategy
_ = forall a. Maybe a
Nothing

_AnyclassStrategy :: Prism' DerivStrategy ()
_AnyclassStrategy :: Prism' DerivStrategy ()
_AnyclassStrategy
  = 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 = forall a. a -> Maybe a
Just ()
      remitter DerivStrategy
_ = forall a. Maybe a
Nothing

_NewtypeStrategy :: Prism' DerivStrategy ()
_NewtypeStrategy :: Prism' DerivStrategy ()
_NewtypeStrategy
  = 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 = forall a. a -> Maybe a
Just ()
      remitter DerivStrategy
_ = forall a. Maybe a
Nothing
#endif