{-# 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
#if MIN_VERSION_template_haskell(2,11,0)
  -- ** InjectivityAnn Lenses
  , injectivityAnnOutput
  , injectivityAnnInputs
  -- ** TypeFamilyHead Lenses
  , typeFamilyHeadName
  , typeFamilyHeadTyVarBndrs
  , typeFamilyHeadResultSig
  , typeFamilyHeadInjectivityAnn
  -- ** Bang Lenses
  , bangSourceUnpackedness
  , bangSourceStrictness
#endif
#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
#if MIN_VERSION_template_haskell(2,10,0)
  , _StandaloneDerivD
  , _DefaultSigD
#endif
#if MIN_VERSION_template_haskell(2,11,0)
  , _DataFamilyD
  , _OpenTypeFamilyD
#else
  , _FamilyD
#endif
#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,12,0)
  -- ** PatSynDir Prisms
  , _Unidir
  , _ImplBidir
  , _ExplBidir
  -- ** PatSynArgs Prisms
  , _PrefixPatSyn
  , _InfixPatSyn
  , _RecordPatSyn
#endif
  -- ** Con Prisms
  , _NormalC
  , _RecC
  , _InfixC
  , _ForallC
#if MIN_VERSION_template_haskell(2,11,0)
  , _GadtC
  , _RecGadtC
#endif
#if MIN_VERSION_template_haskell(2,11,0)
  -- ** Overlap Prisms
  ,_Overlappable
  ,_Overlapping
  ,_Overlaps
  ,_Incoherent
#endif
#if MIN_VERSION_template_haskell(2,11,0)
  -- ** SourceUnpackedness Prisms
  , _NoSourceUnpackedness
  , _SourceNoUnpack
  , _SourceUnpack
  -- ** SourceStrictness Prisms
  , _NoSourceStrictness
  , _SourceLazy
  , _SourceStrict
  -- ** DecidedStrictness Prisms
  , _DecidedLazy
  , _DecidedStrict
  , _DecidedUnpack
#else
  -- ** Strict Prisms
  , _IsStrict
  , _NotStrict
  , _Unpacked
#endif
  -- ** Foreign Prisms
  , _ImportF
  , _ExportF
  -- ** Callconv Prisms
  , _CCall
  , _StdCall
#if MIN_VERSION_template_haskell(2,10,0)
  , _CApi
  , _Prim
  , _JavaScript
#endif
  -- ** Safety Prisms
  , _Unsafe
  , _Safe
  , _Interruptible
  -- ** Pragma Prisms
  , _InlineP
  , _SpecialiseP
  , _SpecialiseInstP
  , _RuleP
  , _AnnP
#if MIN_VERSION_template_haskell(2,10,0)
  , _LineP
#endif
#if MIN_VERSION_template_haskell(2,12,0)
  , _CompleteP
#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
#if MIN_VERSION_template_haskell(2,10,0)
  , _StaticE
#endif
#if MIN_VERSION_template_haskell(2,11,0)
  , _UnboundVarE
#endif
#if MIN_VERSION_template_haskell(2,13,0)
  , _LabelE
#endif
#if MIN_VERSION_template_haskell(2,15,0)
  , _MDoE
  , _ImplicitParamVarE
#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
#if MIN_VERSION_template_haskell(2,11,0)
  , _CharPrimL
#endif
#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
#if MIN_VERSION_template_haskell(2,10,0)
  , _EqualityT
#endif
  , _ListT
  , _PromotedTupleT
  , _PromotedNilT
  , _PromotedConsT
  , _StarT
  , _ConstraintT
  , _LitT
#if MIN_VERSION_template_haskell(2,11,0)
  , _InfixT
  , _UInfixT
  , _ParensT
  , _WildCardT
#endif
#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,17,0)
  -- ** Specificity Prisms
  , _SpecifiedSpec
  , _InferredSpec
#endif
  -- ** TyVarBndr Prisms
  , _PlainTV
  , _KindedTV
#if MIN_VERSION_template_haskell(2,11,0)
  -- ** FamilyResultSig Prisms
  , _NoSig
  , _KindSig
  , _TyVarSig
#endif
  -- ** TyLit Prisms
  , _NumTyLit
  , _StrTyLit
#if !MIN_VERSION_template_haskell(2,10,0)
  -- ** Pred Prisms
  , _ClassP
  , _EqualP
#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.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 Control.Lens.Internal.TH (unfoldType)
import Data.Foldable as F (foldl')
#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 :: (Name -> f Name) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
name = (Name -> f Name) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
forall (f :: * -> *) flag.
Functor f =>
(Name -> f Name) -> TyVarBndr_ flag -> f (TyVarBndr_ flag)
traverseTVName

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

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

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

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

#if MIN_VERSION_template_haskell(2,11,0)
instance HasName TypeFamilyHead where
  name :: (Name -> f Name) -> TypeFamilyHead -> f TypeFamilyHead
name Name -> f Name
f (TypeFamilyHead Name
n [TyVarBndr_ flag]
tvbs FamilyResultSig
frs Maybe InjectivityAnn
mia) =
    (\Name
n' -> Name
-> [TyVarBndr_ flag]
-> FamilyResultSig
-> Maybe InjectivityAnn
-> TypeFamilyHead
TypeFamilyHead Name
n' [TyVarBndr_ flag]
tvbs FamilyResultSig
frs Maybe InjectivityAnn
mia) (Name -> TypeFamilyHead) -> f Name -> f TypeFamilyHead
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name -> f Name
f Name
n

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

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

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

instance HasTypes Con where
  types :: (Type -> f Type) -> Con -> f Con
types Type -> f Type
f (NormalC Name
n [BangType]
t)      = Name -> [BangType] -> Con
NormalC Name
n ([BangType] -> Con) -> f [BangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
_2 ((Type -> f Type) -> Type -> f Type
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 ([VarBangType] -> Con) -> f [VarBangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((Type -> f Type) -> VarBangType -> f VarBangType
forall s t a b. Field3 s t a b => Lens s t a b
_3 ((Type -> f Type) -> Type -> f Type
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 (BangType -> Name -> BangType -> Con)
-> f BangType -> f (Name -> BangType -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
_2 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f) BangType
t1
                                       f (Name -> BangType -> Con) -> f Name -> f (BangType -> Con)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Name -> f Name
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n f (BangType -> Con) -> f BangType -> f Con
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
_2 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f) BangType
t2
  types Type -> f Type
f (ForallC [TyVarBndr_ flag]
vb Cxt
ctx Con
con)    = [TyVarBndr_ flag] -> Cxt -> Con -> Con
ForallC [TyVarBndr_ flag]
vb Cxt
ctx (Con -> Con) -> f Con -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Type -> f Type) -> Con -> f Con
forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f Con
con
#if MIN_VERSION_template_haskell(2,11,0)
  types Type -> f Type
f (GadtC [Name]
ns [BangType]
argTys Type
retTy) =
    [Name] -> [BangType] -> Type -> Con
GadtC    [Name]
ns ([BangType] -> Type -> Con) -> f [BangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((Type -> f Type) -> BangType -> f BangType
forall s t a b. Field2 s t a b => Lens s t a b
_2 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f)) [BangType]
argTys f (Type -> Con) -> f Type -> f Con
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f Type
retTy
  types Type -> f Type
f (RecGadtC [Name]
ns [VarBangType]
argTys Type
retTy) =
    [Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
ns ([VarBangType] -> Type -> Con)
-> f [VarBangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((Type -> f Type) -> VarBangType -> f VarBangType
forall s t a b. Field3 s t a b => Lens s t a b
_3 ((Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f)) [VarBangType]
argTys f (Type -> Con) -> f Type -> f Con
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Type -> f Type) -> Type -> f Type
forall t. HasTypes t => Traversal' t Type
types Type -> f Type
f Type
retTy
#endif

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

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

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

-- | Provides for the extraction of free type variables, and alpha renaming.
class HasTypeVars t where
  -- | When performing substitution into this traversal you're not allowed
  -- to substitute in a name that is bound internally or you'll violate
  -- the 'Traversal' laws, when in doubt generate your names with 'newName'.
  typeVarsEx :: Set Name -> Traversal' t Name

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

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

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

#if !MIN_VERSION_template_haskell(2,10,0)
instance HasTypeVars Pred where
  typeVarsEx s f (ClassP n ts) = ClassP n <$> typeVarsEx s f ts
  typeVarsEx s f (EqualP l r)  = EqualP <$> typeVarsEx s f l <*> typeVarsEx s f r
#endif

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

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

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

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

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

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

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

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

#if !MIN_VERSION_template_haskell(2,10,0)
instance SubstType Pred where
  substType m (ClassP n ts) = ClassP n (substType m ts)
  substType m (EqualP l r)  = substType m (EqualP l r)
#endif

-- | Provides a 'Traversal' of the types of each field of a constructor.
--
-- @
-- conFields :: 'Traversal'' 'Con' 'BangType'   -- template-haskell-2.11+
-- conFields :: 'Traversal'' 'Con' 'StrictType' -- Earlier versions
-- @
conFields :: Traversal' Con
#if MIN_VERSION_template_haskell(2,11,0)
                            BangType
#else
                            StrictType
#endif
conFields :: (BangType -> f BangType) -> Con -> f Con
conFields BangType -> f BangType
f (NormalC Name
n [BangType]
fs)      = Name -> [BangType] -> Con
NormalC Name
n ([BangType] -> Con) -> f [BangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse BangType -> f BangType
f [BangType]
fs
conFields BangType -> f BangType
f (RecC Name
n [VarBangType]
fs)         = Name -> [VarBangType] -> Con
RecC Name
n ([VarBangType] -> Con) -> f [VarBangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((BangType -> f BangType) -> VarBangType -> f VarBangType
Traversal' VarBangType BangType
sansVar BangType -> f BangType
f) [VarBangType]
fs
conFields BangType -> f BangType
f (InfixC BangType
l Name
n BangType
r)      = BangType -> Name -> BangType -> Con
InfixC (BangType -> Name -> BangType -> Con)
-> f BangType -> f (Name -> BangType -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BangType -> f BangType
f BangType
l f (Name -> BangType -> Con) -> f Name -> f (BangType -> Con)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Name -> f Name
forall (f :: * -> *) a. Applicative f => a -> f a
pure Name
n f (BangType -> Con) -> f BangType -> f Con
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_ flag]
bds Cxt
ctx Con
c) = [TyVarBndr_ flag] -> Cxt -> Con -> Con
ForallC [TyVarBndr_ flag]
bds Cxt
ctx (Con -> Con) -> f Con -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> Con -> f Con
Traversal' Con BangType
conFields BangType -> f BangType
f Con
c
#if MIN_VERSION_template_haskell(2,11,0)
conFields BangType -> f BangType
f (GadtC [Name]
ns [BangType]
argTys Type
retTy) =
  [Name] -> [BangType] -> Type -> Con
GadtC [Name]
ns ([BangType] -> Type -> Con) -> f [BangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (BangType -> f BangType) -> [BangType] -> f [BangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse BangType -> f BangType
f [BangType]
argTys f (Type -> Con) -> f Type -> f Con
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Type -> f Type
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
retTy
conFields BangType -> f BangType
f (RecGadtC [Name]
ns [VarBangType]
argTys Type
retTy) =
  [Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
ns ([VarBangType] -> Type -> Con)
-> f [VarBangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((BangType -> f BangType) -> VarBangType -> f VarBangType
Traversal' VarBangType BangType
sansVar BangType -> f BangType
f) [VarBangType]
argTys f (Type -> Con) -> f Type -> f Con
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Type -> f Type
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
retTy
#endif

-- |
-- @
-- sansVar :: 'Traversal'' 'VarBangType'   'BangType'   -- template-haskell-2.11+
-- sansVar :: 'Traversal'' 'VarStrictType' 'StrictType' -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,11,0)
sansVar :: Traversal' VarBangType   BangType
#else
sansVar :: Traversal' VarStrictType StrictType
#endif
sansVar :: (BangType -> f BangType) -> VarBangType -> f VarBangType
sansVar BangType -> f BangType
f (Name
fn,Bang
s,Type
t) = (\(Bang
s', Type
t') -> (Name
fn,Bang
s',Type
t')) (BangType -> VarBangType) -> f BangType -> f VarBangType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BangType -> f BangType
f (Bang
s, Type
t)

-- | 'Traversal' of the types of the /named/ fields of a constructor.
--
-- @
-- conNamedFields :: 'Traversal'' 'Con' 'VarBangType'   -- template-haskell-2.11+
-- conNamedFields :: 'Traversal'' 'Con' 'VarStrictType' -- Earlier versions
-- @
conNamedFields :: Traversal' Con
#if MIN_VERSION_template_haskell(2,11,0)
                                 VarBangType
#else
                                 VarStrictType
#endif
conNamedFields :: (VarBangType -> f VarBangType) -> Con -> f Con
conNamedFields VarBangType -> f VarBangType
_ c :: Con
c@NormalC{}      = Con -> f Con
forall (f :: * -> *) a. Applicative f => a -> f a
pure Con
c
conNamedFields VarBangType -> f VarBangType
_ c :: Con
c@InfixC{}       = Con -> f Con
forall (f :: * -> *) a. Applicative f => a -> f a
pure Con
c
conNamedFields VarBangType -> f VarBangType
f (RecC Name
n [VarBangType]
fs)      = Name -> [VarBangType] -> Con
RecC Name
n ([VarBangType] -> Con) -> f [VarBangType] -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse VarBangType -> f VarBangType
f [VarBangType]
fs
conNamedFields VarBangType -> f VarBangType
f (ForallC [TyVarBndr_ flag]
a Cxt
b Con
fs) = [TyVarBndr_ flag] -> Cxt -> Con -> Con
ForallC [TyVarBndr_ flag]
a Cxt
b (Con -> Con) -> f Con -> f Con
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> Con -> f Con
Traversal' Con VarBangType
conNamedFields VarBangType -> f VarBangType
f Con
fs
#if MIN_VERSION_template_haskell(2,11,0)
conNamedFields VarBangType -> f VarBangType
_ c :: Con
c@GadtC{}        = Con -> f Con
forall (f :: * -> *) a. Applicative f => a -> f a
pure Con
c
conNamedFields VarBangType -> f VarBangType
f (RecGadtC [Name]
ns [VarBangType]
argTys Type
retTy) =
  [Name] -> [VarBangType] -> Type -> Con
RecGadtC [Name]
ns ([VarBangType] -> Type -> Con)
-> f [VarBangType] -> f (Type -> Con)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (VarBangType -> f VarBangType) -> [VarBangType] -> f [VarBangType]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse VarBangType -> f VarBangType
f [VarBangType]
argTys f (Type -> Con) -> f Type -> f Con
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Type -> f Type
forall (f :: * -> *) a. Applicative f => a -> f a
pure Type
retTy
#endif

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

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

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

locStart :: Lens' Loc CharPos
locStart :: (CharPos -> f CharPos) -> Loc -> f Loc
locStart = (Loc -> CharPos)
-> (Loc -> CharPos -> Loc) -> Lens Loc Loc CharPos CharPos
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Loc -> CharPos
loc_start
         ((Loc -> CharPos -> Loc) -> Lens Loc Loc CharPos CharPos)
-> (Loc -> CharPos -> Loc) -> Lens Loc Loc CharPos CharPos
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 :: (CharPos -> f CharPos) -> Loc -> f Loc
locEnd = (Loc -> CharPos)
-> (Loc -> CharPos -> Loc) -> Lens Loc Loc CharPos CharPos
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Loc -> CharPos
loc_end
       ((Loc -> CharPos -> Loc) -> Lens Loc Loc CharPos CharPos)
-> (Loc -> CharPos -> Loc) -> Lens Loc Loc CharPos CharPos
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 :: ([Name] -> f [Name]) -> FunDep -> f FunDep
funDepInputs = (FunDep -> [Name])
-> (FunDep -> [Name] -> FunDep) -> Lens FunDep FunDep [Name] [Name]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens FunDep -> [Name]
g FunDep -> [Name] -> FunDep
s where
   g :: FunDep -> [Name]
g (FunDep [Name]
xs [Name]
_)    = [Name]
xs
   s :: FunDep -> [Name] -> FunDep
s (FunDep [Name]
_ [Name]
ys) [Name]
xs = [Name] -> [Name] -> FunDep
FunDep [Name]
xs [Name]
ys

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

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

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

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

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

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

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

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

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

fixityDirection :: Lens' Fixity FixityDirection
fixityDirection :: (FixityDirection -> f FixityDirection) -> Fixity -> f Fixity
fixityDirection = (Fixity -> FixityDirection)
-> (Fixity -> FixityDirection -> Fixity)
-> Lens Fixity 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 :: ([Pat] -> f [Pat]) -> Clause -> f Clause
clausePattern = (Clause -> [Pat])
-> (Clause -> [Pat] -> Clause) -> Lens Clause Clause [Pat] [Pat]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens Clause -> [Pat]
g Clause -> [Pat] -> Clause
s where
   g :: Clause -> [Pat]
g (Clause [Pat]
ps Body
_ [Dec]
_)    = [Pat]
ps
   s :: Clause -> [Pat] -> Clause
s (Clause [Pat]
_  Body
x [Dec]
y) [Pat]
ps = [Pat] -> Body -> [Dec] -> Clause
Clause [Pat]
ps Body
x [Dec]
y

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

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

#if MIN_VERSION_template_haskell(2,11,0)
injectivityAnnOutput :: Lens' InjectivityAnn Name
injectivityAnnOutput :: (Name -> f Name) -> InjectivityAnn -> f InjectivityAnn
injectivityAnnOutput = (InjectivityAnn -> Name)
-> (InjectivityAnn -> Name -> InjectivityAnn)
-> Lens' InjectivityAnn Name
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens InjectivityAnn -> Name
g InjectivityAnn -> Name -> InjectivityAnn
s where
   g :: InjectivityAnn -> Name
g (InjectivityAnn Name
o [Name]
_)   = Name
o
   s :: InjectivityAnn -> Name -> InjectivityAnn
s (InjectivityAnn Name
_ [Name]
i) Name
o = Name -> [Name] -> InjectivityAnn
InjectivityAnn Name
o [Name]
i

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

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

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

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

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

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

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

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

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

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

-- |
-- @
-- _ClassOpI :: 'Prism'' 'Info' ('Name', 'Type', 'ParentName')         -- template-haskell-2.11+
-- _ClassOpI :: 'Prism'' 'Info' ('Name', 'Type', 'ParentName', 'Fixity') -- template-haskell-2.8 through 2.10
-- _ClassOpI :: 'Prism'' 'Info' ('Name', 'Type', 'Name',       'Fixity') -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,11,0)
_ClassOpI :: Prism' Info (Name, Type, ParentName)
_ClassOpI :: p (Name, Type, Name) (f (Name, Type, Name)) -> p Info (f Info)
_ClassOpI
  = ((Name, Type, Name) -> Info)
-> (Info -> Maybe (Name, Type, Name))
-> Prism Info Info (Name, Type, Name) (Name, Type, Name)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type, Name) -> Info
reviewer Info -> Maybe (Name, Type, Name)
remitter
  where
      reviewer :: (Name, Type, Name) -> Info
reviewer (Name
x, Type
y, Name
z) = Name -> Type -> Name -> Info
ClassOpI Name
x Type
y Name
z
      remitter :: Info -> Maybe (Name, Type, Name)
remitter (ClassOpI Name
x Type
y Name
z) = (Name, Type, Name) -> Maybe (Name, Type, Name)
forall a. a -> Maybe a
Just (Name
x, Type
y, Name
z)
      remitter Info
_ = Maybe (Name, Type, Name)
forall a. Maybe a
Nothing
#else
_ClassOpI :: Prism' Info (Name, Type, ParentName, Fixity)
_ClassOpI
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w) = ClassOpI x y z w
      remitter (ClassOpI x y z w) = Just (x, y, z, w)
      remitter _ = Nothing
#endif

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

#if MIN_VERSION_template_haskell(2,11,0)
_FamilyI :: Prism' Info (Dec, [InstanceDec])
#else
_FamilyI :: Prism' Info (Dec, [Dec])
#endif
_FamilyI :: p (Dec, [Dec]) (f (Dec, [Dec])) -> p Info (f Info)
_FamilyI
  = ((Dec, [Dec]) -> Info)
-> (Info -> Maybe (Dec, [Dec]))
-> Prism Info Info (Dec, [Dec]) (Dec, [Dec])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Dec, [Dec]) -> Info
reviewer Info -> Maybe (Dec, [Dec])
remitter
  where
      reviewer :: (Dec, [Dec]) -> Info
reviewer (Dec
x, [Dec]
y) = Dec -> [Dec] -> Info
FamilyI Dec
x [Dec]
y
      remitter :: Info -> Maybe (Dec, [Dec])
remitter (FamilyI Dec
x [Dec]
y) = (Dec, [Dec]) -> Maybe (Dec, [Dec])
forall a. a -> Maybe a
Just (Dec
x, [Dec]
y)
      remitter Info
_ = Maybe (Dec, [Dec])
forall a. Maybe a
Nothing

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

-- |
-- @
-- _DataConI :: 'Prism'' 'Info' ('Name', 'Type', 'ParentName')         -- template-haskell-2.11+
-- _DataConI :: 'Prism'' 'Info' ('Name', 'Type', 'ParentName', 'Fixity') -- template-haskell-2.8 through 2.10
-- _DataConI :: 'Prism'' 'Info' ('Name', 'Type', 'Name',       'Fixity') -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,11,0)
_DataConI :: Prism' Info (Name, Type, ParentName)
_DataConI :: p (Name, Type, Name) (f (Name, Type, Name)) -> p Info (f Info)
_DataConI
  = ((Name, Type, Name) -> Info)
-> (Info -> Maybe (Name, Type, Name))
-> Prism Info Info (Name, Type, Name) (Name, Type, Name)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type, Name) -> Info
reviewer Info -> Maybe (Name, Type, Name)
remitter
  where
      reviewer :: (Name, Type, Name) -> Info
reviewer (Name
x, Type
y, Name
z) = Name -> Type -> Name -> Info
DataConI Name
x Type
y Name
z
      remitter :: Info -> Maybe (Name, Type, Name)
remitter (DataConI Name
x Type
y Name
z) = (Name, Type, Name) -> Maybe (Name, Type, Name)
forall a. a -> Maybe a
Just (Name
x, Type
y, Name
z)
      remitter Info
_ = Maybe (Name, Type, Name)
forall a. Maybe a
Nothing
#else
_DataConI :: Prism' Info (Name, Type, ParentName, Fixity)
_DataConI
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w) = DataConI x y z w
      remitter (DataConI x y z w) = Just (x, y, z, w)
      remitter _ = Nothing
#endif

-- |
-- @
-- _VarI :: 'Prism'' 'Info' ('Name', 'Type', 'Maybe' 'Dec')         -- template-haskell-2.11+
-- _VarI :: 'Prism'' 'Info' ('Name', 'Type', 'Maybe' 'Dec', 'Fixity') -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,11,0)
_VarI :: Prism' Info (Name, Type, Maybe Dec)
_VarI :: p (Name, Type, Maybe Dec) (f (Name, Type, Maybe Dec))
-> p Info (f Info)
_VarI
  = ((Name, Type, Maybe Dec) -> Info)
-> (Info -> Maybe (Name, Type, Maybe Dec))
-> Prism Info Info (Name, Type, Maybe Dec) (Name, Type, Maybe Dec)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type, Maybe Dec) -> Info
reviewer Info -> Maybe (Name, Type, Maybe Dec)
remitter
  where
      reviewer :: (Name, Type, Maybe Dec) -> Info
reviewer (Name
x, Type
y, Maybe Dec
z) = Name -> Type -> Maybe Dec -> Info
VarI Name
x Type
y Maybe Dec
z
      remitter :: Info -> Maybe (Name, Type, Maybe Dec)
remitter (VarI Name
x Type
y Maybe Dec
z) = (Name, Type, Maybe Dec) -> Maybe (Name, Type, Maybe Dec)
forall a. a -> Maybe a
Just (Name
x, Type
y, Maybe Dec
z)
      remitter Info
_ = Maybe (Name, Type, Maybe Dec)
forall a. Maybe a
Nothing
#else
_VarI :: Prism' Info (Name, Type, Maybe Dec, Fixity)
_VarI
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w) = VarI x y z w
      remitter (VarI x y z w) = Just (x, y, z, w)
      remitter _ = Nothing
#endif

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

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

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

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

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

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

-- |
-- @
-- _InstanceD :: 'Prism'' 'Dec' ('Maybe' 'Overlap', 'Cxt', 'Type', ['Dec']) -- template-haskell-2.11+
-- _InstanceD :: 'Prism'' 'Dec'                ('Cxt', 'Type', ['Dec']) -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,11,0)
_InstanceD :: Prism' Dec (Maybe Overlap, Cxt, Type, [Dec])
#else
_InstanceD :: Prism' Dec (Cxt, Type, [Dec])
#endif
_InstanceD :: p (Maybe Overlap, Cxt, Type, [Dec])
  (f (Maybe Overlap, Cxt, Type, [Dec]))
-> p Dec (f Dec)
_InstanceD
  = ((Maybe Overlap, Cxt, Type, [Dec]) -> Dec)
-> (Dec -> Maybe (Maybe Overlap, Cxt, Type, [Dec]))
-> Prism
     Dec
     Dec
     (Maybe Overlap, Cxt, Type, [Dec])
     (Maybe Overlap, Cxt, Type, [Dec])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Maybe Overlap, Cxt, Type, [Dec]) -> Dec
reviewer Dec -> Maybe (Maybe Overlap, Cxt, Type, [Dec])
remitter
  where
#if MIN_VERSION_template_haskell(2,11,0)
      reviewer :: (Maybe Overlap, Cxt, Type, [Dec]) -> Dec
reviewer (Maybe Overlap
x, Cxt
y, Type
z, [Dec]
w) = Maybe Overlap -> Cxt -> Type -> [Dec] -> Dec
InstanceD Maybe Overlap
x Cxt
y Type
z [Dec]
w
      remitter :: Dec -> Maybe (Maybe Overlap, Cxt, Type, [Dec])
remitter (InstanceD Maybe Overlap
x Cxt
y Type
z [Dec]
w) = (Maybe Overlap, Cxt, Type, [Dec])
-> Maybe (Maybe Overlap, Cxt, Type, [Dec])
forall a. a -> Maybe a
Just (Maybe Overlap
x, Cxt
y, Type
z, [Dec]
w)
#else
      reviewer (x, y, z) = InstanceD x y z
      remitter (InstanceD x y z) = Just ( x, y, z)
#endif
      remitter Dec
_ = Maybe (Maybe Overlap, Cxt, Type, [Dec])
forall a. Maybe a
Nothing

#if MIN_VERSION_template_haskell(2,11,0)
_Overlappable  :: Prism' Overlap  ()
_Overlappable :: p () (f ()) -> p Overlap (f Overlap)
_Overlappable  = (() -> Overlap)
-> (Overlap -> Maybe ()) -> Prism Overlap Overlap () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Overlap
reviewer Overlap -> Maybe ()
remitter
  where
      reviewer :: () -> Overlap
reviewer () = Overlap
Overlappable
      remitter :: Overlap -> Maybe ()
remitter Overlap
Overlappable = () -> Maybe ()
forall a. a -> Maybe a
Just  ()
      remitter Overlap
_ = Maybe ()
forall a. Maybe a
Nothing

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

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

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

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

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

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

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

-- |
-- @
-- _TySynInstD :: 'Prism'' 'Dec' 'TySynEqn'             -- template-haskell-2.15+
-- _TySynInstD :: 'Prism'' 'Dec' ('Name', 'TySynEqn')     -- template-haskell-2.9 through 2.14
-- _TySynInstD :: 'Prism'' 'Dec' ('Name', ['Type'], 'Type') -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,15,0)
_TySynInstD :: Prism' Dec TySynEqn
_TySynInstD :: p TySynEqn (f TySynEqn) -> p Dec (f Dec)
_TySynInstD
  = (TySynEqn -> Dec)
-> (Dec -> Maybe TySynEqn) -> Prism Dec Dec TySynEqn TySynEqn
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' TySynEqn -> Dec
reviewer Dec -> Maybe TySynEqn
remitter
  where
      reviewer :: TySynEqn -> Dec
reviewer = TySynEqn -> Dec
TySynInstD
      remitter :: Dec -> Maybe TySynEqn
remitter (TySynInstD TySynEqn
x) = TySynEqn -> Maybe TySynEqn
forall a. a -> Maybe a
Just TySynEqn
x
      remitter Dec
_ = Maybe TySynEqn
forall a. Maybe a
Nothing
#else
_TySynInstD :: Prism' Dec (Name, TySynEqn)
_TySynInstD
  = prism' reviewer remitter
  where
      reviewer (x, y) = TySynInstD x y
      remitter (TySynInstD x y) = Just (x, y)
      remitter _ = Nothing
#endif

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

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

#if MIN_VERSION_template_haskell(2,10,0)
_DefaultSigD :: Prism' Dec (Name, Type)
_DefaultSigD :: p (Name, Type) (f (Name, Type)) -> p Dec (f Dec)
_DefaultSigD
  = ((Name, Type) -> Dec)
-> (Dec -> Maybe (Name, Type))
-> Prism Dec Dec (Name, Type) (Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type) -> Dec
reviewer Dec -> Maybe (Name, Type)
remitter
  where
      reviewer :: (Name, Type) -> Dec
reviewer (Name
x, Type
y) = Name -> Type -> Dec
DefaultSigD Name
x Type
y
      remitter :: Dec -> Maybe (Name, Type)
remitter (DefaultSigD Name
x Type
y) = (Name, Type) -> Maybe (Name, Type)
forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter Dec
_ = Maybe (Name, Type)
forall a. Maybe a
Nothing
#endif

# if MIN_VERSION_template_haskell(2,12,0)
type DataPrism' tys cons = Prism' Dec (Cxt, Name, tys, Maybe Kind, cons, [DerivClause])
# elif MIN_VERSION_template_haskell(2,11,0)
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')           -- template-haskell-2.11
-- _DataInstD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['Type'],                            ['Con'], ['Name'])        -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,15,0)
_DataInstD :: Prism' Dec (Cxt, Maybe [TyVarBndrUnit], Type, Maybe Kind, [Con], [DerivClause])
_DataInstD :: p (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
   [DerivClause])
  (f (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
      [DerivClause]))
-> p Dec (f Dec)
_DataInstD
  = ((Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
  [DerivClause])
 -> Dec)
-> (Dec
    -> Maybe
         (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
          [DerivClause]))
-> Prism
     Dec
     Dec
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
      [DerivClause])
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
      [DerivClause])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
 [DerivClause])
-> Dec
reviewer Dec
-> Maybe
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
      [DerivClause])
remitter
  where
      reviewer :: (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
 [DerivClause])
-> Dec
reviewer (Cxt
x, Maybe [TyVarBndr_ flag]
y, Type
z, Maybe Type
w, [Con]
u, [DerivClause]
v) = Cxt
-> Maybe [TyVarBndr_ flag]
-> Type
-> Maybe Type
-> [Con]
-> [DerivClause]
-> Dec
DataInstD Cxt
x Maybe [TyVarBndr_ flag]
y Type
z Maybe Type
w [Con]
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
      [DerivClause])
remitter (DataInstD Cxt
x Maybe [TyVarBndr_ flag]
y Type
z Maybe Type
w [Con]
u [DerivClause]
v) = (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
 [DerivClause])
-> Maybe
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
      [DerivClause])
forall a. a -> Maybe a
Just (Cxt
x, Maybe [TyVarBndr_ flag]
y, Type
z, Maybe Type
w, [Con]
u, [DerivClause]
v)
      remitter Dec
_ = Maybe
  (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, [Con],
   [DerivClause])
forall a. Maybe a
Nothing
#elif MIN_VERSION_template_haskell(2,11,0)
_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
#else
_DataInstD :: Prism' Dec (Cxt, Name, [Type], [Con], [Name])
_DataInstD
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w, u) = DataInstD x y z w u
      remitter (DataInstD x y z w u) = Just (x, y, z, w, u)
      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')           -- template-haskell-2.11
-- _NewtypeInstD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['Type'],                            'Con', ['Name'])        -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,15,0)
_NewtypeInstD :: Prism' Dec (Cxt, Maybe [TyVarBndrUnit], Type, Maybe Kind, Con, [DerivClause])
_NewtypeInstD :: p (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
   [DerivClause])
  (f (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
      [DerivClause]))
-> p Dec (f Dec)
_NewtypeInstD
  = ((Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
  [DerivClause])
 -> Dec)
-> (Dec
    -> Maybe
         (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
          [DerivClause]))
-> Prism
     Dec
     Dec
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
      [DerivClause])
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
      [DerivClause])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
 [DerivClause])
-> Dec
reviewer Dec
-> Maybe
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
      [DerivClause])
remitter
  where
      reviewer :: (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
 [DerivClause])
-> Dec
reviewer (Cxt
x, Maybe [TyVarBndr_ flag]
y, Type
z, Maybe Type
w, Con
u, [DerivClause]
v) = Cxt
-> Maybe [TyVarBndr_ flag]
-> Type
-> Maybe Type
-> Con
-> [DerivClause]
-> Dec
NewtypeInstD Cxt
x Maybe [TyVarBndr_ flag]
y Type
z Maybe Type
w Con
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
      [DerivClause])
remitter (NewtypeInstD Cxt
x Maybe [TyVarBndr_ flag]
y Type
z Maybe Type
w Con
u [DerivClause]
v) = (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
 [DerivClause])
-> Maybe
     (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
      [DerivClause])
forall a. a -> Maybe a
Just (Cxt
x, Maybe [TyVarBndr_ flag]
y, Type
z, Maybe Type
w, Con
u, [DerivClause]
v)
      remitter Dec
_ = Maybe
  (Cxt, Maybe [TyVarBndr_ flag], Type, Maybe Type, Con,
   [DerivClause])
forall a. Maybe a
Nothing
#elif MIN_VERSION_template_haskell(2,11,0)
_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
#else
_NewtypeInstD :: Prism' Dec (Cxt, Name, [Type], Con, [Name])
_NewtypeInstD
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w, u) = NewtypeInstD x y z w u
      remitter (NewtypeInstD x y z w u) = Just (x, y, z, w, u)
      remitter _ = Nothing
#endif

#if MIN_VERSION_template_haskell(2,11,0)
_ClosedTypeFamilyD :: Prism' Dec (TypeFamilyHead, [TySynEqn])
_ClosedTypeFamilyD :: p (TypeFamilyHead, [TySynEqn]) (f (TypeFamilyHead, [TySynEqn]))
-> p Dec (f Dec)
_ClosedTypeFamilyD
  = ((TypeFamilyHead, [TySynEqn]) -> Dec)
-> (Dec -> Maybe (TypeFamilyHead, [TySynEqn]))
-> Prism
     Dec Dec (TypeFamilyHead, [TySynEqn]) (TypeFamilyHead, [TySynEqn])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (TypeFamilyHead, [TySynEqn]) -> Dec
reviewer Dec -> Maybe (TypeFamilyHead, [TySynEqn])
remitter
  where
      reviewer :: (TypeFamilyHead, [TySynEqn]) -> Dec
reviewer (TypeFamilyHead
x, [TySynEqn]
y) = TypeFamilyHead -> [TySynEqn] -> Dec
ClosedTypeFamilyD TypeFamilyHead
x [TySynEqn]
y
      remitter :: Dec -> Maybe (TypeFamilyHead, [TySynEqn])
remitter (ClosedTypeFamilyD TypeFamilyHead
x [TySynEqn]
y) = (TypeFamilyHead, [TySynEqn]) -> Maybe (TypeFamilyHead, [TySynEqn])
forall a. a -> Maybe a
Just (TypeFamilyHead
x, [TySynEqn]
y)
      remitter Dec
_ = Maybe (TypeFamilyHead, [TySynEqn])
forall a. Maybe a
Nothing
#else
_ClosedTypeFamilyD :: Prism' Dec (Name, [TyVarBndrUnit], Maybe Kind, [TySynEqn])
_ClosedTypeFamilyD
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w) = ClosedTypeFamilyD x y z w
      remitter (ClosedTypeFamilyD x y z w) = Just (x, y, z, w)
      remitter _ = Nothing
#endif

-- |
-- @
-- _DataD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['TyVarBndrUnit'], 'Maybe' 'Kind', ['Con'], ['DerivClause']) -- template-haskell-2.12+
-- _DataD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['Type'],          'Maybe' 'Kind', ['Con'], 'Cxt')           -- template-haskell-2.11
-- _DataD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['Type'],                      ['Con'], ['Name'])        -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,11,0)
_DataD :: DataPrism' [TyVarBndrUnit] [Con]
_DataD :: p (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
  (f (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con],
      [DerivClause]))
-> p Dec (f Dec)
_DataD
  = ((Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
 -> Dec)
-> (Dec
    -> Maybe
         (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause]))
-> Prism
     Dec
     Dec
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
-> Dec
reviewer Dec
-> Maybe
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
remitter
  where
      reviewer :: (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
-> Dec
reviewer (Cxt
x, Name
y, [TyVarBndr_ flag]
z, Maybe Type
w, [Con]
u, [DerivClause]
v) = Cxt
-> Name
-> [TyVarBndr_ flag]
-> Maybe Type
-> [Con]
-> [DerivClause]
-> Dec
DataD Cxt
x Name
y [TyVarBndr_ flag]
z Maybe Type
w [Con]
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
remitter (DataD Cxt
x Name
y [TyVarBndr_ flag]
z Maybe Type
w [Con]
u [DerivClause]
v) = (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
-> Maybe
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
forall a. a -> Maybe a
Just (Cxt
x, Name
y, [TyVarBndr_ flag]
z, Maybe Type
w, [Con]
u, [DerivClause]
v)
      remitter Dec
_ = Maybe
  (Cxt, Name, [TyVarBndr_ flag], Maybe Type, [Con], [DerivClause])
forall a. Maybe a
Nothing
#else
_DataD :: Prism' Dec (Cxt, Name, [TyVarBndrUnit], [Con], [Name])
_DataD
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w, u) = DataD x y z w u
      remitter (DataD x y z w u) = Just (x, y, z, w, u)
      remitter _ = Nothing
#endif

-- |
-- @
-- _NewtypeD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['TyVarBndrUnit'], 'Maybe' 'Kind', 'Con', ['DerivClause']) -- template-haskell-2.12+
-- _NewtypeD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['Type'],          'Maybe' 'Kind', 'Con', 'Cxt')           -- template-haskell-2.11
-- _NewtypeD :: 'Prism'' 'Dec' ('Cxt', 'Name', ['Type'],                      'Con', ['Name'])        -- Earlier versions
-- @
#if MIN_VERSION_template_haskell(2,11,0)
_NewtypeD :: DataPrism' [TyVarBndrUnit] Con
_NewtypeD :: p (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
  (f (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause]))
-> p Dec (f Dec)
_NewtypeD
  = ((Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
 -> Dec)
-> (Dec
    -> Maybe
         (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause]))
-> Prism
     Dec
     Dec
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
-> Dec
reviewer Dec
-> Maybe
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
remitter
  where
      reviewer :: (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
-> Dec
reviewer (Cxt
x, Name
y, [TyVarBndr_ flag]
z, Maybe Type
w, Con
u, [DerivClause]
v) = Cxt
-> Name
-> [TyVarBndr_ flag]
-> Maybe Type
-> Con
-> [DerivClause]
-> Dec
NewtypeD Cxt
x Name
y [TyVarBndr_ flag]
z Maybe Type
w Con
u [DerivClause]
v
      remitter :: Dec
-> Maybe
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
remitter (NewtypeD Cxt
x Name
y [TyVarBndr_ flag]
z Maybe Type
w Con
u [DerivClause]
v) = (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
-> Maybe
     (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
forall a. a -> Maybe a
Just (Cxt
x, Name
y, [TyVarBndr_ flag]
z, Maybe Type
w, Con
u, [DerivClause]
v)
      remitter Dec
_ = Maybe
  (Cxt, Name, [TyVarBndr_ flag], Maybe Type, Con, [DerivClause])
forall a. Maybe a
Nothing
#else
_NewtypeD :: Prism' Dec (Cxt, Name, [TyVarBndrUnit], Con, [Name])
_NewtypeD
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w, u) = NewtypeD x y z w u
      remitter (NewtypeD x y z w u) = Just (x, y, z, w, u)
      remitter _ = Nothing
#endif

#if MIN_VERSION_template_haskell(2,11,0)
_DataFamilyD :: Prism' Dec (Name, [TyVarBndrUnit], Maybe Kind)
_DataFamilyD :: p (Name, [TyVarBndr_ flag], Maybe Type)
  (f (Name, [TyVarBndr_ flag], Maybe Type))
-> p Dec (f Dec)
_DataFamilyD
  = ((Name, [TyVarBndr_ flag], Maybe Type) -> Dec)
-> (Dec -> Maybe (Name, [TyVarBndr_ flag], Maybe Type))
-> Prism
     Dec
     Dec
     (Name, [TyVarBndr_ flag], Maybe Type)
     (Name, [TyVarBndr_ flag], Maybe Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [TyVarBndr_ flag], Maybe Type) -> Dec
reviewer Dec -> Maybe (Name, [TyVarBndr_ flag], Maybe Type)
remitter
  where
      reviewer :: (Name, [TyVarBndr_ flag], Maybe Type) -> Dec
reviewer (Name
x, [TyVarBndr_ flag]
y, Maybe Type
z) = Name -> [TyVarBndr_ flag] -> Maybe Type -> Dec
DataFamilyD Name
x [TyVarBndr_ flag]
y Maybe Type
z
      remitter :: Dec -> Maybe (Name, [TyVarBndr_ flag], Maybe Type)
remitter (DataFamilyD Name
x [TyVarBndr_ flag]
y Maybe Type
z) = (Name, [TyVarBndr_ flag], Maybe Type)
-> Maybe (Name, [TyVarBndr_ flag], Maybe Type)
forall a. a -> Maybe a
Just (Name
x, [TyVarBndr_ flag]
y, Maybe Type
z)
      remitter Dec
_ = Maybe (Name, [TyVarBndr_ flag], Maybe Type)
forall a. Maybe a
Nothing

_OpenTypeFamilyD :: Prism' Dec TypeFamilyHead
_OpenTypeFamilyD :: p TypeFamilyHead (f TypeFamilyHead) -> p Dec (f Dec)
_OpenTypeFamilyD
  = (TypeFamilyHead -> Dec)
-> (Dec -> Maybe TypeFamilyHead)
-> Prism Dec Dec TypeFamilyHead TypeFamilyHead
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' TypeFamilyHead -> Dec
reviewer Dec -> Maybe TypeFamilyHead
remitter
  where
      reviewer :: TypeFamilyHead -> Dec
reviewer = TypeFamilyHead -> Dec
OpenTypeFamilyD
      remitter :: Dec -> Maybe TypeFamilyHead
remitter (OpenTypeFamilyD TypeFamilyHead
x) = TypeFamilyHead -> Maybe TypeFamilyHead
forall a. a -> Maybe a
Just TypeFamilyHead
x
      remitter Dec
_ = Maybe TypeFamilyHead
forall a. Maybe a
Nothing
#else
_FamilyD :: Prism' Dec (FamFlavour, Name, [TyVarBndrUnit], Maybe Kind)
_FamilyD
  = prism' reviewer remitter
  where
      reviewer (x, y, z, w) = FamilyD x y z w
      remitter (FamilyD x y z w) = Just (x, y, z, w)
      remitter _ = Nothing
#endif

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

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

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

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

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

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

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

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

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

-- |
-- @
-- _NormalC :: 'Prism'' 'Con' ('Name', ['BangType'])   -- template-haskell-2.11+
-- _NormalC :: 'Prism'' 'Con' ('Name', ['StrictType']) -- Earlier versions
-- @
_NormalC ::
  Prism' Con ( Name
#if MIN_VERSION_template_haskell(2,11,0)
             , [BangType]
#else
             , [StrictType]
#endif
             )
_NormalC :: p (Name, [BangType]) (f (Name, [BangType])) -> p Con (f Con)
_NormalC
  = ((Name, [BangType]) -> Con)
-> (Con -> Maybe (Name, [BangType]))
-> Prism Con Con (Name, [BangType]) (Name, [BangType])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [BangType]) -> Con
reviewer Con -> Maybe (Name, [BangType])
remitter
  where
      reviewer :: (Name, [BangType]) -> Con
reviewer (Name
x, [BangType]
y) = Name -> [BangType] -> Con
NormalC Name
x [BangType]
y
      remitter :: Con -> Maybe (Name, [BangType])
remitter (NormalC Name
x [BangType]
y) = (Name, [BangType]) -> Maybe (Name, [BangType])
forall a. a -> Maybe a
Just (Name
x, [BangType]
y)
      remitter Con
_ = Maybe (Name, [BangType])
forall a. Maybe a
Nothing

-- |
-- @
-- _RecC :: 'Prism'' 'Con' ('Name', ['VarBangType'])   -- template-haskell-2.11+
-- _RecC :: 'Prism'' 'Con' ('Name', ['VarStrictType']) -- Earlier versions
-- @
_RecC ::
  Prism' Con ( Name
#if MIN_VERSION_template_haskell(2,11,0)
             , [VarBangType]
#else
             , [VarStrictType]
#endif
             )
_RecC :: p (Name, [VarBangType]) (f (Name, [VarBangType])) -> p Con (f Con)
_RecC
  = ((Name, [VarBangType]) -> Con)
-> (Con -> Maybe (Name, [VarBangType]))
-> Prism Con Con (Name, [VarBangType]) (Name, [VarBangType])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, [VarBangType]) -> Con
reviewer Con -> Maybe (Name, [VarBangType])
remitter
  where
      reviewer :: (Name, [VarBangType]) -> Con
reviewer (Name
x, [VarBangType]
y) = Name -> [VarBangType] -> Con
RecC Name
x [VarBangType]
y
      remitter :: Con -> Maybe (Name, [VarBangType])
remitter (RecC Name
x [VarBangType]
y) = (Name, [VarBangType]) -> Maybe (Name, [VarBangType])
forall a. a -> Maybe a
Just (Name
x, [VarBangType]
y)
      remitter Con
_ = Maybe (Name, [VarBangType])
forall a. Maybe a
Nothing

-- |
-- @
-- _InfixC :: 'Prism'' 'Con' ('BangType',   'Name', 'BangType')   -- template-haskell-2.11+
-- _InfixC :: 'Prism'' 'Con' ('StrictType', 'Name', 'StrictType') -- Earlier versions
-- @
_InfixC ::
  Prism' Con
#if MIN_VERSION_template_haskell(2,11,0)
             (BangType,   Name, BangType  )
#else
             (StrictType, Name, StrictType)
#endif
_InfixC :: p (BangType, Name, BangType) (f (BangType, Name, BangType))
-> p Con (f Con)
_InfixC
  = ((BangType, Name, BangType) -> Con)
-> (Con -> Maybe (BangType, Name, BangType))
-> Prism
     Con Con (BangType, Name, BangType) (BangType, Name, BangType)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (BangType, Name, BangType) -> Con
reviewer Con -> Maybe (BangType, Name, BangType)
remitter
  where
      reviewer :: (BangType, Name, BangType) -> Con
reviewer (BangType
x, Name
y, BangType
z) = BangType -> Name -> BangType -> Con
InfixC BangType
x Name
y BangType
z
      remitter :: Con -> Maybe (BangType, Name, BangType)
remitter (InfixC BangType
x Name
y BangType
z) = (BangType, Name, BangType) -> Maybe (BangType, Name, BangType)
forall a. a -> Maybe a
Just (BangType
x, Name
y, BangType
z)
      remitter Con
_ = Maybe (BangType, Name, BangType)
forall a. Maybe a
Nothing

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

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

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

#if MIN_VERSION_template_haskell(2,11,0)
_NoSourceUnpackedness :: Prism' SourceUnpackedness ()
_NoSourceUnpackedness :: p () (f ()) -> p SourceUnpackedness (f SourceUnpackedness)
_NoSourceUnpackedness
  = (() -> SourceUnpackedness)
-> (SourceUnpackedness -> Maybe ())
-> Prism SourceUnpackedness SourceUnpackedness () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> SourceUnpackedness
reviewer SourceUnpackedness -> Maybe ()
remitter
  where
      reviewer :: () -> SourceUnpackedness
reviewer () = SourceUnpackedness
NoSourceUnpackedness
      remitter :: SourceUnpackedness -> Maybe ()
remitter SourceUnpackedness
NoSourceUnpackedness = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter SourceUnpackedness
_ = Maybe ()
forall a. Maybe a
Nothing

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

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

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

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

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

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

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

_DecidedUnpack :: Prism' DecidedStrictness ()
_DecidedUnpack :: p () (f ()) -> p DecidedStrictness (f DecidedStrictness)
_DecidedUnpack
  = (() -> DecidedStrictness)
-> (DecidedStrictness -> Maybe ())
-> Prism DecidedStrictness DecidedStrictness () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> DecidedStrictness
reviewer DecidedStrictness -> Maybe ()
remitter
  where
      reviewer :: () -> DecidedStrictness
reviewer () = DecidedStrictness
DecidedUnpack
      remitter :: DecidedStrictness -> Maybe ()
remitter DecidedStrictness
DecidedUnpack = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter DecidedStrictness
_ = Maybe ()
forall a. Maybe a
Nothing
#else
_IsStrict :: Prism' Strict ()
_IsStrict
  = prism' reviewer remitter
  where
      reviewer () = IsStrict
      remitter IsStrict = Just ()
      remitter _ = Nothing

_NotStrict :: Prism' Strict ()
_NotStrict
  = prism' reviewer remitter
  where
      reviewer () = NotStrict
      remitter NotStrict = Just ()
      remitter _ = Nothing

_Unpacked :: Prism' Strict ()
_Unpacked
  = prism' reviewer remitter
  where
      reviewer () = Unpacked
      remitter Unpacked = Just ()
      remitter _ = Nothing
#endif

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

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

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

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

#if MIN_VERSION_template_haskell(2,10,0)
_CApi :: Prism' Callconv ()
_CApi :: p () (f ()) -> p Callconv (f Callconv)
_CApi
  = (() -> Callconv)
-> (Callconv -> Maybe ()) -> Prism Callconv Callconv () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Callconv
reviewer Callconv -> Maybe ()
remitter
  where
      reviewer :: () -> Callconv
reviewer () = Callconv
CApi
      remitter :: Callconv -> Maybe ()
remitter Callconv
CApi = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Callconv
_ = Maybe ()
forall a. Maybe a
Nothing

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

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

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

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

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

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

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

-- TODO add lenses for InlineSpec

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

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

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

#if MIN_VERSION_template_haskell(2,10,0)
_LineP :: Prism' Pragma (Int, String)
_LineP :: p (Int, String) (f (Int, String)) -> p Pragma (f Pragma)
_LineP
  = ((Int, String) -> Pragma)
-> (Pragma -> Maybe (Int, String))
-> Prism Pragma Pragma (Int, String) (Int, String)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Int, String) -> Pragma
reviewer Pragma -> Maybe (Int, String)
remitter
  where
      reviewer :: (Int, String) -> Pragma
reviewer (Int
x, String
y) = Int -> String -> Pragma
LineP Int
x String
y
      remitter :: Pragma -> Maybe (Int, String)
remitter (LineP Int
x String
y) = (Int, String) -> Maybe (Int, String)
forall a. a -> Maybe a
Just (Int
x, String
y)
      remitter Pragma
_ = Maybe (Int, String)
forall a. Maybe a
Nothing
#endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

tySynEqnPatterns :: Lens' TySynEqn [Type]
tySynEqnPatterns :: (Cxt -> f Cxt) -> TySynEqn -> f TySynEqn
tySynEqnPatterns = (TySynEqn -> Cxt)
-> (TySynEqn -> Cxt -> TySynEqn) -> Lens TySynEqn TySynEqn Cxt Cxt
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TySynEqn -> Cxt
g TySynEqn -> Cxt -> TySynEqn
forall (t :: * -> *). Foldable t => TySynEqn -> t Type -> TySynEqn
s where
   g :: TySynEqn -> Cxt
g (TySynEqn Maybe [TyVarBndr_ flag]
_     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_ flag]
mtvbs Type
lhs Type
rhs) t Type
pats = Maybe [TyVarBndr_ flag] -> Type -> Type -> TySynEqn
TySynEqn Maybe [TyVarBndr_ flag]
mtvbs ((Type -> Type -> Type) -> Type -> t Type -> Type
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 :: (Type -> f Type) -> TySynEqn -> f TySynEqn
tySynEqnResult = (TySynEqn -> Type)
-> (TySynEqn -> Type -> TySynEqn)
-> Lens TySynEqn TySynEqn Type Type
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TySynEqn -> Type
g TySynEqn -> Type -> TySynEqn
s where
   g :: TySynEqn -> Type
g (TySynEqn Maybe [TyVarBndr_ flag]
_     Type
_   Type
rhs) = Type
rhs
   s :: TySynEqn -> Type -> TySynEqn
s (TySynEqn Maybe [TyVarBndr_ flag]
mtvbs Type
lhs Type
_)   = Maybe [TyVarBndr_ flag] -> Type -> Type -> TySynEqn
TySynEqn Maybe [TyVarBndr_ flag]
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 :: p () (f ()) -> p FixityDirection (f FixityDirection)
_InfixL
  = (() -> FixityDirection)
-> (FixityDirection -> Maybe ())
-> Prism FixityDirection FixityDirection () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> FixityDirection
reviewer FixityDirection -> Maybe ()
remitter
  where
      reviewer :: () -> FixityDirection
reviewer () = FixityDirection
InfixL
      remitter :: FixityDirection -> Maybe ()
remitter FixityDirection
InfixL = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter FixityDirection
_ = Maybe ()
forall a. Maybe a
Nothing

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#if MIN_VERSION_template_haskell(2,10,0)
_StaticE :: Prism' Exp Exp
_StaticE :: p Exp (f Exp) -> p Exp (f Exp)
_StaticE
  = (Exp -> Exp) -> (Exp -> Maybe Exp) -> Prism Exp Exp Exp Exp
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Exp -> Exp
reviewer Exp -> Maybe Exp
remitter
  where
      reviewer :: Exp -> Exp
reviewer = Exp -> Exp
StaticE
      remitter :: Exp -> Maybe Exp
remitter (StaticE Exp
x) = Exp -> Maybe Exp
forall a. a -> Maybe a
Just Exp
x
      remitter Exp
_ = Maybe Exp
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,11,0)
_UnboundVarE :: Prism' Exp Name
_UnboundVarE :: p Name (f Name) -> p Exp (f Exp)
_UnboundVarE
  = (Name -> Exp) -> (Exp -> Maybe Name) -> Prism Exp Exp Name Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> Exp
reviewer Exp -> Maybe Name
remitter
  where
      reviewer :: Name -> Exp
reviewer = Name -> Exp
UnboundVarE
      remitter :: Exp -> Maybe Name
remitter (UnboundVarE Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter Exp
_ = Maybe Name
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,13,0)
_LabelE :: Prism' Exp String
_LabelE :: p String (f String) -> p Exp (f Exp)
_LabelE
  = (String -> Exp)
-> (Exp -> Maybe String) -> Prism Exp Exp String String
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' String -> Exp
reviewer Exp -> Maybe String
remitter
  where
      reviewer :: String -> Exp
reviewer = String -> Exp
LabelE
      remitter :: Exp -> Maybe String
remitter (LabelE String
x) = String -> Maybe String
forall a. a -> Maybe a
Just String
x
      remitter Exp
_ = Maybe String
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' reviewer remitter
  where
      reviewer (x, y) = MDoE x y
      remitter (MDoE x y) = Just (x, y)
      remitter _ = Nothing
# else
_MDoE :: Prism' Exp [Stmt]
_MDoE :: p [Stmt] (f [Stmt]) -> p Exp (f Exp)
_MDoE
  = ([Stmt] -> Exp)
-> (Exp -> Maybe [Stmt]) -> Prism Exp Exp [Stmt] [Stmt]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Stmt] -> Exp
reviewer Exp -> Maybe [Stmt]
remitter
  where
      reviewer :: [Stmt] -> Exp
reviewer = [Stmt] -> Exp
MDoE
      remitter :: Exp -> Maybe [Stmt]
remitter (MDoE [Stmt]
x) = [Stmt] -> Maybe [Stmt]
forall a. a -> Maybe a
Just [Stmt]
x
      remitter Exp
_ = Maybe [Stmt]
forall a. Maybe a
Nothing
# endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#if MIN_VERSION_template_haskell(2,11,0)
_CharPrimL :: Prism' Lit Char
_CharPrimL :: p Char (f Char) -> p Lit (f Lit)
_CharPrimL
  = (Char -> Lit) -> (Lit -> Maybe Char) -> Prism Lit Lit Char Char
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Char -> Lit
reviewer Lit -> Maybe Char
remitter
  where
      reviewer :: Char -> Lit
reviewer = Char -> Lit
CharPrimL
      remitter :: Lit -> Maybe Char
remitter (CharPrimL Char
x) = Char -> Maybe Char
forall a. a -> Maybe a
Just Char
x
      remitter Lit
_ = Maybe Char
forall a. Maybe a
Nothing
#endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#if MIN_VERSION_template_haskell(2,10,0)
_EqualityT :: Prism' Type ()
_EqualityT :: p () (f ()) -> p Type (f Type)
_EqualityT
  = (() -> Type) -> (Type -> Maybe ()) -> Prism Type Type () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> Type
reviewer Type -> Maybe ()
remitter
  where
      reviewer :: () -> Type
reviewer () = Type
EqualityT
      remitter :: Type -> Maybe ()
remitter Type
EqualityT = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter Type
_ = Maybe ()
forall a. Maybe a
Nothing
#endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#if MIN_VERSION_template_haskell(2,17,0)
_MulArrowT :: Prism' Type ()
_MulArrowT
  = prism' reviewer remitter
  where
      reviewer () = MulArrowT
      remitter MulArrowT = Just ()
      remitter _ = Nothing
#endif

#if MIN_VERSION_template_haskell(2,17,0)
_SpecifiedSpec :: Prism' Specificity ()
_SpecifiedSpec
  = prism' reviewer remitter
  where
      reviewer () = SpecifiedSpec
      remitter SpecifiedSpec = Just ()
      remitter _ = Nothing

_InferredSpec :: Prism' Specificity ()
_InferredSpec
  = prism' reviewer remitter
  where
      reviewer () = InferredSpec
      remitter InferredSpec = 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
  = prism' reviewer remitter
  where
      reviewer (x, y) = PlainTV x y
      remitter (PlainTV x y) = Just (x, y)
      remitter _ = Nothing
#else
_PlainTV :: Prism' TyVarBndr Name
_PlainTV :: p Name (f Name) -> p (TyVarBndr_ flag) (f (TyVarBndr_ flag))
_PlainTV
  = (Name -> TyVarBndr_ flag)
-> (TyVarBndr_ flag -> Maybe Name)
-> Prism (TyVarBndr_ flag) (TyVarBndr_ flag) Name Name
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Name -> TyVarBndr_ flag
reviewer TyVarBndr_ flag -> Maybe Name
remitter
  where
      reviewer :: Name -> TyVarBndr_ flag
reviewer = Name -> TyVarBndr_ flag
PlainTV
      remitter :: TyVarBndr_ flag -> Maybe Name
remitter (PlainTV Name
x) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
x
      remitter TyVarBndr_ flag
_ = Maybe Name
forall a. Maybe a
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
  = prism' reviewer remitter
  where
      reviewer (x, y, z) = KindedTV x y z
      remitter (KindedTV x y z) = Just (x, y, z)
      remitter _ = Nothing
#else
_KindedTV :: Prism' TyVarBndr (Name, Kind)
_KindedTV :: p (Name, Type) (f (Name, Type))
-> p (TyVarBndr_ flag) (f (TyVarBndr_ flag))
_KindedTV
  = ((Name, Type) -> TyVarBndr_ flag)
-> (TyVarBndr_ flag -> Maybe (Name, Type))
-> Prism
     (TyVarBndr_ flag) (TyVarBndr_ flag) (Name, Type) (Name, Type)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Name, Type) -> TyVarBndr_ flag
reviewer TyVarBndr_ flag -> Maybe (Name, Type)
remitter
  where
      reviewer :: (Name, Type) -> TyVarBndr_ flag
reviewer (Name
x, Type
y) = Name -> Type -> TyVarBndr_ flag
KindedTV Name
x Type
y
      remitter :: TyVarBndr_ flag -> Maybe (Name, Type)
remitter (KindedTV Name
x Type
y) = (Name, Type) -> Maybe (Name, Type)
forall a. a -> Maybe a
Just (Name
x, Type
y)
      remitter TyVarBndr_ flag
_ = Maybe (Name, Type)
forall a. Maybe a
Nothing
#endif

#if MIN_VERSION_template_haskell(2,11,0)
_NoSig :: Prism' FamilyResultSig ()
_NoSig :: p () (f ()) -> p FamilyResultSig (f FamilyResultSig)
_NoSig
  = (() -> FamilyResultSig)
-> (FamilyResultSig -> Maybe ())
-> Prism FamilyResultSig FamilyResultSig () ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' () -> FamilyResultSig
reviewer FamilyResultSig -> Maybe ()
remitter
  where
      reviewer :: () -> FamilyResultSig
reviewer () = FamilyResultSig
NoSig
      remitter :: FamilyResultSig -> Maybe ()
remitter FamilyResultSig
NoSig = () -> Maybe ()
forall a. a -> Maybe a
Just ()
      remitter FamilyResultSig
_ = Maybe ()
forall a. Maybe a
Nothing

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

_TyVarSig :: Prism' FamilyResultSig TyVarBndrUnit
_TyVarSig :: p (TyVarBndr_ flag) (f (TyVarBndr_ flag))
-> p FamilyResultSig (f FamilyResultSig)
_TyVarSig
  = (TyVarBndr_ flag -> FamilyResultSig)
-> (FamilyResultSig -> Maybe (TyVarBndr_ flag))
-> Prism
     FamilyResultSig FamilyResultSig (TyVarBndr_ flag) (TyVarBndr_ flag)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' TyVarBndr_ flag -> FamilyResultSig
reviewer FamilyResultSig -> Maybe (TyVarBndr_ flag)
remitter
  where
      reviewer :: TyVarBndr_ flag -> FamilyResultSig
reviewer = TyVarBndr_ flag -> FamilyResultSig
TyVarSig
      remitter :: FamilyResultSig -> Maybe (TyVarBndr_ flag)
remitter (TyVarSig TyVarBndr_ flag
x) = TyVarBndr_ flag -> Maybe (TyVarBndr_ flag)
forall a. a -> Maybe a
Just TyVarBndr_ flag
x
      remitter FamilyResultSig
_ = Maybe (TyVarBndr_ flag)
forall a. Maybe a
Nothing
#endif

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

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

#if !MIN_VERSION_template_haskell(2,10,0)
_ClassP :: Prism' Pred (Name, [Type])
_ClassP
  = prism' reviewer remitter
  where
      reviewer (x, y) = ClassP x y
      remitter (ClassP x y) = Just (x, y)
      remitter _ = Nothing

_EqualP :: Prism' Pred (Type, Type)
_EqualP
  = prism' reviewer remitter
  where
      reviewer (x, y) = EqualP x y
      remitter (EqualP x y) = Just (x, y)
      remitter _ = Nothing
#endif

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

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

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

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

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

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

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