{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
{-# LANGUAGE RecordWildCards #-}
module GHC.Hs.Utils(
mkHsPar, mkHsApp, mkHsAppWith, mkHsApps, mkHsAppsWith, mkHsSyntaxApps,
mkHsAppType, mkHsAppTypes, mkHsCaseAlt,
mkSimpleMatch, unguardedGRHSs, unguardedRHS,
mkMatchGroup, mkLamCaseMatchGroup, mkMatch, mkPrefixFunRhs, mkHsLam, mkHsIf,
mkHsWrap, mkLHsWrap, mkHsWrapCo, mkHsWrapCoR, mkLHsWrapCo,
mkHsDictLet, mkHsLams,
mkHsOpApp, mkHsDo, mkHsDoAnns, mkHsComp, mkHsCompAnns,
mkHsWrapPat, mkLHsWrapPat, mkHsWrapPatCo,
mkLHsPar, mkHsCmdWrap, mkLHsCmdWrap,
mkHsCmdIf, mkConLikeTc,
nlHsTyApp, nlHsTyApps, nlHsVar, nl_HsVar, nlHsDataCon,
nlHsLit, nlHsApp, nlHsApps, nlHsSyntaxApps,
nlHsIntLit, nlHsVarApps,
nlHsDo, nlHsOpApp, nlHsLam, nlHsPar, nlHsIf, nlHsCase, nlList,
mkLHsTupleExpr, mkLHsVarTuple, missingTupArg,
mkLocatedList, nlAscribe,
mkFunBind, mkVarBind, mkHsVarBind, mkSimpleGeneratedFunBind, mkTopFunBind,
mkPatSynBind,
isInfixFunBind,
spanHsLocaLBinds,
mkHsIntegral, mkHsFractional, mkHsIsString, mkHsString, mkHsStringFS, mkHsStringPrimLit,
mkHsCharPrimLit,
mkNPat, mkNPlusKPat, nlVarPat, nlLitPat, nlConVarPat, nlConVarPatName, nlConPat,
nlConPatName, nlInfixConPat, nlNullaryConPat, nlWildConPat, nlWildPat,
nlWildPatName, nlTuplePat, mkParPat, nlParPat,
mkBigLHsVarTup, mkBigLHsTup, mkBigLHsVarPatTup, mkBigLHsPatTup,
mkHsAppTy, mkHsAppKindTy,
hsTypeToHsSigType, hsTypeToHsSigWcType, mkClassOpSigs, mkHsSigEnv,
nlHsAppTy, nlHsAppKindTy, nlHsTyVar, nlHsFunTy, nlHsParTy, nlHsTyConApp,
mkTransformStmt, mkTransformByStmt, mkBodyStmt,
mkPsBindStmt, mkRnBindStmt, mkTcBindStmt,
mkLastStmt,
emptyTransStmt, mkGroupUsingStmt, mkGroupByUsingStmt,
emptyRecStmt, emptyRecStmtName, emptyRecStmtId, mkRecStmt,
unitRecStmtTc,
mkLetStmt,
isUnliftedHsBind, isUnliftedHsBinds, isBangedHsBind,
collectLocalBinders, collectHsValBinders, collectHsBindListBinders,
collectHsIdBinders,
collectHsBindsBinders, collectHsBindBinders, collectMethodBinders,
collectPatBinders, collectPatsBinders,
collectLStmtsBinders, collectStmtsBinders,
collectLStmtBinders, collectStmtBinders,
CollectPass(..), CollectFlag(..),
TyDeclBinders(..), LConsWithFields(..),
hsLTyClDeclBinders, hsTyClForeignBinders,
hsPatSynSelectors, getPatSynBinds,
hsForeignDeclsBinders, hsGroupBinders, hsDataFamInstBinders,
ImplicitFieldBinders(..),
lStmtsImplicits, hsValBindsImplicits, lPatImplicits,
lHsRecFieldsImplicits
) where
import GHC.Prelude hiding (head, init, last, tail)
import GHC.Hs.Decls
import GHC.Hs.Binds
import GHC.Hs.Expr
import GHC.Hs.Pat
import GHC.Hs.Type
import GHC.Hs.Lit
import Language.Haskell.Syntax.Decls
import Language.Haskell.Syntax.Extension
import GHC.Hs.Extension
import GHC.Parser.Annotation
import GHC.Tc.Types.Evidence
import GHC.Core.Coercion( isReflCo )
import GHC.Core.Multiplicity ( pattern ManyTy )
import GHC.Core.DataCon
import GHC.Core.ConLike
import GHC.Core.Make ( mkChunkified )
import GHC.Core.Type ( Type, isUnliftedType )
import GHC.Builtin.Types ( unitTy )
import GHC.Types.Id
import GHC.Types.Name
import GHC.Types.Name.Set hiding ( unitFV )
import GHC.Types.Name.Env
import GHC.Types.Name.Reader
import GHC.Types.Var
import GHC.Types.Basic
import GHC.Types.SrcLoc
import GHC.Types.Fixity
import GHC.Types.SourceText
import GHC.Data.FastString
import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
import Control.Arrow ( first )
import Data.Foldable ( toList )
import Data.List ( partition )
import Data.List.NonEmpty ( nonEmpty )
import qualified Data.List.NonEmpty as NE
import Data.IntMap ( IntMap )
import qualified Data.IntMap.Strict as IntMap
import Data.Map ( Map )
import qualified Data.Map.Strict as Map
mkHsPar :: IsPass p => LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
mkHsPar :: forall (p :: Pass).
IsPass p =>
LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
mkHsPar LHsExpr (GhcPass p)
e = SrcSpanAnnA
-> HsExpr (GhcPass p)
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall l e. l -> e -> GenLocated l e
L (GenLocated SrcSpanAnnA (HsExpr (GhcPass p)) -> SrcSpanAnnA
forall l e. GenLocated l e -> l
getLoc LHsExpr (GhcPass p)
GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
e) (LHsExpr (GhcPass p) -> HsExpr (GhcPass p)
forall (p :: Pass).
IsPass p =>
LHsExpr (GhcPass p) -> HsExpr (GhcPass p)
gHsPar LHsExpr (GhcPass p)
e)
mkSimpleMatch :: (Anno (Match (GhcPass p) (LocatedA (body (GhcPass p))))
~ SrcSpanAnnA,
Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns)
=> HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
-> LocatedE [LPat (GhcPass p)] -> LocatedA (body (GhcPass p))
-> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
mkSimpleMatch :: forall (p :: Pass) (body :: * -> *).
(Anno (Match (GhcPass p) (LocatedA (body (GhcPass p))))
~ SrcSpanAnnA,
Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns) =>
HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
-> LocatedE [LPat (GhcPass p)]
-> LocatedA (body (GhcPass p))
-> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
mkSimpleMatch HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
ctxt (L EpaLocation
l [LPat (GhcPass p)]
pats) LocatedA (body (GhcPass p))
rhs
= SrcSpanAnnA
-> Match (GhcPass p) (LocatedA (body (GhcPass p)))
-> GenLocated
SrcSpanAnnA (Match (GhcPass p) (LocatedA (body (GhcPass p))))
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc (Match (GhcPass p) (LocatedA (body (GhcPass p)))
-> GenLocated
SrcSpanAnnA (Match (GhcPass p) (LocatedA (body (GhcPass p)))))
-> Match (GhcPass p) (LocatedA (body (GhcPass p)))
-> GenLocated
SrcSpanAnnA (Match (GhcPass p) (LocatedA (body (GhcPass p))))
forall a b. (a -> b) -> a -> b
$
Match { m_ext :: XCMatch (GhcPass p) (LocatedA (body (GhcPass p)))
m_ext = XCMatch (GhcPass p) (LocatedA (body (GhcPass p)))
NoExtField
noExtField, m_ctxt :: HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
m_ctxt = HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
ctxt, m_pats :: XRec (GhcPass p) [LPat (GhcPass p)]
m_pats = EpaLocation
-> [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
-> GenLocated
EpaLocation [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
forall l e. l -> e -> GenLocated l e
L EpaLocation
l [LPat (GhcPass p)]
[GenLocated SrcSpanAnnA (Pat (GhcPass p))]
pats
, m_grhss :: GRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
m_grhss = SrcSpan
-> LocatedA (body (GhcPass p))
-> EpAnn GrhsAnn
-> GRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
forall (p :: Pass) (body :: * -> *).
(Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns) =>
SrcSpan
-> LocatedA (body (GhcPass p))
-> EpAnn GrhsAnn
-> GRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
unguardedGRHSs (SrcSpanAnnA -> SrcSpan
forall a. HasLoc a => a -> SrcSpan
locA SrcSpanAnnA
loc) LocatedA (body (GhcPass p))
rhs EpAnn GrhsAnn
forall a. NoAnn a => a
noAnn }
where
loc :: SrcSpanAnnA
loc = case [LPat (GhcPass p)]
pats of
[] -> LocatedA (body (GhcPass p)) -> SrcSpanAnnA
forall l e. GenLocated l e -> l
getLoc LocatedA (body (GhcPass p))
rhs
(LPat (GhcPass p)
pat:[LPat (GhcPass p)]
_) -> SrcSpanAnnA -> SrcSpanAnnA -> SrcSpanAnnA
forall a. Semigroup a => EpAnn a -> EpAnn a -> EpAnn a
combineSrcSpansA (GenLocated SrcSpanAnnA (Pat (GhcPass p)) -> SrcSpanAnnA
forall l e. GenLocated l e -> l
getLoc LPat (GhcPass p)
GenLocated SrcSpanAnnA (Pat (GhcPass p))
pat) (LocatedA (body (GhcPass p)) -> SrcSpanAnnA
forall l e. GenLocated l e -> l
getLoc LocatedA (body (GhcPass p))
rhs)
unguardedGRHSs :: Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns
=> SrcSpan -> LocatedA (body (GhcPass p)) -> EpAnn GrhsAnn
-> GRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
unguardedGRHSs :: forall (p :: Pass) (body :: * -> *).
(Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns) =>
SrcSpan
-> LocatedA (body (GhcPass p))
-> EpAnn GrhsAnn
-> GRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
unguardedGRHSs SrcSpan
loc LocatedA (body (GhcPass p))
rhs EpAnn GrhsAnn
an
= XCGRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
-> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))]
-> HsLocalBinds (GhcPass p)
-> GRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
forall p body.
XCGRHSs p body -> [LGRHS p body] -> HsLocalBinds p -> GRHSs p body
GRHSs XCGRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
EpAnnComments
emptyComments (EpAnn GrhsAnn
-> SrcSpan
-> LocatedA (body (GhcPass p))
-> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))]
forall (p :: Pass) (body :: * -> *).
(Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns) =>
EpAnn GrhsAnn
-> SrcSpan
-> LocatedA (body (GhcPass p))
-> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))]
unguardedRHS EpAnn GrhsAnn
an SrcSpan
loc LocatedA (body (GhcPass p))
rhs) HsLocalBinds (GhcPass p)
forall (a :: Pass) (b :: Pass).
HsLocalBindsLR (GhcPass a) (GhcPass b)
emptyLocalBinds
unguardedRHS :: Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns
=> EpAnn GrhsAnn -> SrcSpan -> LocatedA (body (GhcPass p))
-> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))]
unguardedRHS :: forall (p :: Pass) (body :: * -> *).
(Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns) =>
EpAnn GrhsAnn
-> SrcSpan
-> LocatedA (body (GhcPass p))
-> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))]
unguardedRHS EpAnn GrhsAnn
an SrcSpan
loc LocatedA (body (GhcPass p))
rhs = [EpAnn NoEpAnns
-> GRHS (GhcPass p) (LocatedA (body (GhcPass p)))
-> GenLocated
(EpAnn NoEpAnns) (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
forall l e. l -> e -> GenLocated l e
L (SrcSpan -> EpAnn NoEpAnns
forall e. HasAnnotation e => SrcSpan -> e
noAnnSrcSpan SrcSpan
loc) (XCGRHS (GhcPass p) (LocatedA (body (GhcPass p)))
-> [GuardLStmt (GhcPass p)]
-> LocatedA (body (GhcPass p))
-> GRHS (GhcPass p) (LocatedA (body (GhcPass p)))
forall p body.
XCGRHS p body -> [GuardLStmt p] -> body -> GRHS p body
GRHS XCGRHS (GhcPass p) (LocatedA (body (GhcPass p)))
EpAnn GrhsAnn
an [] LocatedA (body (GhcPass p))
rhs)]
type AnnoBody p body
= ( XMG (GhcPass p) (LocatedA (body (GhcPass p))) ~ Origin
, Anno [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))] ~ SrcSpanAnnL
, Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpanAnnA
)
mkMatchGroup :: AnnoBody p body
=> Origin
-> LocatedL [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatchGroup :: forall (p :: Pass) (body :: * -> *).
AnnoBody p body =>
Origin
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatchGroup Origin
origin LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
matches = MG { mg_ext :: XMG (GhcPass p) (LocatedA (body (GhcPass p)))
mg_ext = XMG (GhcPass p) (LocatedA (body (GhcPass p)))
Origin
origin
, mg_alts :: XRec (GhcPass p) [LMatch (GhcPass p) (LocatedA (body (GhcPass p)))]
mg_alts = XRec (GhcPass p) [LMatch (GhcPass p) (LocatedA (body (GhcPass p)))]
LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
matches }
mkLamCaseMatchGroup :: AnnoBody p body
=> Origin
-> HsLamVariant
-> LocatedL [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkLamCaseMatchGroup :: forall (p :: Pass) (body :: * -> *).
AnnoBody p body =>
Origin
-> HsLamVariant
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkLamCaseMatchGroup Origin
origin HsLamVariant
lam_variant (L SrcSpanAnnL
l [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
matches)
= Origin
-> GenLocated
SrcSpanAnnL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
forall (p :: Pass) (body :: * -> *).
AnnoBody p body =>
Origin
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatchGroup Origin
origin (SrcSpanAnnL
-> [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> GenLocated
SrcSpanAnnL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnL
l ([LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> GenLocated
SrcSpanAnnL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))])
-> [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> GenLocated
SrcSpanAnnL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
forall a b. (a -> b) -> a -> b
$ (LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))
-> LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p)))))
-> [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
forall a b. (a -> b) -> [a] -> [b]
map LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))
-> LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))
fixCtxt [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
matches)
where fixCtxt :: LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))
-> LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))
fixCtxt (L SrcSpanAnnA
a Match (GhcPass p) (LocatedA (body (GhcPass p)))
match) = SrcSpanAnnA
-> Match (GhcPass p) (LocatedA (body (GhcPass p)))
-> LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
a Match (GhcPass p) (LocatedA (body (GhcPass p)))
match{m_ctxt = LamAlt lam_variant}
mkLocatedList :: (Semigroup a, NoAnn an)
=> [GenLocated (EpAnn a) e2] -> LocatedAn an [GenLocated (EpAnn a) e2]
mkLocatedList :: forall a an e2.
(Semigroup a, NoAnn an) =>
[GenLocated (EpAnn a) e2] -> LocatedAn an [GenLocated (EpAnn a) e2]
mkLocatedList [GenLocated (EpAnn a) e2]
ms = case [GenLocated (EpAnn a) e2]
-> Maybe (NonEmpty (GenLocated (EpAnn a) e2))
forall a. [a] -> Maybe (NonEmpty a)
nonEmpty [GenLocated (EpAnn a) e2]
ms of
Maybe (NonEmpty (GenLocated (EpAnn a) e2))
Nothing -> [GenLocated (EpAnn a) e2] -> LocatedAn an [GenLocated (EpAnn a) e2]
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA []
Just NonEmpty (GenLocated (EpAnn a) e2)
ms1 -> EpAnn an
-> [GenLocated (EpAnn a) e2]
-> LocatedAn an [GenLocated (EpAnn a) e2]
forall l e. l -> e -> GenLocated l e
L (SrcSpan -> EpAnn an
forall e. HasAnnotation e => SrcSpan -> e
noAnnSrcSpan (SrcSpan -> EpAnn an) -> SrcSpan -> EpAnn an
forall a b. (a -> b) -> a -> b
$ EpAnn a -> SrcSpan
forall a. HasLoc a => a -> SrcSpan
locA (EpAnn a -> SrcSpan) -> EpAnn a -> SrcSpan
forall a b. (a -> b) -> a -> b
$ GenLocated (EpAnn a) e2 -> GenLocated (EpAnn a) e2 -> EpAnn a
forall a e1 e2.
Semigroup a =>
GenLocated (EpAnn a) e1 -> GenLocated (EpAnn a) e2 -> EpAnn a
combineLocsA (NonEmpty (GenLocated (EpAnn a) e2) -> GenLocated (EpAnn a) e2
forall a. NonEmpty a -> a
NE.head NonEmpty (GenLocated (EpAnn a) e2)
ms1) (NonEmpty (GenLocated (EpAnn a) e2) -> GenLocated (EpAnn a) e2
forall a. NonEmpty a -> a
NE.last NonEmpty (GenLocated (EpAnn a) e2)
ms1)) [GenLocated (EpAnn a) e2]
ms
mkHsApp :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsApp :: forall (id :: Pass).
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsApp LHsExpr (GhcPass id)
e1 LHsExpr (GhcPass id)
e2 = GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
-> HsExpr (GhcPass id)
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
forall a b l c.
(HasLoc a, HasLoc b, HasAnnotation l) =>
a -> b -> c -> GenLocated l c
addCLocA LHsExpr (GhcPass id)
GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
e1 LHsExpr (GhcPass id)
GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
e2 (XApp (GhcPass id)
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
forall p. XApp p -> LHsExpr p -> LHsExpr p -> HsExpr p
HsApp XApp (GhcPass id)
NoExtField
noExtField LHsExpr (GhcPass id)
e1 LHsExpr (GhcPass id)
e2)
mkHsAppWith
:: (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id))
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
mkHsAppWith :: forall (id :: Pass).
(LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id))
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
mkHsAppWith LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
mkLocated LHsExpr (GhcPass id)
e1 LHsExpr (GhcPass id)
e2 = LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
mkLocated LHsExpr (GhcPass id)
e1 LHsExpr (GhcPass id)
e2 (XApp (GhcPass id)
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
forall p. XApp p -> LHsExpr p -> LHsExpr p -> HsExpr p
HsApp XApp (GhcPass id)
NoExtField
noExtField LHsExpr (GhcPass id)
e1 LHsExpr (GhcPass id)
e2)
mkHsApps
:: LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
mkHsApps :: forall (id :: Pass).
LHsExpr (GhcPass id)
-> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
mkHsApps = (XRec (GhcPass id) (HsExpr (GhcPass id))
-> XRec (GhcPass id) (HsExpr (GhcPass id))
-> HsExpr (GhcPass id)
-> XRec (GhcPass id) (HsExpr (GhcPass id)))
-> XRec (GhcPass id) (HsExpr (GhcPass id))
-> [XRec (GhcPass id) (HsExpr (GhcPass id))]
-> XRec (GhcPass id) (HsExpr (GhcPass id))
forall (id :: Pass).
(LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id))
-> LHsExpr (GhcPass id)
-> [LHsExpr (GhcPass id)]
-> LHsExpr (GhcPass id)
mkHsAppsWith XRec (GhcPass id) (HsExpr (GhcPass id))
-> XRec (GhcPass id) (HsExpr (GhcPass id))
-> HsExpr (GhcPass id)
-> XRec (GhcPass id) (HsExpr (GhcPass id))
GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
-> HsExpr (GhcPass id)
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
forall a b l c.
(HasLoc a, HasLoc b, HasAnnotation l) =>
a -> b -> c -> GenLocated l c
addCLocA
mkHsAppsWith
:: (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id))
-> LHsExpr (GhcPass id)
-> [LHsExpr (GhcPass id)]
-> LHsExpr (GhcPass id)
mkHsAppsWith :: forall (id :: Pass).
(LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id))
-> LHsExpr (GhcPass id)
-> [LHsExpr (GhcPass id)]
-> LHsExpr (GhcPass id)
mkHsAppsWith LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
mkLocated = (GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id)))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
-> [GenLocated SrcSpanAnnA (HsExpr (GhcPass id))]
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' ((LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id))
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
forall (id :: Pass).
(LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id))
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
mkHsAppWith LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
mkLocated)
mkHsAppType :: LHsExpr GhcRn -> LHsWcType GhcRn -> LHsExpr GhcRn
mkHsAppType :: LHsExpr (GhcPass 'Renamed)
-> LHsWcType (GhcPass 'Renamed) -> LHsExpr (GhcPass 'Renamed)
mkHsAppType LHsExpr (GhcPass 'Renamed)
e LHsWcType (GhcPass 'Renamed)
t = GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
-> HsExpr (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
forall a b l c.
(HasLoc a, HasLoc b, HasAnnotation l) =>
a -> b -> c -> GenLocated l c
addCLocA GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed))
t_body LHsExpr (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
e (XAppTypeE (GhcPass 'Renamed)
-> LHsExpr (GhcPass 'Renamed)
-> LHsWcType (NoGhcTc (GhcPass 'Renamed))
-> HsExpr (GhcPass 'Renamed)
forall p.
XAppTypeE p -> LHsExpr p -> LHsWcType (NoGhcTc p) -> HsExpr p
HsAppType XAppTypeE (GhcPass 'Renamed)
NoExtField
noExtField LHsExpr (GhcPass 'Renamed)
e LHsWcType (NoGhcTc (GhcPass 'Renamed))
HsWildCardBndrs
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)))
paren_wct)
where
t_body :: GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed))
t_body = HsWildCardBndrs
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)))
-> GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed))
forall pass thing. HsWildCardBndrs pass thing -> thing
hswc_body LHsWcType (GhcPass 'Renamed)
HsWildCardBndrs
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)))
t
paren_wct :: HsWildCardBndrs
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)))
paren_wct = LHsWcType (GhcPass 'Renamed)
t { hswc_body = t_body }
mkHsAppTypes :: LHsExpr GhcRn -> [LHsWcType GhcRn] -> LHsExpr GhcRn
mkHsAppTypes :: LHsExpr (GhcPass 'Renamed)
-> [LHsWcType (GhcPass 'Renamed)] -> LHsExpr (GhcPass 'Renamed)
mkHsAppTypes = (GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
-> HsWildCardBndrs
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
-> [HsWildCardBndrs
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)))]
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' LHsExpr (GhcPass 'Renamed)
-> LHsWcType (GhcPass 'Renamed) -> LHsExpr (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
-> HsWildCardBndrs
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
mkHsAppType
mkHsLam :: (IsPass p, XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ Origin)
=> LocatedE [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> LHsExpr (GhcPass p)
mkHsLam :: forall (p :: Pass).
(IsPass p, XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ Origin) =>
LocatedE [LPat (GhcPass p)]
-> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
mkHsLam (L EpaLocation
l [LPat (GhcPass p)]
pats) LHsExpr (GhcPass p)
body = LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
forall (p :: Pass).
IsPass p =>
LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
mkHsPar (SrcSpanAnnA -> HsExpr (GhcPass p) -> LocatedA (HsExpr (GhcPass p))
forall l e. l -> e -> GenLocated l e
L (LocatedA (HsExpr (GhcPass p)) -> SrcSpanAnnA
forall l e. GenLocated l e -> l
getLoc LHsExpr (GhcPass p)
LocatedA (HsExpr (GhcPass p))
body) (XLam (GhcPass p)
-> HsLamVariant
-> MatchGroup (GhcPass p) (LHsExpr (GhcPass p))
-> HsExpr (GhcPass p)
forall p.
XLam p -> HsLamVariant -> MatchGroup p (LHsExpr p) -> HsExpr p
HsLam XLam (GhcPass p)
EpAnnLam
forall a. NoAnn a => a
noAnn HsLamVariant
LamSingle MatchGroup (GhcPass p) (LHsExpr (GhcPass p))
MatchGroup (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
matches))
where
matches :: MatchGroup (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
matches = Origin
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
forall (p :: Pass) (body :: * -> *).
AnnoBody p body =>
Origin
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatchGroup (GenReason -> DoPmc -> Origin
Generated GenReason
OtherExpansion DoPmc
SkipPmc)
([LocatedA (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p))))]
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p))))]
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA [HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
-> GenLocated EpaLocation [LPat (GhcPass p)]
-> LocatedA (HsExpr (GhcPass p))
-> LMatch (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
forall (p :: Pass) (body :: * -> *).
(Anno (Match (GhcPass p) (LocatedA (body (GhcPass p))))
~ SrcSpanAnnA,
Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns) =>
HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
-> LocatedE [LPat (GhcPass p)]
-> LocatedA (body (GhcPass p))
-> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
mkSimpleMatch (HsLamVariant
-> HsMatchContext
(GenLocated
(Anno (IdGhcP (NoGhcTcPass p))) (IdGhcP (NoGhcTcPass p)))
forall fn. HsLamVariant -> HsMatchContext fn
LamAlt HsLamVariant
LamSingle) (EpaLocation
-> [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
-> GenLocated
EpaLocation [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
forall l e. l -> e -> GenLocated l e
L EpaLocation
l [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
pats') LHsExpr (GhcPass p)
LocatedA (HsExpr (GhcPass p))
body])
pats' :: [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
pats' = (GenLocated SrcSpanAnnA (Pat (GhcPass p))
-> GenLocated SrcSpanAnnA (Pat (GhcPass p)))
-> [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
-> [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
forall a b. (a -> b) -> [a] -> [b]
map (PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
forall (p :: Pass).
IsPass p =>
PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
parenthesizePat PprPrec
appPrec) [LPat (GhcPass p)]
[GenLocated SrcSpanAnnA (Pat (GhcPass p))]
pats
mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsLams :: [Id] -> [Id] -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsLams [Id]
tyvars [Id]
dicts LHsExpr GhcTc
expr = HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap ([Id] -> HsWrapper
mkWpTyLams [Id]
tyvars
HsWrapper -> HsWrapper -> HsWrapper
<.> [Id] -> HsWrapper
mkWpEvLams [Id]
dicts) LHsExpr GhcTc
expr
mkHsSyntaxApps :: SrcSpanAnnA -> SyntaxExprTc -> [LHsExpr GhcTc]
-> LHsExpr GhcTc
mkHsSyntaxApps :: SrcSpanAnnA -> SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
mkHsSyntaxApps SrcSpanAnnA
ann (SyntaxExprTc { syn_expr :: SyntaxExprTc -> HsExpr GhcTc
syn_expr = HsExpr GhcTc
fun
, syn_arg_wraps :: SyntaxExprTc -> [HsWrapper]
syn_arg_wraps = [HsWrapper]
arg_wraps
, syn_res_wrap :: SyntaxExprTc -> HsWrapper
syn_res_wrap = HsWrapper
res_wrap }) [LHsExpr GhcTc]
args
= HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap HsWrapper
res_wrap ((GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc))
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> [GenLocated SrcSpanAnnA (HsExpr GhcTc)]
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' LHsExpr GhcTc -> LHsExpr GhcTc -> LHsExpr GhcTc
GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall (id :: Pass).
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsApp (SrcSpanAnnA
-> HsExpr GhcTc -> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
ann HsExpr GhcTc
fun) (String
-> (HsWrapper
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc))
-> [HsWrapper]
-> [GenLocated SrcSpanAnnA (HsExpr GhcTc)]
-> [GenLocated SrcSpanAnnA (HsExpr GhcTc)]
forall a b c.
HasDebugCallStack =>
String -> (a -> b -> c) -> [a] -> [b] -> [c]
zipWithEqual String
"mkHsSyntaxApps"
HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
HsWrapper
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
mkLHsWrap [HsWrapper]
arg_wraps [LHsExpr GhcTc]
[GenLocated SrcSpanAnnA (HsExpr GhcTc)]
args))
mkHsSyntaxApps SrcSpanAnnA
_ SyntaxExprTc
NoSyntaxExprTc [LHsExpr GhcTc]
args = String -> SDoc -> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"mkHsSyntaxApps" ([GenLocated SrcSpanAnnA (HsExpr GhcTc)] -> SDoc
forall a. Outputable a => a -> SDoc
ppr [LHsExpr GhcTc]
[GenLocated SrcSpanAnnA (HsExpr GhcTc)]
args)
mkHsCaseAlt :: (Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns,
Anno (Match (GhcPass p) (LocatedA (body (GhcPass p))))
~ SrcSpanAnnA)
=> LPat (GhcPass p) -> (LocatedA (body (GhcPass p)))
-> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
mkHsCaseAlt :: forall (p :: Pass) (body :: * -> *).
(Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns,
Anno (Match (GhcPass p) (LocatedA (body (GhcPass p))))
~ SrcSpanAnnA) =>
LPat (GhcPass p)
-> LocatedA (body (GhcPass p))
-> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
mkHsCaseAlt (L SrcSpanAnnA
l Pat (GhcPass p)
pat) LocatedA (body (GhcPass p))
expr
= HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
-> LocatedE [LPat (GhcPass p)]
-> LocatedA (body (GhcPass p))
-> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
forall (p :: Pass) (body :: * -> *).
(Anno (Match (GhcPass p) (LocatedA (body (GhcPass p))))
~ SrcSpanAnnA,
Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns) =>
HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
-> LocatedE [LPat (GhcPass p)]
-> LocatedA (body (GhcPass p))
-> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
mkSimpleMatch HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
HsMatchContext
(GenLocated
(Anno (IdGhcP (NoGhcTcPass p))) (IdGhcP (NoGhcTcPass p)))
forall fn. HsMatchContext fn
CaseAlt (EpaLocation
-> [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
-> GenLocated
EpaLocation [GenLocated SrcSpanAnnA (Pat (GhcPass p))]
forall l e. l -> e -> GenLocated l e
L (SrcSpanAnnA -> EpaLocation
forall a b. (HasLoc a, HasAnnotation b) => a -> b
l2l SrcSpanAnnA
l) [SrcSpanAnnA
-> Pat (GhcPass p) -> GenLocated SrcSpanAnnA (Pat (GhcPass p))
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
l Pat (GhcPass p)
pat]) LocatedA (body (GhcPass p))
expr
nlHsTyApp :: Id -> [Type] -> LHsExpr GhcTc
nlHsTyApp :: Id -> [Type] -> LHsExpr GhcTc
nlHsTyApp Id
fun_id [Type]
tys
= HsExpr GhcTc -> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap ([Type] -> HsWrapper
mkWpTyApps [Type]
tys) (XVar GhcTc -> LIdP GhcTc -> HsExpr GhcTc
forall p. XVar p -> LIdP p -> HsExpr p
HsVar XVar GhcTc
NoExtField
noExtField (Id -> GenLocated SrcSpanAnnN Id
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA Id
fun_id)))
nlHsTyApps :: Id -> [Type] -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsTyApps :: Id -> [Type] -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsTyApps Id
fun_id [Type]
tys [LHsExpr GhcTc]
xs = (GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc))
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> [GenLocated SrcSpanAnnA (HsExpr GhcTc)]
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' LHsExpr GhcTc -> LHsExpr GhcTc -> LHsExpr GhcTc
GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
-> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall (id :: Pass).
IsPass id =>
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsApp (Id -> [Type] -> LHsExpr GhcTc
nlHsTyApp Id
fun_id [Type]
tys) [LHsExpr GhcTc]
[GenLocated SrcSpanAnnA (HsExpr GhcTc)]
xs
mkLHsPar :: IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkLHsPar :: forall (p :: Pass).
IsPass p =>
LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
mkLHsPar = PprPrec
-> XRec (GhcPass id) (HsExpr (GhcPass id))
-> XRec (GhcPass id) (HsExpr (GhcPass id))
forall (p :: Pass).
IsPass p =>
PprPrec -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
parenthesizeHsExpr PprPrec
appPrec
mkParPat :: IsPass p => LPat (GhcPass p) -> LPat (GhcPass p)
mkParPat :: forall (p :: Pass).
IsPass p =>
LPat (GhcPass p) -> LPat (GhcPass p)
mkParPat = PprPrec
-> XRec (GhcPass p) (Pat (GhcPass p))
-> XRec (GhcPass p) (Pat (GhcPass p))
forall (p :: Pass).
IsPass p =>
PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
parenthesizePat PprPrec
appPrec
nlParPat :: IsPass p => LPat (GhcPass p) -> LPat (GhcPass p)
nlParPat :: forall (p :: Pass).
IsPass p =>
LPat (GhcPass p) -> LPat (GhcPass p)
nlParPat LPat (GhcPass p)
p = Pat (GhcPass p) -> GenLocated SrcSpanAnnA (Pat (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (LPat (GhcPass p) -> Pat (GhcPass p)
forall (p :: Pass). IsPass p => LPat (GhcPass p) -> Pat (GhcPass p)
gParPat LPat (GhcPass p)
p)
mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
mkHsFractional :: FractionalLit -> HsOverLit GhcPs
mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs
mkHsDo :: HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs
mkHsDoAnns :: HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> AnnList -> HsExpr GhcPs
mkHsComp :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> HsExpr GhcPs
mkHsCompAnns :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> AnnList
-> HsExpr GhcPs
mkNPat :: LocatedAn NoEpAnns (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> EpToken "-"
-> Pat GhcPs
mkNPlusKPat :: LocatedN RdrName -> LocatedAn NoEpAnns (HsOverLit GhcPs) -> EpaLocation
-> Pat GhcPs
mkLastStmt :: IsPass idR => LocatedA (bodyR (GhcPass idR))
-> StmtLR (GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR)))
mkBodyStmt :: LocatedA (bodyR GhcPs)
-> StmtLR (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs))
mkPsBindStmt :: EpUniToken "<-" "←" -> LPat GhcPs -> LocatedA (bodyR GhcPs)
-> StmtLR GhcPs GhcPs (LocatedA (bodyR GhcPs))
mkRnBindStmt :: LPat GhcRn -> LocatedA (bodyR GhcRn)
-> StmtLR GhcRn GhcRn (LocatedA (bodyR GhcRn))
mkTcBindStmt :: LPat GhcTc -> LocatedA (bodyR GhcTc)
-> StmtLR GhcTc GhcTc (LocatedA (bodyR GhcTc))
emptyRecStmt :: (Anno [GenLocated
(Anno (StmtLR (GhcPass idL) GhcPs bodyR))
(StmtLR (GhcPass idL) GhcPs bodyR)]
~ SrcSpanAnnL)
=> StmtLR (GhcPass idL) GhcPs bodyR
emptyRecStmtName :: (Anno [GenLocated
(Anno (StmtLR GhcRn GhcRn bodyR))
(StmtLR GhcRn GhcRn bodyR)]
~ SrcSpanAnnL)
=> StmtLR GhcRn GhcRn bodyR
emptyRecStmtId :: Stmt GhcTc (LocatedA (HsCmd GhcTc))
mkRecStmt :: forall (idL :: Pass) bodyR.
(Anno [GenLocated
(Anno (StmtLR (GhcPass idL) GhcPs bodyR))
(StmtLR (GhcPass idL) GhcPs bodyR)]
~ SrcSpanAnnL)
=> AnnList
-> LocatedL [LStmtLR (GhcPass idL) GhcPs bodyR]
-> StmtLR (GhcPass idL) GhcPs bodyR
mkRecStmt :: forall (idL :: Pass) bodyR.
(Anno
[GenLocated
(Anno (StmtLR (GhcPass idL) GhcPs bodyR))
(StmtLR (GhcPass idL) GhcPs bodyR)]
~ SrcSpanAnnL) =>
AnnList
-> LocatedL [LStmtLR (GhcPass idL) GhcPs bodyR]
-> StmtLR (GhcPass idL) GhcPs bodyR
mkRecStmt AnnList
anns LocatedL [LStmtLR (GhcPass idL) GhcPs bodyR]
stmts = (XRecStmt (GhcPass idL) GhcPs bodyR
-> StmtLR (GhcPass idL) GhcPs bodyR
forall (idL :: Pass) (idR :: Pass) body.
(WrapXRec (GhcPass idR) [LStmtLR (GhcPass idL) (GhcPass idR) body],
IsPass idR) =>
XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
emptyRecStmt' XRecStmt (GhcPass idL) GhcPs bodyR
AnnList
anns :: StmtLR (GhcPass idL) GhcPs bodyR)
{ recS_stmts = stmts }
mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
mkHsIntegral IntegralLit
i = XOverLit GhcPs -> OverLitVal -> HsOverLit GhcPs
forall p. XOverLit p -> OverLitVal -> HsOverLit p
OverLit XOverLit GhcPs
NoExtField
noExtField (IntegralLit -> OverLitVal
HsIntegral IntegralLit
i)
mkHsFractional :: FractionalLit -> HsOverLit GhcPs
mkHsFractional FractionalLit
f = XOverLit GhcPs -> OverLitVal -> HsOverLit GhcPs
forall p. XOverLit p -> OverLitVal -> HsOverLit p
OverLit XOverLit GhcPs
NoExtField
noExtField (FractionalLit -> OverLitVal
HsFractional FractionalLit
f)
mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs
mkHsIsString SourceText
src FastString
s = XOverLit GhcPs -> OverLitVal -> HsOverLit GhcPs
forall p. XOverLit p -> OverLitVal -> HsOverLit p
OverLit XOverLit GhcPs
NoExtField
noExtField (SourceText -> FastString -> OverLitVal
HsIsString SourceText
src FastString
s)
mkHsDo :: HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs
mkHsDo HsDoFlavour
ctxt LocatedL [ExprLStmt GhcPs]
stmts = XDo GhcPs
-> HsDoFlavour -> XRec GhcPs [ExprLStmt GhcPs] -> HsExpr GhcPs
forall p. XDo p -> HsDoFlavour -> XRec p [ExprLStmt p] -> HsExpr p
HsDo XDo GhcPs
AnnList
forall a. NoAnn a => a
noAnn HsDoFlavour
ctxt XRec GhcPs [ExprLStmt GhcPs]
LocatedL [ExprLStmt GhcPs]
stmts
mkHsDoAnns :: HsDoFlavour
-> LocatedL [ExprLStmt GhcPs] -> AnnList -> HsExpr GhcPs
mkHsDoAnns HsDoFlavour
ctxt LocatedL [ExprLStmt GhcPs]
stmts AnnList
anns = XDo GhcPs
-> HsDoFlavour -> XRec GhcPs [ExprLStmt GhcPs] -> HsExpr GhcPs
forall p. XDo p -> HsDoFlavour -> XRec p [ExprLStmt p] -> HsExpr p
HsDo XDo GhcPs
AnnList
anns HsDoFlavour
ctxt XRec GhcPs [ExprLStmt GhcPs]
LocatedL [ExprLStmt GhcPs]
stmts
mkHsComp :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> HsExpr GhcPs
mkHsComp HsDoFlavour
ctxt [ExprLStmt GhcPs]
stmts LHsExpr GhcPs
expr = HsDoFlavour
-> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> AnnList -> HsExpr GhcPs
mkHsCompAnns HsDoFlavour
ctxt [ExprLStmt GhcPs]
stmts LHsExpr GhcPs
expr AnnList
forall a. NoAnn a => a
noAnn
mkHsCompAnns :: HsDoFlavour
-> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> AnnList -> HsExpr GhcPs
mkHsCompAnns HsDoFlavour
ctxt [ExprLStmt GhcPs]
stmts expr :: LHsExpr GhcPs
expr@(L SrcSpanAnnA
l HsExpr GhcPs
e) AnnList
anns = HsDoFlavour
-> LocatedL [ExprLStmt GhcPs] -> AnnList -> HsExpr GhcPs
mkHsDoAnns HsDoFlavour
ctxt (SrcSpanAnnL
-> [GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
-> GenLocated
SrcSpanAnnL
[GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnL
loc ([ExprLStmt GhcPs]
[GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
stmts [GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
-> [GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
-> [GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
forall a. [a] -> [a] -> [a]
++ [GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))
last_stmt])) AnnList
anns
where
last :: StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs))
last = LocatedA (HsExpr GhcPs)
-> StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs))
forall (idR :: Pass) (bodyR :: * -> *) (idL :: Pass).
IsPass idR =>
LocatedA (bodyR (GhcPass idR))
-> StmtLR
(GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR)))
mkLastStmt (SrcSpanAnnA -> HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall l e. l -> e -> GenLocated l e
L (SrcSpan -> SrcSpanAnnA
forall e. HasAnnotation e => SrcSpan -> e
noAnnSrcSpan (SrcSpan -> SrcSpanAnnA) -> SrcSpan -> SrcSpanAnnA
forall a b. (a -> b) -> a -> b
$ LocatedA (HsExpr GhcPs) -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA LHsExpr GhcPs
LocatedA (HsExpr GhcPs)
expr) HsExpr GhcPs
e)
last_stmt :: GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))
last_stmt = SrcSpanAnnA
-> StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs))
-> GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
l StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs))
last
loc :: SrcSpanAnnL
loc = SrcSpan -> SrcSpanAnnL
forall e. HasAnnotation e => SrcSpan -> e
noAnnSrcSpan (SrcSpan -> SrcSpanAnnL) -> SrcSpan -> SrcSpanAnnL
forall a b. (a -> b) -> a -> b
$ [GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
-> SrcSpan
forall a. HasLoc a => [a] -> SrcSpan
getHasLocList (GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))
last_stmtGenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))
-> [GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
-> [GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
forall a. a -> [a] -> [a]
:[ExprLStmt GhcPs]
[GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
stmts)
mkHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> AnnsIf
-> HsExpr GhcPs
mkHsIf :: LHsExpr GhcPs
-> LHsExpr GhcPs -> LHsExpr GhcPs -> AnnsIf -> HsExpr GhcPs
mkHsIf LHsExpr GhcPs
c LHsExpr GhcPs
a LHsExpr GhcPs
b AnnsIf
anns = XIf GhcPs
-> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
forall p. XIf p -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p
HsIf XIf GhcPs
AnnsIf
anns LHsExpr GhcPs
c LHsExpr GhcPs
a LHsExpr GhcPs
b
mkHsCmdIf :: LHsExpr GhcPs -> LHsCmd GhcPs -> LHsCmd GhcPs -> AnnsIf
-> HsCmd GhcPs
mkHsCmdIf :: LHsExpr GhcPs
-> LHsCmd GhcPs -> LHsCmd GhcPs -> AnnsIf -> HsCmd GhcPs
mkHsCmdIf LHsExpr GhcPs
c LHsCmd GhcPs
a LHsCmd GhcPs
b AnnsIf
anns = XCmdIf GhcPs
-> SyntaxExpr GhcPs
-> LHsExpr GhcPs
-> LHsCmd GhcPs
-> LHsCmd GhcPs
-> HsCmd GhcPs
forall id.
XCmdIf id
-> SyntaxExpr id
-> LHsExpr id
-> LHsCmd id
-> LHsCmd id
-> HsCmd id
HsCmdIf XCmdIf GhcPs
AnnsIf
anns SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr LHsExpr GhcPs
c LHsCmd GhcPs
a LHsCmd GhcPs
b
mkNPat :: LocatedAn NoEpAnns (HsOverLit GhcPs)
-> Maybe (SyntaxExpr GhcPs) -> EpToken "-" -> Pat GhcPs
mkNPat LocatedAn NoEpAnns (HsOverLit GhcPs)
lit Maybe (SyntaxExpr GhcPs)
neg EpToken "-"
anns = XNPat GhcPs
-> XRec GhcPs (HsOverLit GhcPs)
-> Maybe (SyntaxExpr GhcPs)
-> SyntaxExpr GhcPs
-> Pat GhcPs
forall p.
XNPat p
-> XRec p (HsOverLit p)
-> Maybe (SyntaxExpr p)
-> SyntaxExpr p
-> Pat p
NPat XNPat GhcPs
EpToken "-"
anns XRec GhcPs (HsOverLit GhcPs)
LocatedAn NoEpAnns (HsOverLit GhcPs)
lit Maybe (SyntaxExpr GhcPs)
neg SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr
mkNPlusKPat :: LocatedN RdrName
-> LocatedAn NoEpAnns (HsOverLit GhcPs) -> EpaLocation -> Pat GhcPs
mkNPlusKPat LocatedN RdrName
id LocatedAn NoEpAnns (HsOverLit GhcPs)
lit EpaLocation
anns
= XNPlusKPat GhcPs
-> LIdP GhcPs
-> XRec GhcPs (HsOverLit GhcPs)
-> HsOverLit GhcPs
-> SyntaxExpr GhcPs
-> SyntaxExpr GhcPs
-> Pat GhcPs
forall p.
XNPlusKPat p
-> LIdP p
-> XRec p (HsOverLit p)
-> HsOverLit p
-> SyntaxExpr p
-> SyntaxExpr p
-> Pat p
NPlusKPat XNPlusKPat GhcPs
EpaLocation
anns LIdP GhcPs
LocatedN RdrName
id XRec GhcPs (HsOverLit GhcPs)
LocatedAn NoEpAnns (HsOverLit GhcPs)
lit (LocatedAn NoEpAnns (HsOverLit GhcPs) -> HsOverLit GhcPs
forall l e. GenLocated l e -> e
unLoc LocatedAn NoEpAnns (HsOverLit GhcPs)
lit) SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr
mkTransformStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkTransformByStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkGroupUsingStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkGroupByUsingStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyTransStmt :: AnnTransStmt -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyTransStmt :: AnnTransStmt -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyTransStmt AnnTransStmt
anns = TransStmt { trS_ext :: XTransStmt GhcPs GhcPs (LocatedA (HsExpr GhcPs))
trS_ext = XTransStmt GhcPs GhcPs (LocatedA (HsExpr GhcPs))
AnnTransStmt
anns
, trS_form :: TransForm
trS_form = String -> TransForm
forall a. HasCallStack => String -> a
panic String
"emptyTransStmt: form"
, trS_stmts :: [ExprLStmt GhcPs]
trS_stmts = [], trS_bndrs :: [(IdP GhcPs, IdP GhcPs)]
trS_bndrs = []
, trS_by :: Maybe (LHsExpr GhcPs)
trS_by = Maybe (LHsExpr GhcPs)
Maybe (LocatedA (HsExpr GhcPs))
forall a. Maybe a
Nothing, trS_using :: LHsExpr GhcPs
trS_using = HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA HsExpr GhcPs
forall (p :: Pass). HsExpr (GhcPass p)
noExpr
, trS_ret :: SyntaxExpr GhcPs
trS_ret = SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr, trS_bind :: SyntaxExpr GhcPs
trS_bind = SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr
, trS_fmap :: HsExpr GhcPs
trS_fmap = HsExpr GhcPs
forall (p :: Pass). HsExpr (GhcPass p)
noExpr }
mkTransformStmt :: AnnTransStmt
-> [ExprLStmt GhcPs]
-> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkTransformStmt AnnTransStmt
a [ExprLStmt GhcPs]
ss LHsExpr GhcPs
u = (AnnTransStmt -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyTransStmt AnnTransStmt
a) { trS_form = ThenForm, trS_stmts = ss, trS_using = u }
mkTransformByStmt :: AnnTransStmt
-> [ExprLStmt GhcPs]
-> LHsExpr GhcPs
-> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkTransformByStmt AnnTransStmt
a [ExprLStmt GhcPs]
ss LHsExpr GhcPs
u LHsExpr GhcPs
b = (AnnTransStmt -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyTransStmt AnnTransStmt
a) { trS_form = ThenForm, trS_stmts = ss, trS_using = u, trS_by = Just b }
mkGroupUsingStmt :: AnnTransStmt
-> [ExprLStmt GhcPs]
-> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkGroupUsingStmt AnnTransStmt
a [ExprLStmt GhcPs]
ss LHsExpr GhcPs
u = (AnnTransStmt -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyTransStmt AnnTransStmt
a) { trS_form = GroupForm, trS_stmts = ss, trS_using = u }
mkGroupByUsingStmt :: AnnTransStmt
-> [ExprLStmt GhcPs]
-> LHsExpr GhcPs
-> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkGroupByUsingStmt AnnTransStmt
a [ExprLStmt GhcPs]
ss LHsExpr GhcPs
b LHsExpr GhcPs
u = (AnnTransStmt -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyTransStmt AnnTransStmt
a) { trS_form = GroupForm, trS_stmts = ss, trS_using = u, trS_by = Just b }
mkLastStmt :: forall (idR :: Pass) (bodyR :: * -> *) (idL :: Pass).
IsPass idR =>
LocatedA (bodyR (GhcPass idR))
-> StmtLR
(GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR)))
mkLastStmt LocatedA (bodyR (GhcPass idR))
body = XLastStmt
(GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR)))
-> LocatedA (bodyR (GhcPass idR))
-> Maybe Bool
-> SyntaxExpr (GhcPass idR)
-> StmtLR
(GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR)))
forall idL idR body.
XLastStmt idL idR body
-> body -> Maybe Bool -> SyntaxExpr idR -> StmtLR idL idR body
LastStmt XLastStmt
(GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR)))
NoExtField
noExtField LocatedA (bodyR (GhcPass idR))
body Maybe Bool
forall a. Maybe a
Nothing SyntaxExpr (GhcPass idR)
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr
mkBodyStmt :: forall (bodyR :: * -> *) (idL :: Pass).
LocatedA (bodyR GhcPs)
-> StmtLR (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs))
mkBodyStmt LocatedA (bodyR GhcPs)
body
= XBodyStmt (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs))
-> LocatedA (bodyR GhcPs)
-> SyntaxExpr GhcPs
-> SyntaxExpr GhcPs
-> StmtLR (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs))
forall idL idR body.
XBodyStmt idL idR body
-> body -> SyntaxExpr idR -> SyntaxExpr idR -> StmtLR idL idR body
BodyStmt XBodyStmt (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs))
NoExtField
noExtField LocatedA (bodyR GhcPs)
body SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr
mkPsBindStmt :: forall (bodyR :: * -> *).
EpUniToken "<-" "\8592"
-> LPat GhcPs
-> LocatedA (bodyR GhcPs)
-> StmtLR GhcPs GhcPs (LocatedA (bodyR GhcPs))
mkPsBindStmt EpUniToken "<-" "\8592"
ann LPat GhcPs
pat LocatedA (bodyR GhcPs)
body = XBindStmt GhcPs GhcPs (LocatedA (bodyR GhcPs))
-> LPat GhcPs
-> LocatedA (bodyR GhcPs)
-> StmtLR GhcPs GhcPs (LocatedA (bodyR GhcPs))
forall idL idR body.
XBindStmt idL idR body -> LPat idL -> body -> StmtLR idL idR body
BindStmt XBindStmt GhcPs GhcPs (LocatedA (bodyR GhcPs))
EpUniToken "<-" "\8592"
ann LPat GhcPs
pat LocatedA (bodyR GhcPs)
body
mkRnBindStmt :: forall (bodyR :: * -> *).
LPat (GhcPass 'Renamed)
-> LocatedA (bodyR (GhcPass 'Renamed))
-> StmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(LocatedA (bodyR (GhcPass 'Renamed)))
mkRnBindStmt LPat (GhcPass 'Renamed)
pat LocatedA (bodyR (GhcPass 'Renamed))
body = XBindStmt
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(LocatedA (bodyR (GhcPass 'Renamed)))
-> LPat (GhcPass 'Renamed)
-> LocatedA (bodyR (GhcPass 'Renamed))
-> StmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(LocatedA (bodyR (GhcPass 'Renamed)))
forall idL idR body.
XBindStmt idL idR body -> LPat idL -> body -> StmtLR idL idR body
BindStmt (XBindStmtRn { xbsrn_bindOp :: SyntaxExpr (GhcPass 'Renamed)
xbsrn_bindOp = SyntaxExpr (GhcPass 'Renamed)
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr, xbsrn_failOp :: FailOperator (GhcPass 'Renamed)
xbsrn_failOp = FailOperator (GhcPass 'Renamed)
Maybe SyntaxExprRn
forall a. Maybe a
Nothing }) LPat (GhcPass 'Renamed)
pat LocatedA (bodyR (GhcPass 'Renamed))
body
mkTcBindStmt :: forall (bodyR :: * -> *).
LPat GhcTc
-> LocatedA (bodyR GhcTc)
-> StmtLR GhcTc GhcTc (LocatedA (bodyR GhcTc))
mkTcBindStmt LPat GhcTc
pat LocatedA (bodyR GhcTc)
body = XBindStmt GhcTc GhcTc (LocatedA (bodyR GhcTc))
-> LPat GhcTc
-> LocatedA (bodyR GhcTc)
-> StmtLR GhcTc GhcTc (LocatedA (bodyR GhcTc))
forall idL idR body.
XBindStmt idL idR body -> LPat idL -> body -> StmtLR idL idR body
BindStmt (XBindStmtTc { xbstc_bindOp :: SyntaxExpr GhcTc
xbstc_bindOp = SyntaxExpr GhcTc
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr,
xbstc_boundResultType :: Type
xbstc_boundResultType = Type
unitTy,
xbstc_boundResultMult :: Type
xbstc_boundResultMult = Type
ManyTy,
xbstc_failOp :: FailOperator GhcTc
xbstc_failOp = FailOperator GhcTc
Maybe SyntaxExprTc
forall a. Maybe a
Nothing }) LPat GhcTc
pat LocatedA (bodyR GhcTc)
body
emptyRecStmt' :: forall idL idR body .
(WrapXRec (GhcPass idR) [LStmtLR (GhcPass idL) (GhcPass idR) body], IsPass idR)
=> XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
emptyRecStmt' :: forall (idL :: Pass) (idR :: Pass) body.
(WrapXRec (GhcPass idR) [LStmtLR (GhcPass idL) (GhcPass idR) body],
IsPass idR) =>
XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
emptyRecStmt' XRecStmt (GhcPass idL) (GhcPass idR) body
tyVal =
RecStmt
{ recS_stmts :: XRec (GhcPass idR) [LStmtLR (GhcPass idL) (GhcPass idR) body]
recS_stmts = forall p a. WrapXRec p a => a -> XRec p a
wrapXRec @(GhcPass idR) []
, recS_later_ids :: [IdP (GhcPass idR)]
recS_later_ids = []
, recS_rec_ids :: [IdP (GhcPass idR)]
recS_rec_ids = []
, recS_ret_fn :: SyntaxExpr (GhcPass idR)
recS_ret_fn = SyntaxExpr (GhcPass idR)
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr
, recS_mfix_fn :: SyntaxExpr (GhcPass idR)
recS_mfix_fn = SyntaxExpr (GhcPass idR)
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr
, recS_bind_fn :: SyntaxExpr (GhcPass idR)
recS_bind_fn = SyntaxExpr (GhcPass idR)
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
noSyntaxExpr
, recS_ext :: XRecStmt (GhcPass idL) (GhcPass idR) body
recS_ext = XRecStmt (GhcPass idL) (GhcPass idR) body
tyVal }
unitRecStmtTc :: RecStmtTc
unitRecStmtTc :: RecStmtTc
unitRecStmtTc = RecStmtTc { recS_bind_ty :: Type
recS_bind_ty = Type
unitTy
, recS_later_rets :: [HsExpr GhcTc]
recS_later_rets = []
, recS_rec_rets :: [HsExpr GhcTc]
recS_rec_rets = []
, recS_ret_ty :: Type
recS_ret_ty = Type
unitTy }
emptyRecStmt :: forall (idL :: Pass) bodyR.
(Anno
[GenLocated
(Anno (StmtLR (GhcPass idL) GhcPs bodyR))
(StmtLR (GhcPass idL) GhcPs bodyR)]
~ SrcSpanAnnL) =>
StmtLR (GhcPass idL) GhcPs bodyR
emptyRecStmt = XRecStmt (GhcPass idL) GhcPs bodyR
-> StmtLR (GhcPass idL) GhcPs bodyR
forall (idL :: Pass) (idR :: Pass) body.
(WrapXRec (GhcPass idR) [LStmtLR (GhcPass idL) (GhcPass idR) body],
IsPass idR) =>
XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
emptyRecStmt' XRecStmt (GhcPass idL) GhcPs bodyR
AnnList
forall a. NoAnn a => a
noAnn
emptyRecStmtName :: forall bodyR.
(Anno
[GenLocated
(Anno (StmtLR (GhcPass 'Renamed) (GhcPass 'Renamed) bodyR))
(StmtLR (GhcPass 'Renamed) (GhcPass 'Renamed) bodyR)]
~ SrcSpanAnnL) =>
StmtLR (GhcPass 'Renamed) (GhcPass 'Renamed) bodyR
emptyRecStmtName = XRecStmt (GhcPass 'Renamed) (GhcPass 'Renamed) bodyR
-> StmtLR (GhcPass 'Renamed) (GhcPass 'Renamed) bodyR
forall (idL :: Pass) (idR :: Pass) body.
(WrapXRec (GhcPass idR) [LStmtLR (GhcPass idL) (GhcPass idR) body],
IsPass idR) =>
XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
emptyRecStmt' XRecStmt (GhcPass 'Renamed) (GhcPass 'Renamed) bodyR
NoExtField
noExtField
emptyRecStmtId :: StmtLR GhcTc GhcTc (LocatedA (HsCmd GhcTc))
emptyRecStmtId = XRecStmt GhcTc GhcTc (LocatedA (HsCmd GhcTc))
-> StmtLR GhcTc GhcTc (LocatedA (HsCmd GhcTc))
forall (idL :: Pass) (idR :: Pass) body.
(WrapXRec (GhcPass idR) [LStmtLR (GhcPass idL) (GhcPass idR) body],
IsPass idR) =>
XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
emptyRecStmt' XRecStmt GhcTc GhcTc (LocatedA (HsCmd GhcTc))
RecStmtTc
unitRecStmtTc
mkLetStmt :: EpToken "let" -> HsLocalBinds GhcPs -> StmtLR GhcPs GhcPs (LocatedA b)
mkLetStmt :: forall b.
EpToken "let"
-> HsLocalBinds GhcPs -> StmtLR GhcPs GhcPs (LocatedA b)
mkLetStmt EpToken "let"
anns HsLocalBinds GhcPs
binds = XLetStmt GhcPs GhcPs (LocatedA b)
-> HsLocalBinds GhcPs -> StmtLR GhcPs GhcPs (LocatedA b)
forall idL idR body.
XLetStmt idL idR body
-> HsLocalBindsLR idL idR -> StmtLR idL idR body
LetStmt XLetStmt GhcPs GhcPs (LocatedA b)
EpToken "let"
anns HsLocalBinds GhcPs
binds
mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
mkHsOpApp LHsExpr GhcPs
e1 IdP GhcPs
op LHsExpr GhcPs
e2 = XOpApp GhcPs
-> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
forall p.
XOpApp p -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p
OpApp XOpApp GhcPs
NoExtField
noExtField LHsExpr GhcPs
e1 (HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XVar GhcPs -> LIdP GhcPs -> HsExpr GhcPs
forall p. XVar p -> LIdP p -> HsExpr p
HsVar XVar GhcPs
NoExtField
noExtField (RdrName -> LocatedN RdrName
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA IdP GhcPs
RdrName
op))) LHsExpr GhcPs
e2
mkHsString :: String -> HsLit (GhcPass p)
mkHsString :: forall (p :: Pass). String -> HsLit (GhcPass p)
mkHsString String
s = XHsString (GhcPass p) -> FastString -> HsLit (GhcPass p)
forall x. XHsString x -> FastString -> HsLit x
HsString XHsString (GhcPass p)
SourceText
NoSourceText (String -> FastString
mkFastString String
s)
mkHsStringFS :: FastString -> HsLit (GhcPass p)
mkHsStringFS :: forall (p :: Pass). FastString -> HsLit (GhcPass p)
mkHsStringFS FastString
s = XHsString (GhcPass p) -> FastString -> HsLit (GhcPass p)
forall x. XHsString x -> FastString -> HsLit x
HsString XHsString (GhcPass p)
SourceText
NoSourceText FastString
s
mkHsStringPrimLit :: FastString -> HsLit (GhcPass p)
mkHsStringPrimLit :: forall (p :: Pass). FastString -> HsLit (GhcPass p)
mkHsStringPrimLit FastString
fs = XHsStringPrim (GhcPass p) -> ByteString -> HsLit (GhcPass p)
forall x. XHsStringPrim x -> ByteString -> HsLit x
HsStringPrim XHsStringPrim (GhcPass p)
SourceText
NoSourceText (FastString -> ByteString
bytesFS FastString
fs)
mkHsCharPrimLit :: Char -> HsLit (GhcPass p)
mkHsCharPrimLit :: forall (p :: Pass). Char -> HsLit (GhcPass p)
mkHsCharPrimLit Char
c = XHsChar (GhcPass p) -> Char -> HsLit (GhcPass p)
forall x. XHsChar x -> Char -> HsLit x
HsChar XHsChar (GhcPass p)
SourceText
NoSourceText Char
c
mkConLikeTc :: ConLike -> HsExpr GhcTc
mkConLikeTc :: ConLike -> HsExpr GhcTc
mkConLikeTc ConLike
con = XXExpr GhcTc -> HsExpr GhcTc
forall p. XXExpr p -> HsExpr p
XExpr (ConLike -> [Id] -> [Scaled Type] -> XXExprGhcTc
ConLikeTc ConLike
con [] [])
nlHsVar :: IsSrcSpanAnn p a
=> IdP (GhcPass p) -> LHsExpr (GhcPass p)
nlHsVar :: forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> LHsExpr (GhcPass p)
nlHsVar IdP (GhcPass p)
n = HsExpr (GhcPass p) -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XVar (GhcPass p) -> LIdP (GhcPass p) -> HsExpr (GhcPass p)
forall p. XVar p -> LIdP p -> HsExpr p
HsVar XVar (GhcPass p)
NoExtField
noExtField (IdGhcP p -> GenLocated (EpAnn a) (IdGhcP p)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA IdP (GhcPass p)
IdGhcP p
n))
nl_HsVar :: IsSrcSpanAnn p a
=> IdP (GhcPass p) -> HsExpr (GhcPass p)
nl_HsVar :: forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> HsExpr (GhcPass p)
nl_HsVar IdP (GhcPass p)
n = XVar (GhcPass p) -> LIdP (GhcPass p) -> HsExpr (GhcPass p)
forall p. XVar p -> LIdP p -> HsExpr p
HsVar XVar (GhcPass p)
NoExtField
noExtField (IdGhcP p -> GenLocated (EpAnn a) (IdGhcP p)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA IdP (GhcPass p)
IdGhcP p
n)
nlHsDataCon :: DataCon -> LHsExpr GhcTc
nlHsDataCon :: DataCon -> LHsExpr GhcTc
nlHsDataCon DataCon
con = HsExpr GhcTc -> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (ConLike -> HsExpr GhcTc
mkConLikeTc (DataCon -> ConLike
RealDataCon DataCon
con))
nlHsLit :: HsLit (GhcPass p) -> LHsExpr (GhcPass p)
nlHsLit :: forall (p :: Pass). HsLit (GhcPass p) -> LHsExpr (GhcPass p)
nlHsLit HsLit (GhcPass p)
n = HsExpr (GhcPass p) -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XLitE (GhcPass p) -> HsLit (GhcPass p) -> HsExpr (GhcPass p)
forall p. XLitE p -> HsLit p -> HsExpr p
HsLit XLitE (GhcPass p)
NoExtField
noExtField HsLit (GhcPass p)
n)
nlHsIntLit :: Integer -> LHsExpr (GhcPass p)
nlHsIntLit :: forall (p :: Pass). Integer -> LHsExpr (GhcPass p)
nlHsIntLit Integer
n = HsExpr (GhcPass p) -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XLitE (GhcPass p) -> HsLit (GhcPass p) -> HsExpr (GhcPass p)
forall p. XLitE p -> HsLit p -> HsExpr p
HsLit XLitE (GhcPass p)
NoExtField
noExtField (XHsInt (GhcPass p) -> IntegralLit -> HsLit (GhcPass p)
forall x. XHsInt x -> IntegralLit -> HsLit x
HsInt XHsInt (GhcPass p)
NoExtField
noExtField (Integer -> IntegralLit
forall a. Integral a => a -> IntegralLit
mkIntegralLit Integer
n)))
nlVarPat :: IsSrcSpanAnn p a
=> IdP (GhcPass p) -> LPat (GhcPass p)
nlVarPat :: forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> LPat (GhcPass p)
nlVarPat IdP (GhcPass p)
n = Pat (GhcPass p) -> GenLocated SrcSpanAnnA (Pat (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XVarPat (GhcPass p) -> LIdP (GhcPass p) -> Pat (GhcPass p)
forall p. XVarPat p -> LIdP p -> Pat p
VarPat XVarPat (GhcPass p)
NoExtField
noExtField (IdGhcP p -> GenLocated (EpAnn a) (IdGhcP p)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA IdP (GhcPass p)
IdGhcP p
n))
nlLitPat :: HsLit GhcPs -> LPat GhcPs
nlLitPat :: HsLit GhcPs -> LPat GhcPs
nlLitPat HsLit GhcPs
l = Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XLitPat GhcPs -> HsLit GhcPs -> Pat GhcPs
forall p. XLitPat p -> HsLit p -> Pat p
LitPat XLitPat GhcPs
NoExtField
noExtField HsLit GhcPs
l)
nlHsApp :: IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsApp :: forall (id :: Pass).
IsPass id =>
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsApp LHsExpr (GhcPass id)
f LHsExpr (GhcPass id)
x = HsExpr (GhcPass id) -> GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XApp (GhcPass id)
-> LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
forall p. XApp p -> LHsExpr p -> LHsExpr p -> HsExpr p
HsApp XApp (GhcPass id)
NoExtField
noExtField LHsExpr (GhcPass id)
f (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
forall (p :: Pass).
IsPass p =>
LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
mkLHsPar LHsExpr (GhcPass id)
x))
nlHsSyntaxApps :: SyntaxExprTc -> [LHsExpr GhcTc]
-> LHsExpr GhcTc
nlHsSyntaxApps :: SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsSyntaxApps = SrcSpanAnnA -> SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
mkHsSyntaxApps SrcSpanAnnA
forall e. HasAnnotation e => e
noSrcSpanA
nlHsApps :: IsSrcSpanAnn p a
=> IdP (GhcPass p) -> [LHsExpr (GhcPass p)] -> LHsExpr (GhcPass p)
nlHsApps :: forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> [LHsExpr (GhcPass p)] -> LHsExpr (GhcPass p)
nlHsApps IdP (GhcPass p)
f [LHsExpr (GhcPass p)]
xs = (GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass p)))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
-> [GenLocated SrcSpanAnnA (HsExpr (GhcPass p))]
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall (id :: Pass).
IsPass id =>
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsApp (IdP (GhcPass p) -> LHsExpr (GhcPass p)
forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> LHsExpr (GhcPass p)
nlHsVar IdP (GhcPass p)
f) [LHsExpr (GhcPass p)]
[GenLocated SrcSpanAnnA (HsExpr (GhcPass p))]
xs
nlHsVarApps :: IsSrcSpanAnn p a
=> IdP (GhcPass p) -> [IdP (GhcPass p)] -> LHsExpr (GhcPass p)
nlHsVarApps :: forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> [IdP (GhcPass p)] -> LHsExpr (GhcPass p)
nlHsVarApps IdP (GhcPass p)
f [IdP (GhcPass p)]
xs = HsExpr (GhcPass p) -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA ((HsExpr (GhcPass p) -> HsExpr (GhcPass p) -> HsExpr (GhcPass p))
-> HsExpr (GhcPass p) -> [HsExpr (GhcPass p)] -> HsExpr (GhcPass p)
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' HsExpr (GhcPass p) -> HsExpr (GhcPass p) -> HsExpr (GhcPass p)
forall {p} {e}.
(XRec p (HsExpr p) ~ GenLocated e (HsExpr p), XApp p ~ NoExtField,
HasAnnotation e) =>
HsExpr p -> HsExpr p -> HsExpr p
mk (XVar (GhcPass p) -> LIdP (GhcPass p) -> HsExpr (GhcPass p)
forall p. XVar p -> LIdP p -> HsExpr p
HsVar XVar (GhcPass p)
NoExtField
noExtField (IdGhcP p -> GenLocated (EpAnn a) (IdGhcP p)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA IdP (GhcPass p)
IdGhcP p
f))
((IdGhcP p -> HsExpr (GhcPass p))
-> [IdGhcP p] -> [HsExpr (GhcPass p)]
forall a b. (a -> b) -> [a] -> [b]
map ((XVar (GhcPass p) -> LIdP (GhcPass p) -> HsExpr (GhcPass p)
forall p. XVar p -> LIdP p -> HsExpr p
HsVar XVar (GhcPass p)
NoExtField
noExtField) (GenLocated (EpAnn a) (IdGhcP p) -> HsExpr (GhcPass p))
-> (IdGhcP p -> GenLocated (EpAnn a) (IdGhcP p))
-> IdGhcP p
-> HsExpr (GhcPass p)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IdGhcP p -> GenLocated (EpAnn a) (IdGhcP p)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA) [IdP (GhcPass p)]
[IdGhcP p]
xs))
where
mk :: HsExpr p -> HsExpr p -> HsExpr p
mk HsExpr p
f HsExpr p
a = XApp p -> XRec p (HsExpr p) -> XRec p (HsExpr p) -> HsExpr p
forall p. XApp p -> LHsExpr p -> LHsExpr p -> HsExpr p
HsApp XApp p
NoExtField
noExtField (HsExpr p -> GenLocated e (HsExpr p)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA HsExpr p
f) (HsExpr p -> GenLocated e (HsExpr p)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA HsExpr p
a)
nlConVarPat :: RdrName -> [RdrName] -> LPat GhcPs
nlConVarPat :: RdrName -> [RdrName] -> LPat GhcPs
nlConVarPat RdrName
con [RdrName]
vars = RdrName -> [LPat GhcPs] -> LPat GhcPs
nlConPat RdrName
con ((RdrName -> GenLocated SrcSpanAnnA (Pat GhcPs))
-> [RdrName] -> [GenLocated SrcSpanAnnA (Pat GhcPs)]
forall a b. (a -> b) -> [a] -> [b]
map IdP GhcPs -> LPat GhcPs
RdrName -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> LPat (GhcPass p)
nlVarPat [RdrName]
vars)
nlConVarPatName :: Name -> [Name] -> LPat GhcRn
nlConVarPatName :: Name -> [Name] -> LPat (GhcPass 'Renamed)
nlConVarPatName Name
con [Name]
vars = Name -> [LPat (GhcPass 'Renamed)] -> LPat (GhcPass 'Renamed)
nlConPatName Name
con ((Name -> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> [Name] -> [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
forall a b. (a -> b) -> [a] -> [b]
map IdP (GhcPass 'Renamed) -> LPat (GhcPass 'Renamed)
Name -> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> LPat (GhcPass p)
nlVarPat [Name]
vars)
nlInfixConPat :: RdrName -> LPat GhcPs -> LPat GhcPs -> LPat GhcPs
nlInfixConPat :: RdrName -> LPat GhcPs -> LPat GhcPs -> LPat GhcPs
nlInfixConPat RdrName
con LPat GhcPs
l LPat GhcPs
r = Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs))
-> Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall a b. (a -> b) -> a -> b
$ ConPat
{ pat_con :: XRec GhcPs (ConLikeP GhcPs)
pat_con = RdrName -> LocatedN RdrName
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA RdrName
con
, pat_args :: HsConPatDetails GhcPs
pat_args = LPat GhcPs -> LPat GhcPs -> HsConPatDetails GhcPs
forall tyarg arg rec. arg -> arg -> HsConDetails tyarg arg rec
InfixCon (PprPrec -> LPat GhcPs -> LPat GhcPs
forall (p :: Pass).
IsPass p =>
PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
parenthesizePat PprPrec
opPrec LPat GhcPs
l)
(PprPrec -> LPat GhcPs -> LPat GhcPs
forall (p :: Pass).
IsPass p =>
PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
parenthesizePat PprPrec
opPrec LPat GhcPs
r)
, pat_con_ext :: XConPat GhcPs
pat_con_ext = [AddEpAnn]
XConPat GhcPs
forall a. NoAnn a => a
noAnn
}
nlConPat :: RdrName -> [LPat GhcPs] -> LPat GhcPs
nlConPat :: RdrName -> [LPat GhcPs] -> LPat GhcPs
nlConPat RdrName
con [LPat GhcPs]
pats = Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs))
-> Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall a b. (a -> b) -> a -> b
$ ConPat
{ pat_con_ext :: XConPat GhcPs
pat_con_ext = XConPat GhcPs
forall a. NoAnn a => a
noAnn
, pat_con :: XRec GhcPs (ConLikeP GhcPs)
pat_con = RdrName -> LocatedN RdrName
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA RdrName
con
, pat_args :: HsConPatDetails GhcPs
pat_args = [HsConPatTyArg (NoGhcTc GhcPs)]
-> [LPat GhcPs] -> HsConPatDetails GhcPs
forall tyarg arg rec.
[tyarg] -> [arg] -> HsConDetails tyarg arg rec
PrefixCon [] ((GenLocated SrcSpanAnnA (Pat GhcPs) -> LPat GhcPs)
-> [GenLocated SrcSpanAnnA (Pat GhcPs)] -> [LPat GhcPs]
forall a b. (a -> b) -> [a] -> [b]
map (PprPrec -> LPat GhcPs -> LPat GhcPs
forall (p :: Pass).
IsPass p =>
PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
parenthesizePat PprPrec
appPrec) [LPat GhcPs]
[GenLocated SrcSpanAnnA (Pat GhcPs)]
pats)
}
nlConPatName :: Name -> [LPat GhcRn] -> LPat GhcRn
nlConPatName :: Name -> [LPat (GhcPass 'Renamed)] -> LPat (GhcPass 'Renamed)
nlConPatName Name
con [LPat (GhcPass 'Renamed)]
pats = Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall a b. (a -> b) -> a -> b
$ ConPat
{ pat_con_ext :: XConPat (GhcPass 'Renamed)
pat_con_ext = XConPat (GhcPass 'Renamed)
NoExtField
noExtField
, pat_con :: XRec (GhcPass 'Renamed) (ConLikeP (GhcPass 'Renamed))
pat_con = Name -> GenLocated SrcSpanAnnN Name
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA Name
con
, pat_args :: HsConPatDetails (GhcPass 'Renamed)
pat_args = [HsConPatTyArg (NoGhcTc (GhcPass 'Renamed))]
-> [LPat (GhcPass 'Renamed)] -> HsConPatDetails (GhcPass 'Renamed)
forall tyarg arg rec.
[tyarg] -> [arg] -> HsConDetails tyarg arg rec
PrefixCon [] ((GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> LPat (GhcPass 'Renamed))
-> [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [LPat (GhcPass 'Renamed)]
forall a b. (a -> b) -> [a] -> [b]
map (PprPrec -> LPat (GhcPass 'Renamed) -> LPat (GhcPass 'Renamed)
forall (p :: Pass).
IsPass p =>
PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
parenthesizePat PprPrec
appPrec) [LPat (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
pats)
}
nlNullaryConPat :: RdrName -> LPat GhcPs
nlNullaryConPat :: RdrName -> LPat GhcPs
nlNullaryConPat RdrName
con = Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs))
-> Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall a b. (a -> b) -> a -> b
$ ConPat
{ pat_con_ext :: XConPat GhcPs
pat_con_ext = XConPat GhcPs
forall a. NoAnn a => a
noAnn
, pat_con :: XRec GhcPs (ConLikeP GhcPs)
pat_con = RdrName -> LocatedN RdrName
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA RdrName
con
, pat_args :: HsConPatDetails GhcPs
pat_args = [HsConPatTyArg (NoGhcTc GhcPs)]
-> [LPat GhcPs] -> HsConPatDetails GhcPs
forall tyarg arg rec.
[tyarg] -> [arg] -> HsConDetails tyarg arg rec
PrefixCon [] []
}
nlWildConPat :: DataCon -> LPat GhcPs
nlWildConPat :: DataCon -> LPat GhcPs
nlWildConPat DataCon
con = Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs))
-> Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall a b. (a -> b) -> a -> b
$ ConPat
{ pat_con_ext :: XConPat GhcPs
pat_con_ext = XConPat GhcPs
forall a. NoAnn a => a
noAnn
, pat_con :: XRec GhcPs (ConLikeP GhcPs)
pat_con = RdrName -> LocatedN RdrName
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (RdrName -> LocatedN RdrName) -> RdrName -> LocatedN RdrName
forall a b. (a -> b) -> a -> b
$ DataCon -> RdrName
forall thing. NamedThing thing => thing -> RdrName
getRdrName DataCon
con
, pat_args :: HsConPatDetails GhcPs
pat_args = [HsConPatTyArg (NoGhcTc GhcPs)]
-> [LPat GhcPs] -> HsConPatDetails GhcPs
forall tyarg arg rec.
[tyarg] -> [arg] -> HsConDetails tyarg arg rec
PrefixCon [] ([LPat GhcPs] -> HsConPatDetails GhcPs)
-> [LPat GhcPs] -> HsConPatDetails GhcPs
forall a b. (a -> b) -> a -> b
$
Int -> LPat GhcPs -> [LPat GhcPs]
forall a. Int -> a -> [a]
replicate (DataCon -> Int
dataConSourceArity DataCon
con)
LPat GhcPs
nlWildPat
}
nlWildPat :: LPat GhcPs
nlWildPat :: LPat GhcPs
nlWildPat = Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XWildPat GhcPs -> Pat GhcPs
forall p. XWildPat p -> Pat p
WildPat XWildPat GhcPs
NoExtField
noExtField )
nlWildPatName :: LPat GhcRn
nlWildPatName :: LPat (GhcPass 'Renamed)
nlWildPatName = Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XWildPat (GhcPass 'Renamed) -> Pat (GhcPass 'Renamed)
forall p. XWildPat p -> Pat p
WildPat XWildPat (GhcPass 'Renamed)
NoExtField
noExtField )
nlHsDo :: HsDoFlavour -> [LStmt GhcPs (LHsExpr GhcPs)]
-> LHsExpr GhcPs
nlHsDo :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
nlHsDo HsDoFlavour
ctxt [ExprLStmt GhcPs]
stmts = HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs
mkHsDo HsDoFlavour
ctxt ([GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
-> GenLocated
SrcSpanAnnL
[GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA [ExprLStmt GhcPs]
[GenLocated
SrcSpanAnnA (StmtLR GhcPs GhcPs (LocatedA (HsExpr GhcPs)))]
stmts))
nlHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsOpApp LHsExpr GhcPs
e1 IdP GhcPs
op LHsExpr GhcPs
e2 = HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
mkHsOpApp LHsExpr GhcPs
e1 IdP GhcPs
op LHsExpr GhcPs
e2)
nlHsLam :: LMatch GhcPs (LHsExpr GhcPs) -> LHsExpr GhcPs
nlHsPar :: IsPass p => LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
nlHsCase :: LHsExpr GhcPs -> [LMatch GhcPs (LHsExpr GhcPs)]
-> LHsExpr GhcPs
nlList :: [LHsExpr GhcPs] -> LHsExpr GhcPs
nlHsLam :: LMatch GhcPs (LHsExpr GhcPs) -> LHsExpr GhcPs
nlHsLam LMatch GhcPs (LHsExpr GhcPs)
match = HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (HsExpr GhcPs -> LocatedA (HsExpr GhcPs))
-> HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall a b. (a -> b) -> a -> b
$ XLam GhcPs
-> HsLamVariant -> MatchGroup GhcPs (LHsExpr GhcPs) -> HsExpr GhcPs
forall p.
XLam p -> HsLamVariant -> MatchGroup p (LHsExpr p) -> HsExpr p
HsLam XLam GhcPs
EpAnnLam
forall a. NoAnn a => a
noAnn HsLamVariant
LamSingle
(MatchGroup GhcPs (LHsExpr GhcPs) -> HsExpr GhcPs)
-> MatchGroup GhcPs (LHsExpr GhcPs) -> HsExpr GhcPs
forall a b. (a -> b) -> a -> b
$ Origin
-> LocatedL [LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
-> MatchGroup GhcPs (LocatedA (HsExpr GhcPs))
forall (p :: Pass) (body :: * -> *).
AnnoBody p body =>
Origin
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatchGroup (GenReason -> DoPmc -> Origin
Generated GenReason
OtherExpansion DoPmc
SkipPmc) ([LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
-> LocatedL [LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA [LMatch GhcPs (LHsExpr GhcPs)
LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))
match])
nlHsPar :: forall (p :: Pass).
IsPass p =>
LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
nlHsPar LHsExpr (GhcPass p)
e = HsExpr (GhcPass p) -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (LHsExpr (GhcPass p) -> HsExpr (GhcPass p)
forall (p :: Pass).
IsPass p =>
LHsExpr (GhcPass p) -> HsExpr (GhcPass p)
gHsPar LHsExpr (GhcPass p)
e)
nlHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsIf LHsExpr GhcPs
cond LHsExpr GhcPs
true LHsExpr GhcPs
false = HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XIf GhcPs
-> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
forall p. XIf p -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p
HsIf XIf GhcPs
AnnsIf
forall a. NoAnn a => a
noAnn LHsExpr GhcPs
cond LHsExpr GhcPs
true LHsExpr GhcPs
false)
nlHsCase :: LHsExpr GhcPs -> [LMatch GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
nlHsCase LHsExpr GhcPs
expr [LMatch GhcPs (LHsExpr GhcPs)]
matches
= HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XCase GhcPs
-> LHsExpr GhcPs
-> MatchGroup GhcPs (LHsExpr GhcPs)
-> HsExpr GhcPs
forall p.
XCase p -> LHsExpr p -> MatchGroup p (LHsExpr p) -> HsExpr p
HsCase XCase GhcPs
EpAnnHsCase
forall a. NoAnn a => a
noAnn LHsExpr GhcPs
expr (Origin
-> LocatedL [LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
-> MatchGroup GhcPs (LocatedA (HsExpr GhcPs))
forall (p :: Pass) (body :: * -> *).
AnnoBody p body =>
Origin
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatchGroup (GenReason -> DoPmc -> Origin
Generated GenReason
OtherExpansion DoPmc
SkipPmc) ([LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
-> LocatedL [LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA [LMatch GhcPs (LHsExpr GhcPs)]
[LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
matches)))
nlList :: [LHsExpr GhcPs] -> LHsExpr GhcPs
nlList [LHsExpr GhcPs]
exprs = HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XExplicitList GhcPs -> [LHsExpr GhcPs] -> HsExpr GhcPs
forall p. XExplicitList p -> [LHsExpr p] -> HsExpr p
ExplicitList XExplicitList GhcPs
AnnList
forall a. NoAnn a => a
noAnn [LHsExpr GhcPs]
exprs)
nlHsAppTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsTyVar :: IsSrcSpanAnn p a
=> PromotionFlag -> IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsFunTy :: forall p. IsPass p
=> LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsParTy :: LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppTy :: forall (p :: Pass).
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppTy LHsType (GhcPass p)
f LHsType (GhcPass p)
t = HsType (GhcPass p) -> GenLocated SrcSpanAnnA (HsType (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XAppTy (GhcPass p)
-> LHsType (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass.
XAppTy pass -> LHsType pass -> LHsType pass -> HsType pass
HsAppTy XAppTy (GhcPass p)
NoExtField
noExtField LHsType (GhcPass p)
f LHsType (GhcPass p)
t)
nlHsTyVar :: forall (p :: Pass) a.
IsSrcSpanAnn p a =>
PromotionFlag -> IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsTyVar PromotionFlag
p IdP (GhcPass p)
x = HsType (GhcPass p) -> GenLocated SrcSpanAnnA (HsType (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XTyVar (GhcPass p)
-> PromotionFlag -> LIdP (GhcPass p) -> HsType (GhcPass p)
forall pass.
XTyVar pass -> PromotionFlag -> LIdP pass -> HsType pass
HsTyVar [AddEpAnn]
XTyVar (GhcPass p)
forall a. NoAnn a => a
noAnn PromotionFlag
p (IdGhcP p -> GenLocated (EpAnn a) (IdGhcP p)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA IdP (GhcPass p)
IdGhcP p
x))
nlHsFunTy :: forall (p :: Pass).
IsPass p =>
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsFunTy LHsType (GhcPass p)
a LHsType (GhcPass p)
b = HsType (GhcPass p) -> GenLocated SrcSpanAnnA (HsType (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XFunTy (GhcPass p)
-> HsArrow (GhcPass p)
-> LHsType (GhcPass p)
-> LHsType (GhcPass p)
-> HsType (GhcPass p)
forall pass.
XFunTy pass
-> HsArrow pass -> LHsType pass -> LHsType pass -> HsType pass
HsFunTy XFunTy (GhcPass p)
NoExtField
noExtField (XUnrestrictedArrow
(GenLocated SrcSpanAnnA (HsType (GhcPass p))) (GhcPass p)
-> HsArrowOf
(GenLocated SrcSpanAnnA (HsType (GhcPass p))) (GhcPass p)
forall mult pass.
XUnrestrictedArrow mult pass -> HsArrowOf mult pass
HsUnrestrictedArrow XUnrestrictedArrow
(GenLocated SrcSpanAnnA (HsType (GhcPass p))) (GhcPass p)
x) LHsType (GhcPass p)
a LHsType (GhcPass p)
b)
where
x :: XUnrestrictedArrow
(GenLocated SrcSpanAnnA (HsType (GhcPass p))) (GhcPass p)
x = case forall (p :: Pass). IsPass p => GhcPass p
ghcPass @p of
GhcPass p
GhcPs -> EpUniToken "->" "\8594"
XUnrestrictedArrow
(GenLocated SrcSpanAnnA (HsType (GhcPass p))) (GhcPass p)
forall a. NoAnn a => a
noAnn
GhcPass p
GhcRn -> NoExtField
XUnrestrictedArrow
(GenLocated SrcSpanAnnA (HsType (GhcPass p))) (GhcPass p)
noExtField
GhcPass p
GhcTc -> NoExtField
XUnrestrictedArrow
(GenLocated SrcSpanAnnA (HsType (GhcPass p))) (GhcPass p)
noExtField
nlHsParTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsParTy LHsType (GhcPass p)
t = HsType (GhcPass p) -> GenLocated SrcSpanAnnA (HsType (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XParTy (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass. XParTy pass -> LHsType pass -> HsType pass
HsParTy XParTy (GhcPass p)
AnnParen
forall a. NoAnn a => a
noAnn LHsType (GhcPass p)
t)
nlHsTyConApp :: forall p a. IsSrcSpanAnn p a
=> PromotionFlag
-> LexicalFixity -> IdP (GhcPass p)
-> [LHsTypeArg (GhcPass p)] -> LHsType (GhcPass p)
nlHsTyConApp :: forall (p :: Pass) a.
IsSrcSpanAnn p a =>
PromotionFlag
-> LexicalFixity
-> IdP (GhcPass p)
-> [LHsTypeArg (GhcPass p)]
-> LHsType (GhcPass p)
nlHsTyConApp PromotionFlag
prom LexicalFixity
fixity IdP (GhcPass p)
tycon [LHsTypeArg (GhcPass p)]
tys
| LexicalFixity
Infix <- LexicalFixity
fixity
, HsValArg XValArg (GhcPass p)
_ LHsType (GhcPass p)
ty1 : HsValArg XValArg (GhcPass p)
_ LHsType (GhcPass p)
ty2 : [LHsTypeArg (GhcPass p)]
rest <- [LHsTypeArg (GhcPass p)]
tys
= (GenLocated SrcSpanAnnA (HsType (GhcPass p))
-> HsArg
(GhcPass p)
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
-> GenLocated SrcSpanAnnA (HsType (GhcPass p)))
-> GenLocated SrcSpanAnnA (HsType (GhcPass p))
-> [HsArg
(GhcPass p)
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))]
-> GenLocated SrcSpanAnnA (HsType (GhcPass p))
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
GenLocated SrcSpanAnnA (HsType (GhcPass p))
-> HsArg
(GhcPass p)
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
-> GenLocated SrcSpanAnnA (HsType (GhcPass p))
mk_app (HsType (GhcPass p) -> GenLocated SrcSpanAnnA (HsType (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (HsType (GhcPass p) -> GenLocated SrcSpanAnnA (HsType (GhcPass p)))
-> HsType (GhcPass p)
-> GenLocated SrcSpanAnnA (HsType (GhcPass p))
forall a b. (a -> b) -> a -> b
$ XOpTy (GhcPass p)
-> PromotionFlag
-> LHsType (GhcPass p)
-> LIdP (GhcPass p)
-> LHsType (GhcPass p)
-> HsType (GhcPass p)
forall pass.
XOpTy pass
-> PromotionFlag
-> LHsType pass
-> LIdP pass
-> LHsType pass
-> HsType pass
HsOpTy [AddEpAnn]
XOpTy (GhcPass p)
forall a. NoAnn a => a
noAnn PromotionFlag
prom LHsType (GhcPass p)
ty1 (IdGhcP p -> GenLocated (EpAnn a) (IdGhcP p)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA IdP (GhcPass p)
IdGhcP p
tycon) LHsType (GhcPass p)
ty2) [LHsTypeArg (GhcPass p)]
[HsArg
(GhcPass p)
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))]
rest
| Bool
otherwise
= (GenLocated SrcSpanAnnA (HsType (GhcPass p))
-> HsArg
(GhcPass p)
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
-> GenLocated SrcSpanAnnA (HsType (GhcPass p)))
-> GenLocated SrcSpanAnnA (HsType (GhcPass p))
-> [HsArg
(GhcPass p)
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))]
-> GenLocated SrcSpanAnnA (HsType (GhcPass p))
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
GenLocated SrcSpanAnnA (HsType (GhcPass p))
-> HsArg
(GhcPass p)
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
-> GenLocated SrcSpanAnnA (HsType (GhcPass p))
mk_app (PromotionFlag -> IdP (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass) a.
IsSrcSpanAnn p a =>
PromotionFlag -> IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsTyVar PromotionFlag
prom IdP (GhcPass p)
tycon) [LHsTypeArg (GhcPass p)]
[HsArg
(GhcPass p)
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))
(GenLocated SrcSpanAnnA (HsType (GhcPass p)))]
tys
where
mk_app :: LHsType (GhcPass p) -> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
mk_app :: LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
mk_app fun :: LHsType (GhcPass p)
fun@(L SrcSpanAnnA
_ (HsOpTy {})) LHsTypeArg (GhcPass p)
arg = LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
mk_app (LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsParTy LHsType (GhcPass p)
fun) LHsTypeArg (GhcPass p)
arg
mk_app LHsType (GhcPass p)
fun (HsValArg XValArg (GhcPass p)
_ LHsType (GhcPass p)
ty) = LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppTy LHsType (GhcPass p)
fun LHsType (GhcPass p)
ty
mk_app LHsType (GhcPass p)
fun (HsTypeArg XTypeArg (GhcPass p)
_ LHsType (GhcPass p)
ki) = LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
IsPass p =>
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppKindTy LHsType (GhcPass p)
fun LHsType (GhcPass p)
ki
mk_app LHsType (GhcPass p)
fun (HsArgPar XArgPar (GhcPass p)
_) = LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsParTy LHsType (GhcPass p)
fun
nlHsAppKindTy :: forall p. IsPass p =>
LHsType (GhcPass p) -> LHsKind (GhcPass p) -> LHsType (GhcPass p)
nlHsAppKindTy :: forall (p :: Pass).
IsPass p =>
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppKindTy LHsType (GhcPass p)
f LHsType (GhcPass p)
k = HsType (GhcPass p) -> GenLocated SrcSpanAnnA (HsType (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XAppKindTy (GhcPass p)
-> LHsType (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass.
XAppKindTy pass -> LHsType pass -> LHsType pass -> HsType pass
HsAppKindTy XAppKindTy (GhcPass p)
x LHsType (GhcPass p)
f LHsType (GhcPass p)
k)
where
x :: XAppKindTy (GhcPass p)
x = case forall (p :: Pass). IsPass p => GhcPass p
ghcPass @p of
GhcPass p
GhcPs -> XAppKindTy (GhcPass p)
EpToken "@"
forall a. NoAnn a => a
noAnn
GhcPass p
GhcRn -> XAppKindTy (GhcPass p)
NoExtField
noExtField
GhcPass p
GhcTc -> XAppKindTy (GhcPass p)
NoExtField
noExtField
mkLHsTupleExpr :: [LHsExpr (GhcPass p)] -> XExplicitTuple (GhcPass p)
-> LHsExpr (GhcPass p)
mkLHsTupleExpr :: forall (p :: Pass).
[LHsExpr (GhcPass p)]
-> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkLHsTupleExpr [LHsExpr (GhcPass p)
e] XExplicitTuple (GhcPass p)
_ = LHsExpr (GhcPass p)
e
mkLHsTupleExpr [LHsExpr (GhcPass p)]
es XExplicitTuple (GhcPass p)
ext
= HsExpr (GhcPass p) -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (HsExpr (GhcPass p) -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p)))
-> HsExpr (GhcPass p)
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall a b. (a -> b) -> a -> b
$ XExplicitTuple (GhcPass p)
-> [HsTupArg (GhcPass p)] -> Boxity -> HsExpr (GhcPass p)
forall p. XExplicitTuple p -> [HsTupArg p] -> Boxity -> HsExpr p
ExplicitTuple XExplicitTuple (GhcPass p)
ext ((LHsExpr (GhcPass p) -> HsTupArg (GhcPass p))
-> [LHsExpr (GhcPass p)] -> [HsTupArg (GhcPass p)]
forall a b. (a -> b) -> [a] -> [b]
map (XPresent (GhcPass p) -> LHsExpr (GhcPass p) -> HsTupArg (GhcPass p)
forall id. XPresent id -> LHsExpr id -> HsTupArg id
Present XPresent (GhcPass p)
NoExtField
noExtField) [LHsExpr (GhcPass p)]
es) Boxity
Boxed
mkLHsVarTuple :: IsSrcSpanAnn p a
=> [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p)
-> LHsExpr (GhcPass p)
mkLHsVarTuple :: forall (p :: Pass) a.
IsSrcSpanAnn p a =>
[IdP (GhcPass p)]
-> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkLHsVarTuple [IdP (GhcPass p)]
ids XExplicitTuple (GhcPass p)
ext = [XRec (GhcPass p) (HsExpr (GhcPass p))]
-> XExplicitTuple (GhcPass p)
-> XRec (GhcPass p) (HsExpr (GhcPass p))
forall (p :: Pass).
[LHsExpr (GhcPass p)]
-> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkLHsTupleExpr ((IdGhcP p -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p)))
-> [IdGhcP p] -> [GenLocated SrcSpanAnnA (HsExpr (GhcPass p))]
forall a b. (a -> b) -> [a] -> [b]
map IdP (GhcPass p) -> XRec (GhcPass p) (HsExpr (GhcPass p))
IdGhcP p -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> LHsExpr (GhcPass p)
nlHsVar [IdP (GhcPass p)]
[IdGhcP p]
ids) XExplicitTuple (GhcPass p)
ext
nlTuplePat :: [LPat GhcPs] -> Boxity -> LPat GhcPs
nlTuplePat :: [LPat GhcPs] -> Boxity -> LPat GhcPs
nlTuplePat [LPat GhcPs]
pats Boxity
box = Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (XTuplePat GhcPs -> [LPat GhcPs] -> Boxity -> Pat GhcPs
forall p. XTuplePat p -> [LPat p] -> Boxity -> Pat p
TuplePat (EpaLocation, EpaLocation)
XTuplePat GhcPs
forall a. NoAnn a => a
noAnn [LPat GhcPs]
pats Boxity
box)
missingTupArg :: EpAnn Bool -> HsTupArg GhcPs
missingTupArg :: EpAnn Bool -> HsTupArg GhcPs
missingTupArg EpAnn Bool
ann = XMissing GhcPs -> HsTupArg GhcPs
forall id. XMissing id -> HsTupArg id
Missing XMissing GhcPs
EpAnn Bool
ann
mkLHsPatTup :: [LPat GhcRn] -> LPat GhcRn
mkLHsPatTup :: [LPat (GhcPass 'Renamed)] -> LPat (GhcPass 'Renamed)
mkLHsPatTup [] = Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall a b. (a -> b) -> a -> b
$ XTuplePat (GhcPass 'Renamed)
-> [LPat (GhcPass 'Renamed)] -> Boxity -> Pat (GhcPass 'Renamed)
forall p. XTuplePat p -> [LPat p] -> Boxity -> Pat p
TuplePat XTuplePat (GhcPass 'Renamed)
NoExtField
noExtField [] Boxity
Boxed
mkLHsPatTup [LPat (GhcPass 'Renamed)
lpat] = LPat (GhcPass 'Renamed)
lpat
mkLHsPatTup lpats :: [LPat (GhcPass 'Renamed)]
lpats@(LPat (GhcPass 'Renamed)
lpat:[LPat (GhcPass 'Renamed)]
_) = SrcSpanAnnA
-> Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall l e. l -> e -> GenLocated l e
L (GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)) -> SrcSpanAnnA
forall l e. GenLocated l e -> l
getLoc LPat (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
lpat) (Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> Pat (GhcPass 'Renamed)
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall a b. (a -> b) -> a -> b
$ XTuplePat (GhcPass 'Renamed)
-> [LPat (GhcPass 'Renamed)] -> Boxity -> Pat (GhcPass 'Renamed)
forall p. XTuplePat p -> [LPat p] -> Boxity -> Pat p
TuplePat XTuplePat (GhcPass 'Renamed)
NoExtField
noExtField [LPat (GhcPass 'Renamed)]
lpats Boxity
Boxed
mkBigLHsVarTup :: IsSrcSpanAnn p a
=> [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p)
-> LHsExpr (GhcPass p)
mkBigLHsVarTup :: forall (p :: Pass) a.
IsSrcSpanAnn p a =>
[IdP (GhcPass p)]
-> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkBigLHsVarTup [IdP (GhcPass p)]
ids XExplicitTuple (GhcPass p)
anns = [XRec (GhcPass p) (HsExpr (GhcPass p))]
-> XExplicitTuple (GhcPass p)
-> XRec (GhcPass p) (HsExpr (GhcPass p))
forall (p :: Pass).
[LHsExpr (GhcPass p)]
-> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkBigLHsTup ((IdGhcP p -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p)))
-> [IdGhcP p] -> [GenLocated SrcSpanAnnA (HsExpr (GhcPass p))]
forall a b. (a -> b) -> [a] -> [b]
map IdP (GhcPass p) -> XRec (GhcPass p) (HsExpr (GhcPass p))
IdGhcP p -> GenLocated SrcSpanAnnA (HsExpr (GhcPass p))
forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> LHsExpr (GhcPass p)
nlHsVar [IdP (GhcPass p)]
[IdGhcP p]
ids) XExplicitTuple (GhcPass p)
anns
mkBigLHsTup :: [LHsExpr (GhcPass id)] -> XExplicitTuple (GhcPass id)
-> LHsExpr (GhcPass id)
mkBigLHsTup :: forall (p :: Pass).
[LHsExpr (GhcPass p)]
-> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkBigLHsTup [LHsExpr (GhcPass id)]
es XExplicitTuple (GhcPass id)
anns = ([GenLocated SrcSpanAnnA (HsExpr (GhcPass id))]
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id)))
-> [GenLocated SrcSpanAnnA (HsExpr (GhcPass id))]
-> GenLocated SrcSpanAnnA (HsExpr (GhcPass id))
forall a. ([a] -> a) -> [a] -> a
mkChunkified (\[GenLocated SrcSpanAnnA (HsExpr (GhcPass id))]
e -> [LHsExpr (GhcPass id)]
-> XExplicitTuple (GhcPass id) -> LHsExpr (GhcPass id)
forall (p :: Pass).
[LHsExpr (GhcPass p)]
-> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkLHsTupleExpr [LHsExpr (GhcPass id)]
[GenLocated SrcSpanAnnA (HsExpr (GhcPass id))]
e XExplicitTuple (GhcPass id)
anns) [LHsExpr (GhcPass id)]
[GenLocated SrcSpanAnnA (HsExpr (GhcPass id))]
es
mkBigLHsVarPatTup :: [IdP GhcRn] -> LPat GhcRn
mkBigLHsVarPatTup :: [IdP (GhcPass 'Renamed)] -> LPat (GhcPass 'Renamed)
mkBigLHsVarPatTup [IdP (GhcPass 'Renamed)]
bs = [LPat (GhcPass 'Renamed)] -> LPat (GhcPass 'Renamed)
mkBigLHsPatTup ((IdGhcP 'Renamed
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> [IdGhcP 'Renamed]
-> [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
forall a b. (a -> b) -> [a] -> [b]
map IdP (GhcPass 'Renamed) -> LPat (GhcPass 'Renamed)
IdGhcP 'Renamed -> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall (p :: Pass) a.
IsSrcSpanAnn p a =>
IdP (GhcPass p) -> LPat (GhcPass p)
nlVarPat [IdP (GhcPass 'Renamed)]
[IdGhcP 'Renamed]
bs)
mkBigLHsPatTup :: [LPat GhcRn] -> LPat GhcRn
mkBigLHsPatTup :: [LPat (GhcPass 'Renamed)] -> LPat (GhcPass 'Renamed)
mkBigLHsPatTup = ([GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall a. ([a] -> a) -> [a] -> a
mkChunkified [LPat (GhcPass 'Renamed)] -> LPat (GhcPass 'Renamed)
[GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
mkLHsPatTup
hsTypeToHsSigType :: LHsType GhcPs -> LHsSigType GhcPs
hsTypeToHsSigType :: LHsType GhcPs -> LHsSigType GhcPs
hsTypeToHsSigType lty :: LHsType GhcPs
lty@(L SrcSpanAnnA
loc HsType GhcPs
ty) = case HsType GhcPs
ty of
HsForAllTy { hst_tele :: forall pass. HsType pass -> HsForAllTelescope pass
hst_tele = HsForAllInvis { hsf_xinvis :: forall pass. HsForAllTelescope pass -> XHsForAllInvis pass
hsf_xinvis = XHsForAllInvis GhcPs
an
, hsf_invis_bndrs :: forall pass.
HsForAllTelescope pass -> [LHsTyVarBndr Specificity pass]
hsf_invis_bndrs = [LHsTyVarBndr Specificity GhcPs]
bndrs }
, hst_body :: forall pass. HsType pass -> LHsType pass
hst_body = LHsType GhcPs
body }
-> SrcSpanAnnA
-> HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc (HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall a b. (a -> b) -> a -> b
$ EpAnnForallTy
-> [LHsTyVarBndr Specificity GhcPs]
-> LHsType GhcPs
-> HsSigType GhcPs
mkHsExplicitSigType XHsForAllInvis GhcPs
EpAnnForallTy
an [LHsTyVarBndr Specificity GhcPs]
bndrs LHsType GhcPs
body
HsType GhcPs
_ -> SrcSpanAnnA
-> HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall l e. l -> e -> GenLocated l e
L (SrcSpanAnnA -> SrcSpanAnnA
forall a b. (HasLoc a, HasAnnotation b) => a -> b
l2l SrcSpanAnnA
loc) (HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall a b. (a -> b) -> a -> b
$ LHsType GhcPs -> HsSigType GhcPs
mkHsImplicitSigType LHsType GhcPs
lty
hsTypeToHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs
hsTypeToHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs
hsTypeToHsSigWcType = GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
forall thing. thing -> HsWildCardBndrs GhcPs thing
mkHsWildCardBndrs (GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> HsWildCardBndrs
GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs)))
-> (GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LHsType GhcPs -> LHsSigType GhcPs
GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (HsSigType GhcPs)
hsTypeToHsSigType
mkHsSigEnv :: forall a. (LSig GhcRn -> Maybe ([LocatedN Name], a))
-> [LSig GhcRn]
-> NameEnv a
mkHsSigEnv :: forall a.
(LSig (GhcPass 'Renamed)
-> Maybe ([GenLocated SrcSpanAnnN Name], a))
-> [LSig (GhcPass 'Renamed)] -> NameEnv a
mkHsSigEnv LSig (GhcPass 'Renamed) -> Maybe ([GenLocated SrcSpanAnnN Name], a)
get_info [LSig (GhcPass 'Renamed)]
sigs
= [(Name, a)] -> NameEnv a
forall a. [(Name, a)] -> NameEnv a
mkNameEnv ([LSig (GhcPass 'Renamed)] -> [(Name, a)]
mk_pairs [LSig (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
ordinary_sigs)
NameEnv a -> [(Name, a)] -> NameEnv a
forall a. NameEnv a -> [(Name, a)] -> NameEnv a
`extendNameEnvList` ([LSig (GhcPass 'Renamed)] -> [(Name, a)]
mk_pairs [LSig (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
gen_dm_sigs)
where
([GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
gen_dm_sigs, [GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
ordinary_sigs) = (GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed)) -> Bool)
-> [GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
-> ([GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))],
[GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))])
forall a. (a -> Bool) -> [a] -> ([a], [a])
partition GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed)) -> Bool
forall {l} {pass}. GenLocated l (Sig pass) -> Bool
is_gen_dm_sig [LSig (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
sigs
is_gen_dm_sig :: GenLocated l (Sig pass) -> Bool
is_gen_dm_sig (L l
_ (ClassOpSig XClassOpSig pass
_ Bool
True [LIdP pass]
_ LHsSigType pass
_)) = Bool
True
is_gen_dm_sig GenLocated l (Sig pass)
_ = Bool
False
mk_pairs :: [LSig GhcRn] -> [(Name, a)]
mk_pairs :: [LSig (GhcPass 'Renamed)] -> [(Name, a)]
mk_pairs [LSig (GhcPass 'Renamed)]
sigs = [ (Name
n,a
a) | Just ([GenLocated SrcSpanAnnN Name]
ns,a
a) <- (GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))
-> Maybe ([GenLocated SrcSpanAnnN Name], a))
-> [GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
-> [Maybe ([GenLocated SrcSpanAnnN Name], a)]
forall a b. (a -> b) -> [a] -> [b]
map LSig (GhcPass 'Renamed) -> Maybe ([GenLocated SrcSpanAnnN Name], a)
GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))
-> Maybe ([GenLocated SrcSpanAnnN Name], a)
get_info [LSig (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
sigs
, L SrcSpanAnnN
_ Name
n <- [GenLocated SrcSpanAnnN Name]
ns ]
mkClassOpSigs :: [LSig GhcPs] -> [LSig GhcPs]
mkClassOpSigs :: [LSig GhcPs] -> [LSig GhcPs]
mkClassOpSigs [LSig GhcPs]
sigs
= (GenLocated SrcSpanAnnA (Sig GhcPs)
-> GenLocated SrcSpanAnnA (Sig GhcPs))
-> [GenLocated SrcSpanAnnA (Sig GhcPs)]
-> [GenLocated SrcSpanAnnA (Sig GhcPs)]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpanAnnA (Sig GhcPs)
-> GenLocated SrcSpanAnnA (Sig GhcPs)
forall {pass} {l}.
(XTypeSig pass ~ XClassOpSig pass) =>
GenLocated l (Sig pass) -> GenLocated l (Sig pass)
fiddle [LSig GhcPs]
[GenLocated SrcSpanAnnA (Sig GhcPs)]
sigs
where
fiddle :: GenLocated l (Sig pass) -> GenLocated l (Sig pass)
fiddle (L l
loc (TypeSig XTypeSig pass
anns [LIdP pass]
nms LHsSigWcType pass
ty))
= l -> Sig pass -> GenLocated l (Sig pass)
forall l e. l -> e -> GenLocated l e
L l
loc (XClassOpSig pass
-> Bool -> [LIdP pass] -> LHsSigType pass -> Sig pass
forall pass.
XClassOpSig pass
-> Bool -> [LIdP pass] -> LHsSigType pass -> Sig pass
ClassOpSig XClassOpSig pass
XTypeSig pass
anns Bool
False [LIdP pass]
nms (LHsSigWcType pass -> LHsSigType pass
forall pass. LHsSigWcType pass -> LHsSigType pass
dropWildCards LHsSigWcType pass
ty))
fiddle GenLocated l (Sig pass)
sig = GenLocated l (Sig pass)
sig
nlAscribe :: RdrName -> LHsExpr GhcPs -> LHsExpr GhcPs
nlAscribe :: RdrName -> LHsExpr GhcPs -> LHsExpr GhcPs
nlAscribe RdrName
ty LHsExpr GhcPs
e = HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (HsExpr GhcPs -> LocatedA (HsExpr GhcPs))
-> HsExpr GhcPs -> LocatedA (HsExpr GhcPs)
forall a b. (a -> b) -> a -> b
$ XExprWithTySig GhcPs
-> LHsExpr GhcPs -> LHsSigWcType (NoGhcTc GhcPs) -> HsExpr GhcPs
forall p.
XExprWithTySig p
-> LHsExpr p -> LHsSigWcType (NoGhcTc p) -> HsExpr p
ExprWithTySig XExprWithTySig GhcPs
forall a. NoAnn a => a
noAnn LHsExpr GhcPs
e
(LHsSigWcType (NoGhcTc GhcPs) -> HsExpr GhcPs)
-> LHsSigWcType (NoGhcTc GhcPs) -> HsExpr GhcPs
forall a b. (a -> b) -> a -> b
$ LHsSigType (NoGhcTc GhcPs)
-> HsWildCardBndrs GhcPs (LHsSigType (NoGhcTc GhcPs))
forall thing. thing -> HsWildCardBndrs GhcPs thing
mkHsWildCardBndrs (LHsSigType (NoGhcTc GhcPs)
-> HsWildCardBndrs GhcPs (LHsSigType (NoGhcTc GhcPs)))
-> LHsSigType (NoGhcTc GhcPs)
-> HsWildCardBndrs GhcPs (LHsSigType (NoGhcTc GhcPs))
forall a b. (a -> b) -> a -> b
$ HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall a b. (a -> b) -> a -> b
$ LHsType GhcPs -> HsSigType GhcPs
mkHsImplicitSigType
(LHsType GhcPs -> HsSigType GhcPs)
-> LHsType GhcPs -> HsSigType GhcPs
forall a b. (a -> b) -> a -> b
$ PromotionFlag -> IdP GhcPs -> LHsType GhcPs
forall (p :: Pass) a.
IsSrcSpanAnn p a =>
PromotionFlag -> IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsTyVar PromotionFlag
NotPromoted IdP GhcPs
RdrName
ty
mkLHsWrap :: HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap :: HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap HsWrapper
co_fn (L SrcSpanAnnA
loc HsExpr GhcTc
e) = SrcSpanAnnA
-> HsExpr GhcTc -> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc (HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap HsWrapper
co_fn HsExpr GhcTc
e)
mkHsWrap :: HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap :: HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap HsWrapper
co_fn HsExpr GhcTc
e | HsWrapper -> Bool
isIdHsWrapper HsWrapper
co_fn = HsExpr GhcTc
e
mkHsWrap HsWrapper
co_fn HsExpr GhcTc
e = XXExpr GhcTc -> HsExpr GhcTc
forall p. XXExpr p -> HsExpr p
XExpr (HsWrapper -> HsExpr GhcTc -> XXExprGhcTc
WrapExpr HsWrapper
co_fn HsExpr GhcTc
e)
mkHsWrapCo :: TcCoercionN
-> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCo :: TcCoercionN -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCo TcCoercionN
co HsExpr GhcTc
e = HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap (TcCoercionN -> HsWrapper
mkWpCastN TcCoercionN
co) HsExpr GhcTc
e
mkHsWrapCoR :: TcCoercionR
-> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCoR :: TcCoercionN -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCoR TcCoercionN
co HsExpr GhcTc
e = HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap (TcCoercionN -> HsWrapper
mkWpCastR TcCoercionN
co) HsExpr GhcTc
e
mkLHsWrapCo :: TcCoercionN -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrapCo :: TcCoercionN -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrapCo TcCoercionN
co (L SrcSpanAnnA
loc HsExpr GhcTc
e) = SrcSpanAnnA
-> HsExpr GhcTc -> GenLocated SrcSpanAnnA (HsExpr GhcTc)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc (TcCoercionN -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCo TcCoercionN
co HsExpr GhcTc
e)
mkHsCmdWrap :: HsWrapper -> HsCmd GhcTc -> HsCmd GhcTc
mkHsCmdWrap :: HsWrapper -> HsCmd GhcTc -> HsCmd GhcTc
mkHsCmdWrap HsWrapper
w HsCmd GhcTc
cmd | HsWrapper -> Bool
isIdHsWrapper HsWrapper
w = HsCmd GhcTc
cmd
| Bool
otherwise = XXCmd GhcTc -> HsCmd GhcTc
forall id. XXCmd id -> HsCmd id
XCmd (HsWrapper -> HsCmd GhcTc -> HsWrap HsCmd
forall (hs_syn :: * -> *).
HsWrapper -> hs_syn GhcTc -> HsWrap hs_syn
HsWrap HsWrapper
w HsCmd GhcTc
cmd)
mkLHsCmdWrap :: HsWrapper -> LHsCmd GhcTc -> LHsCmd GhcTc
mkLHsCmdWrap :: HsWrapper -> LHsCmd GhcTc -> LHsCmd GhcTc
mkLHsCmdWrap HsWrapper
w (L SrcSpanAnnA
loc HsCmd GhcTc
c) = SrcSpanAnnA -> HsCmd GhcTc -> LocatedA (HsCmd GhcTc)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc (HsWrapper -> HsCmd GhcTc -> HsCmd GhcTc
mkHsCmdWrap HsWrapper
w HsCmd GhcTc
c)
mkHsWrapPat :: HsWrapper -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapPat :: HsWrapper -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapPat HsWrapper
co_fn Pat GhcTc
p Type
ty | HsWrapper -> Bool
isIdHsWrapper HsWrapper
co_fn = Pat GhcTc
p
| Bool
otherwise = XXPat GhcTc -> Pat GhcTc
forall p. XXPat p -> Pat p
XPat (XXPat GhcTc -> Pat GhcTc) -> XXPat GhcTc -> Pat GhcTc
forall a b. (a -> b) -> a -> b
$ HsWrapper -> Pat GhcTc -> Type -> XXPatGhcTc
CoPat HsWrapper
co_fn Pat GhcTc
p Type
ty
mkLHsWrapPat :: HsWrapper -> LPat GhcTc -> Type -> LPat GhcTc
mkLHsWrapPat :: HsWrapper -> LPat GhcTc -> Type -> LPat GhcTc
mkLHsWrapPat HsWrapper
co_fn (L SrcSpanAnnA
loc Pat GhcTc
p) Type
ty = SrcSpanAnnA -> Pat GhcTc -> GenLocated SrcSpanAnnA (Pat GhcTc)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc (HsWrapper -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapPat HsWrapper
co_fn Pat GhcTc
p Type
ty)
mkHsWrapPatCo :: TcCoercionN -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapPatCo :: TcCoercionN -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapPatCo TcCoercionN
co Pat GhcTc
pat Type
ty | TcCoercionN -> Bool
isReflCo TcCoercionN
co = Pat GhcTc
pat
| Bool
otherwise = XXPat GhcTc -> Pat GhcTc
forall p. XXPat p -> Pat p
XPat (XXPat GhcTc -> Pat GhcTc) -> XXPat GhcTc -> Pat GhcTc
forall a b. (a -> b) -> a -> b
$ HsWrapper -> Pat GhcTc -> Type -> XXPatGhcTc
CoPat (TcCoercionN -> HsWrapper
mkWpCastN TcCoercionN
co) Pat GhcTc
pat Type
ty
mkHsDictLet :: TcEvBinds -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsDictLet :: TcEvBinds -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsDictLet TcEvBinds
ev_binds LHsExpr GhcTc
expr = HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap (TcEvBinds -> HsWrapper
mkWpLet TcEvBinds
ev_binds) LHsExpr GhcTc
expr
mkFunBind :: Origin -> LocatedN RdrName -> [LMatch GhcPs (LHsExpr GhcPs)]
-> HsBind GhcPs
mkFunBind :: Origin
-> LocatedN RdrName
-> [LMatch GhcPs (LHsExpr GhcPs)]
-> HsBind GhcPs
mkFunBind Origin
origin LocatedN RdrName
fn [LMatch GhcPs (LHsExpr GhcPs)]
ms
= FunBind { fun_id :: LIdP GhcPs
fun_id = LIdP GhcPs
LocatedN RdrName
fn
, fun_matches :: MatchGroup GhcPs (LHsExpr GhcPs)
fun_matches = Origin
-> LocatedL [LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
-> MatchGroup GhcPs (LocatedA (HsExpr GhcPs))
forall (p :: Pass) (body :: * -> *).
AnnoBody p body =>
Origin
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatchGroup Origin
origin ([LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
-> LocatedL [LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA [LMatch GhcPs (LHsExpr GhcPs)]
[LocatedA (Match GhcPs (LocatedA (HsExpr GhcPs)))]
ms)
, fun_ext :: XFunBind GhcPs GhcPs
fun_ext = XFunBind GhcPs GhcPs
NoExtField
noExtField
}
mkTopFunBind :: Origin -> LocatedN Name -> [LMatch GhcRn (LHsExpr GhcRn)]
-> HsBind GhcRn
mkTopFunBind :: Origin
-> GenLocated SrcSpanAnnN Name
-> [LMatch (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))]
-> HsBind (GhcPass 'Renamed)
mkTopFunBind Origin
origin GenLocated SrcSpanAnnN Name
fn [LMatch (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))]
ms = FunBind { fun_id :: LIdP (GhcPass 'Renamed)
fun_id = LIdP (GhcPass 'Renamed)
GenLocated SrcSpanAnnN Name
fn
, fun_matches :: MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
fun_matches = Origin
-> LocatedL
[LocatedA
(Match
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))))]
-> MatchGroup
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)))
forall (p :: Pass) (body :: * -> *).
AnnoBody p body =>
Origin
-> LocatedL
[LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))]
-> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatchGroup Origin
origin ([LocatedA
(Match
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))))]
-> LocatedL
[LocatedA
(Match
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))))]
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA [LMatch (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))]
[LocatedA
(Match
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))))]
ms)
, fun_ext :: XFunBind (GhcPass 'Renamed) (GhcPass 'Renamed)
fun_ext = XFunBind (GhcPass 'Renamed) (GhcPass 'Renamed)
NameSet
emptyNameSet
}
mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr GhcPs -> LHsBind GhcPs
mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr GhcPs -> LHsBind GhcPs
mkHsVarBind SrcSpan
loc RdrName
var LHsExpr GhcPs
rhs = SrcSpan
-> RdrName
-> LocatedE [LPat GhcPs]
-> LHsExpr GhcPs
-> LHsBind GhcPs
mkSimpleGeneratedFunBind SrcSpan
loc RdrName
var ([GenLocated SrcSpanAnnA (Pat GhcPs)]
-> GenLocated EpaLocation [GenLocated SrcSpanAnnA (Pat GhcPs)]
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA []) LHsExpr GhcPs
rhs
mkVarBind :: IdP GhcTc -> LHsExpr GhcTc -> LHsBind GhcTc
mkVarBind :: IdP GhcTc -> LHsExpr GhcTc -> LHsBind GhcTc
mkVarBind IdP GhcTc
var LHsExpr GhcTc
rhs = SrcSpanAnnA
-> HsBindLR GhcTc GhcTc
-> GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)
forall l e. l -> e -> GenLocated l e
L (GenLocated SrcSpanAnnA (HsExpr GhcTc) -> SrcSpanAnnA
forall l e. GenLocated l e -> l
getLoc LHsExpr GhcTc
GenLocated SrcSpanAnnA (HsExpr GhcTc)
rhs) (HsBindLR GhcTc GhcTc
-> GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc))
-> HsBindLR GhcTc GhcTc
-> GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)
forall a b. (a -> b) -> a -> b
$
VarBind { var_ext :: XVarBind GhcTc GhcTc
var_ext = XVarBind GhcTc GhcTc
NoExtField
noExtField,
var_id :: IdP GhcTc
var_id = IdP GhcTc
var, var_rhs :: LHsExpr GhcTc
var_rhs = LHsExpr GhcTc
rhs }
mkPatSynBind :: LocatedN RdrName -> HsPatSynDetails GhcPs
-> LPat GhcPs -> HsPatSynDir GhcPs -> [AddEpAnn] -> HsBind GhcPs
mkPatSynBind :: LocatedN RdrName
-> HsPatSynDetails GhcPs
-> LPat GhcPs
-> HsPatSynDir GhcPs
-> [AddEpAnn]
-> HsBind GhcPs
mkPatSynBind LocatedN RdrName
name HsPatSynDetails GhcPs
details LPat GhcPs
lpat HsPatSynDir GhcPs
dir [AddEpAnn]
anns = XPatSynBind GhcPs GhcPs -> PatSynBind GhcPs GhcPs -> HsBind GhcPs
forall idL idR.
XPatSynBind idL idR -> PatSynBind idL idR -> HsBindLR idL idR
PatSynBind XPatSynBind GhcPs GhcPs
NoExtField
noExtField PatSynBind GhcPs GhcPs
psb
where
psb :: PatSynBind GhcPs GhcPs
psb = PSB{ psb_ext :: XPSB GhcPs GhcPs
psb_ext = [AddEpAnn]
XPSB GhcPs GhcPs
anns
, psb_id :: LIdP GhcPs
psb_id = LIdP GhcPs
LocatedN RdrName
name
, psb_args :: HsPatSynDetails GhcPs
psb_args = HsPatSynDetails GhcPs
details
, psb_def :: LPat GhcPs
psb_def = LPat GhcPs
lpat
, psb_dir :: HsPatSynDir GhcPs
psb_dir = HsPatSynDir GhcPs
dir }
isInfixFunBind :: forall id1 id2. UnXRec id2 => HsBindLR id1 id2 -> Bool
isInfixFunBind :: forall id1 id2. UnXRec id2 => HsBindLR id1 id2 -> Bool
isInfixFunBind (FunBind { fun_matches :: forall idL idR. HsBindLR idL idR -> MatchGroup idR (LHsExpr idR)
fun_matches = MG XMG id2 (LHsExpr id2)
_ XRec id2 [LMatch id2 (LHsExpr id2)]
matches })
= (LMatch id2 (LHsExpr id2) -> Bool)
-> [LMatch id2 (LHsExpr id2)] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (Match id2 (LHsExpr id2) -> Bool
forall id body. Match id body -> Bool
isInfixMatch (Match id2 (LHsExpr id2) -> Bool)
-> (LMatch id2 (LHsExpr id2) -> Match id2 (LHsExpr id2))
-> LMatch id2 (LHsExpr id2)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall p a. UnXRec p => XRec p a -> a
unXRec @id2) (forall p a. UnXRec p => XRec p a -> a
unXRec @id2 XRec id2 [LMatch id2 (LHsExpr id2)]
matches)
isInfixFunBind HsBindLR id1 id2
_ = Bool
False
spanHsLocaLBinds :: HsLocalBinds (GhcPass p) -> SrcSpan
spanHsLocaLBinds :: forall (p :: Pass). HsLocalBinds (GhcPass p) -> SrcSpan
spanHsLocaLBinds (EmptyLocalBinds XEmptyLocalBinds (GhcPass p) (GhcPass p)
_) = SrcSpan
noSrcSpan
spanHsLocaLBinds (HsValBinds XHsValBinds (GhcPass p) (GhcPass p)
_ (ValBinds XValBinds (GhcPass p) (GhcPass p)
_ LHsBindsLR (GhcPass p) (GhcPass p)
bs [LSig (GhcPass p)]
sigs))
= (SrcSpan -> SrcSpan -> SrcSpan) -> SrcSpan -> [SrcSpan] -> SrcSpan
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr SrcSpan -> SrcSpan -> SrcSpan
combineSrcSpans SrcSpan
noSrcSpan ([SrcSpan]
bsSpans [SrcSpan] -> [SrcSpan] -> [SrcSpan]
forall a. [a] -> [a] -> [a]
++ [SrcSpan]
sigsSpans)
where
bsSpans :: [SrcSpan]
bsSpans :: [SrcSpan]
bsSpans = (GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))
-> SrcSpan)
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
-> [SrcSpan]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))
-> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA LHsBindsLR (GhcPass p) (GhcPass p)
[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
bs
sigsSpans :: [SrcSpan]
sigsSpans :: [SrcSpan]
sigsSpans = (GenLocated SrcSpanAnnA (Sig (GhcPass p)) -> SrcSpan)
-> [GenLocated SrcSpanAnnA (Sig (GhcPass p))] -> [SrcSpan]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpanAnnA (Sig (GhcPass p)) -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA [LSig (GhcPass p)]
[GenLocated SrcSpanAnnA (Sig (GhcPass p))]
sigs
spanHsLocaLBinds (HsValBinds XHsValBinds (GhcPass p) (GhcPass p)
_ (XValBindsLR (NValBinds [(RecFlag, LHsBindsLR (GhcPass p) (GhcPass p))]
bs [LSig (GhcPass 'Renamed)]
sigs)))
= (SrcSpan -> SrcSpan -> SrcSpan) -> SrcSpan -> [SrcSpan] -> SrcSpan
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr SrcSpan -> SrcSpan -> SrcSpan
combineSrcSpans SrcSpan
noSrcSpan ([SrcSpan]
bsSpans [SrcSpan] -> [SrcSpan] -> [SrcSpan]
forall a. [a] -> [a] -> [a]
++ [SrcSpan]
sigsSpans)
where
bsSpans :: [SrcSpan]
bsSpans :: [SrcSpan]
bsSpans = (GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))
-> SrcSpan)
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
-> [SrcSpan]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))
-> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA ([GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
-> [SrcSpan])
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
-> [SrcSpan]
forall a b. (a -> b) -> a -> b
$ ((RecFlag,
[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])
-> [(RecFlag,
[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])]
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (RecFlag,
[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
forall a b. (a, b) -> b
snd [(RecFlag, LHsBindsLR (GhcPass p) (GhcPass p))]
[(RecFlag,
[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])]
bs
sigsSpans :: [SrcSpan]
sigsSpans :: [SrcSpan]
sigsSpans = (GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed)) -> SrcSpan)
-> [GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))] -> [SrcSpan]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed)) -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA [LSig (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
sigs
spanHsLocaLBinds (HsIPBinds XHsIPBinds (GhcPass p) (GhcPass p)
_ (IPBinds XIPBinds (GhcPass p)
_ [LIPBind (GhcPass p)]
bs))
= (SrcSpan -> SrcSpan -> SrcSpan) -> SrcSpan -> [SrcSpan] -> SrcSpan
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr SrcSpan -> SrcSpan -> SrcSpan
combineSrcSpans SrcSpan
noSrcSpan ((GenLocated SrcSpanAnnA (IPBind (GhcPass p)) -> SrcSpan)
-> [GenLocated SrcSpanAnnA (IPBind (GhcPass p))] -> [SrcSpan]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpanAnnA (IPBind (GhcPass p)) -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA [LIPBind (GhcPass p)]
[GenLocated SrcSpanAnnA (IPBind (GhcPass p))]
bs)
mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> LocatedE [LPat GhcPs]
-> LHsExpr GhcPs -> LHsBind GhcPs
mkSimpleGeneratedFunBind :: SrcSpan
-> RdrName
-> LocatedE [LPat GhcPs]
-> LHsExpr GhcPs
-> LHsBind GhcPs
mkSimpleGeneratedFunBind SrcSpan
loc RdrName
fun LocatedE [LPat GhcPs]
pats LHsExpr GhcPs
expr
= SrcSpanAnnA
-> HsBind GhcPs -> GenLocated SrcSpanAnnA (HsBind GhcPs)
forall l e. l -> e -> GenLocated l e
L (SrcSpan -> SrcSpanAnnA
forall e. HasAnnotation e => SrcSpan -> e
noAnnSrcSpan SrcSpan
loc) (HsBind GhcPs -> GenLocated SrcSpanAnnA (HsBind GhcPs))
-> HsBind GhcPs -> GenLocated SrcSpanAnnA (HsBind GhcPs)
forall a b. (a -> b) -> a -> b
$ Origin
-> LocatedN RdrName
-> [LMatch GhcPs (LHsExpr GhcPs)]
-> HsBind GhcPs
mkFunBind (GenReason -> DoPmc -> Origin
Generated GenReason
OtherExpansion DoPmc
SkipPmc) (SrcSpanAnnN -> RdrName -> LocatedN RdrName
forall l e. l -> e -> GenLocated l e
L (SrcSpan -> SrcSpanAnnN
forall e. HasAnnotation e => SrcSpan -> e
noAnnSrcSpan SrcSpan
loc) RdrName
fun)
[HsMatchContext (LIdP (NoGhcTc GhcPs))
-> LocatedE [LPat GhcPs]
-> LHsExpr GhcPs
-> HsLocalBinds GhcPs
-> LMatch GhcPs (LHsExpr GhcPs)
forall (p :: Pass).
IsPass p =>
HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
-> LocatedE [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> HsLocalBinds (GhcPass p)
-> LMatch (GhcPass p) (LHsExpr (GhcPass p))
mkMatch HsMatchContext (LIdP (NoGhcTc GhcPs))
HsMatchContextPs
ctxt LocatedE [LPat GhcPs]
pats LHsExpr GhcPs
expr HsLocalBinds GhcPs
forall (a :: Pass) (b :: Pass).
HsLocalBindsLR (GhcPass a) (GhcPass b)
emptyLocalBinds]
where
ctxt :: HsMatchContextPs
ctxt :: HsMatchContextPs
ctxt = LocatedN RdrName -> AnnFunRhs -> HsMatchContext (LocatedN RdrName)
forall fn. fn -> AnnFunRhs -> HsMatchContext fn
mkPrefixFunRhs (SrcSpanAnnN -> RdrName -> LocatedN RdrName
forall l e. l -> e -> GenLocated l e
L (SrcSpan -> SrcSpanAnnN
forall e. HasAnnotation e => SrcSpan -> e
noAnnSrcSpan SrcSpan
loc) RdrName
fun) AnnFunRhs
forall a. NoAnn a => a
noAnn
mkPrefixFunRhs :: fn -> AnnFunRhs -> HsMatchContext fn
mkPrefixFunRhs :: forall fn. fn -> AnnFunRhs -> HsMatchContext fn
mkPrefixFunRhs fn
n AnnFunRhs
an = FunRhs { mc_fun :: fn
mc_fun = fn
n
, mc_fixity :: LexicalFixity
mc_fixity = LexicalFixity
Prefix
, mc_strictness :: SrcStrictness
mc_strictness = SrcStrictness
NoSrcStrict
, mc_an :: XFunRhs
mc_an = XFunRhs
AnnFunRhs
an }
mkMatch :: forall p. IsPass p
=> HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
-> LocatedE [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> HsLocalBinds (GhcPass p)
-> LMatch (GhcPass p) (LHsExpr (GhcPass p))
mkMatch :: forall (p :: Pass).
IsPass p =>
HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
-> LocatedE [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> HsLocalBinds (GhcPass p)
-> LMatch (GhcPass p) (LHsExpr (GhcPass p))
mkMatch HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
ctxt LocatedE [LPat (GhcPass p)]
pats LHsExpr (GhcPass p)
expr HsLocalBinds (GhcPass p)
binds
= Match (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
-> GenLocated
SrcSpanAnnA (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p))))
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA (Match { m_ext :: XCMatch (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
m_ext = XCMatch (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
NoExtField
noExtField
, m_ctxt :: HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
m_ctxt = HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
ctxt
, m_pats :: XRec (GhcPass p) [LPat (GhcPass p)]
m_pats = XRec (GhcPass p) [LPat (GhcPass p)]
LocatedE [LPat (GhcPass p)]
pats
, m_grhss :: GRHSs (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
m_grhss = XCGRHSs (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
-> [LGRHS (GhcPass p) (LocatedA (HsExpr (GhcPass p)))]
-> HsLocalBinds (GhcPass p)
-> GRHSs (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
forall p body.
XCGRHSs p body -> [LGRHS p body] -> HsLocalBinds p -> GRHSs p body
GRHSs XCGRHSs (GhcPass p) (LocatedA (HsExpr (GhcPass p)))
EpAnnComments
emptyComments (EpAnn GrhsAnn
-> SrcSpan
-> LocatedA (HsExpr (GhcPass p))
-> [LGRHS (GhcPass p) (LocatedA (HsExpr (GhcPass p)))]
forall (p :: Pass) (body :: * -> *).
(Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
~ EpAnn NoEpAnns) =>
EpAnn GrhsAnn
-> SrcSpan
-> LocatedA (body (GhcPass p))
-> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))]
unguardedRHS EpAnn GrhsAnn
forall a. NoAnn a => a
noAnn SrcSpan
noSrcSpan LHsExpr (GhcPass p)
LocatedA (HsExpr (GhcPass p))
expr) HsLocalBinds (GhcPass p)
binds })
isUnliftedHsBind :: HsBind GhcTc -> Bool
isUnliftedHsBind :: HsBindLR GhcTc GhcTc -> Bool
isUnliftedHsBind (XHsBindsLR (AbsBinds { abs_exports :: AbsBinds -> [ABExport]
abs_exports = [ABExport]
exports
, abs_sig :: AbsBinds -> Bool
abs_sig = Bool
has_sig
, abs_binds :: AbsBinds -> LHsBinds GhcTc
abs_binds = LHsBinds GhcTc
binds }))
| Bool
has_sig = (ABExport -> Bool) -> [ABExport] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (Id -> Bool
is_unlifted_id (Id -> Bool) -> (ABExport -> Id) -> ABExport -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ABExport -> Id
abe_poly) [ABExport]
exports
| Bool
otherwise = LHsBinds GhcTc -> Bool
isUnliftedHsBinds LHsBinds GhcTc
binds
isUnliftedHsBind (FunBind { fun_id :: forall idL idR. HsBindLR idL idR -> LIdP idL
fun_id = L SrcSpanAnnN
_ Id
fun })
= Id -> Bool
is_unlifted_id Id
fun
isUnliftedHsBind (VarBind { var_id :: forall idL idR. HsBindLR idL idR -> IdP idL
var_id = IdP GhcTc
var })
= Id -> Bool
is_unlifted_id IdP GhcTc
Id
var
isUnliftedHsBind (PatBind { pat_lhs :: forall idL idR. HsBindLR idL idR -> LPat idL
pat_lhs = LPat GhcTc
pat })
= (Id -> Bool) -> [Id] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Id -> Bool
is_unlifted_id (CollectFlag GhcTc -> LPat GhcTc -> [IdP GhcTc]
forall p. CollectPass p => CollectFlag p -> LPat p -> [IdP p]
collectPatBinders CollectFlag GhcTc
forall p. CollectFlag p
CollNoDictBinders LPat GhcTc
pat)
isUnliftedHsBind (PatSynBind {}) = String -> Bool
forall a. HasCallStack => String -> a
panic String
"isUnliftedBind: PatSynBind"
isUnliftedHsBinds :: LHsBinds GhcTc -> Bool
isUnliftedHsBinds :: LHsBinds GhcTc -> Bool
isUnliftedHsBinds = (GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc) -> Bool)
-> [GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (HsBindLR GhcTc GhcTc -> Bool
isUnliftedHsBind (HsBindLR GhcTc GhcTc -> Bool)
-> (GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)
-> HsBindLR GhcTc GhcTc)
-> GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)
-> HsBindLR GhcTc GhcTc
forall l e. GenLocated l e -> e
unLoc)
is_unlifted_id :: Id -> Bool
is_unlifted_id :: Id -> Bool
is_unlifted_id Id
id = HasDebugCallStack => Type -> Bool
Type -> Bool
isUnliftedType (Id -> Type
idType Id
id)
isBangedHsBind :: HsBind GhcTc -> Bool
isBangedHsBind :: HsBindLR GhcTc GhcTc -> Bool
isBangedHsBind (XHsBindsLR (AbsBinds { abs_binds :: AbsBinds -> LHsBinds GhcTc
abs_binds = LHsBinds GhcTc
binds }))
= (GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc) -> Bool)
-> [GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (HsBindLR GhcTc GhcTc -> Bool
isBangedHsBind (HsBindLR GhcTc GhcTc -> Bool)
-> (GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)
-> HsBindLR GhcTc GhcTc)
-> GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)
-> HsBindLR GhcTc GhcTc
forall l e. GenLocated l e -> e
unLoc) LHsBinds GhcTc
[GenLocated SrcSpanAnnA (HsBindLR GhcTc GhcTc)]
binds
isBangedHsBind (FunBind {fun_matches :: forall idL idR. HsBindLR idL idR -> MatchGroup idR (LHsExpr idR)
fun_matches = MatchGroup GhcTc (LHsExpr GhcTc)
matches})
| [L SrcSpanAnnA
_ Match GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc))
match] <- GenLocated
SrcSpanAnnL
[GenLocated
SrcSpanAnnA (Match GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc)))]
-> [GenLocated
SrcSpanAnnA (Match GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc)))]
forall l e. GenLocated l e -> e
unLoc (GenLocated
SrcSpanAnnL
[GenLocated
SrcSpanAnnA (Match GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc)))]
-> [GenLocated
SrcSpanAnnA (Match GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc)))])
-> GenLocated
SrcSpanAnnL
[GenLocated
SrcSpanAnnA (Match GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc)))]
-> [GenLocated
SrcSpanAnnA (Match GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc)))]
forall a b. (a -> b) -> a -> b
$ MatchGroup GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc))
-> XRec
GhcTc [LMatch GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc))]
forall p body. MatchGroup p body -> XRec p [LMatch p body]
mg_alts MatchGroup GhcTc (LHsExpr GhcTc)
MatchGroup GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc))
matches
, FunRhs{mc_strictness :: forall fn. HsMatchContext fn -> SrcStrictness
mc_strictness = SrcStrictness
SrcStrict} <- Match GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc))
-> HsMatchContext (LIdP (NoGhcTc GhcTc))
forall p body. Match p body -> HsMatchContext (LIdP (NoGhcTc p))
m_ctxt Match GhcTc (GenLocated SrcSpanAnnA (HsExpr GhcTc))
match
= Bool
True
isBangedHsBind (PatBind {pat_lhs :: forall idL idR. HsBindLR idL idR -> LPat idL
pat_lhs = LPat GhcTc
pat})
= LPat GhcTc -> Bool
forall (p :: Pass). LPat (GhcPass p) -> Bool
isBangedLPat LPat GhcTc
pat
isBangedHsBind HsBindLR GhcTc GhcTc
_
= Bool
False
collectLocalBinders :: CollectPass (GhcPass idL)
=> CollectFlag (GhcPass idL)
-> HsLocalBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
collectLocalBinders :: forall (idL :: Pass) (idR :: Pass).
CollectPass (GhcPass idL) =>
CollectFlag (GhcPass idL)
-> HsLocalBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
collectLocalBinders CollectFlag (GhcPass idL)
flag = \case
HsValBinds XHsValBinds (GhcPass idL) (GhcPass idR)
_ HsValBindsLR (GhcPass idL) (GhcPass idR)
binds -> CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass).
CollectPass (GhcPass idL) =>
CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
collectHsIdBinders CollectFlag (GhcPass idL)
flag HsValBindsLR (GhcPass idL) (GhcPass idR)
binds
HsIPBinds {} -> []
EmptyLocalBinds XEmptyLocalBinds (GhcPass idL) (GhcPass idR)
_ -> []
collectHsIdBinders :: CollectPass (GhcPass idL)
=> CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
collectHsIdBinders :: forall (idL :: Pass) (idR :: Pass).
CollectPass (GhcPass idL) =>
CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
collectHsIdBinders CollectFlag (GhcPass idL)
flag = Bool
-> CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
forall (idL :: Pass) idR.
CollectPass (GhcPass idL) =>
Bool
-> CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) idR
-> [IdP (GhcPass idL)]
collect_hs_val_binders Bool
True CollectFlag (GhcPass idL)
flag
collectHsValBinders :: CollectPass (GhcPass idL)
=> CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) idR
-> [IdP (GhcPass idL)]
collectHsValBinders :: forall (idL :: Pass) idR.
CollectPass (GhcPass idL) =>
CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) idR -> [IdP (GhcPass idL)]
collectHsValBinders CollectFlag (GhcPass idL)
flag = Bool
-> CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) idR
-> [IdP (GhcPass idL)]
forall (idL :: Pass) idR.
CollectPass (GhcPass idL) =>
Bool
-> CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) idR
-> [IdP (GhcPass idL)]
collect_hs_val_binders Bool
False CollectFlag (GhcPass idL)
flag
collectHsBindBinders :: CollectPass p
=> CollectFlag p
-> HsBindLR p idR
-> [IdP p]
collectHsBindBinders :: forall p idR.
CollectPass p =>
CollectFlag p -> HsBindLR p idR -> [IdP p]
collectHsBindBinders CollectFlag p
flag HsBindLR p idR
b = Bool -> CollectFlag p -> HsBindLR p idR -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> CollectFlag p -> HsBindLR p idR -> [IdP p] -> [IdP p]
collect_bind Bool
False CollectFlag p
flag HsBindLR p idR
b []
collectHsBindsBinders :: CollectPass p
=> CollectFlag p
-> LHsBindsLR p idR
-> [IdP p]
collectHsBindsBinders :: forall p idR.
CollectPass p =>
CollectFlag p -> LHsBindsLR p idR -> [IdP p]
collectHsBindsBinders CollectFlag p
flag LHsBindsLR p idR
binds = Bool -> CollectFlag p -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> CollectFlag p -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
collect_binds Bool
False CollectFlag p
flag LHsBindsLR p idR
binds []
collectHsBindListBinders :: forall p idR. CollectPass p
=> CollectFlag p
-> [LHsBindLR p idR]
-> [IdP p]
collectHsBindListBinders :: forall p idR.
CollectPass p =>
CollectFlag p -> LHsBindsLR p idR -> [IdP p]
collectHsBindListBinders CollectFlag p
flag = (XRec p (HsBindLR p idR) -> [IdP p] -> [IdP p])
-> [IdP p] -> [XRec p (HsBindLR p idR)] -> [IdP p]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (Bool -> CollectFlag p -> HsBindLR p idR -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> CollectFlag p -> HsBindLR p idR -> [IdP p] -> [IdP p]
collect_bind Bool
False CollectFlag p
flag (HsBindLR p idR -> [IdP p] -> [IdP p])
-> (XRec p (HsBindLR p idR) -> HsBindLR p idR)
-> XRec p (HsBindLR p idR)
-> [IdP p]
-> [IdP p]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall p a. UnXRec p => XRec p a -> a
unXRec @p) []
collect_hs_val_binders :: CollectPass (GhcPass idL)
=> Bool
-> CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) idR
-> [IdP (GhcPass idL)]
collect_hs_val_binders :: forall (idL :: Pass) idR.
CollectPass (GhcPass idL) =>
Bool
-> CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) idR
-> [IdP (GhcPass idL)]
collect_hs_val_binders Bool
ps CollectFlag (GhcPass idL)
flag = \case
ValBinds XValBinds (GhcPass idL) idR
_ LHsBindsLR (GhcPass idL) idR
binds [LSig idR]
_ -> Bool
-> CollectFlag (GhcPass idL)
-> LHsBindsLR (GhcPass idL) idR
-> [IdP (GhcPass idL)]
-> [IdP (GhcPass idL)]
forall p idR.
CollectPass p =>
Bool -> CollectFlag p -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
collect_binds Bool
ps CollectFlag (GhcPass idL)
flag LHsBindsLR (GhcPass idL) idR
binds []
XValBindsLR (NValBinds [(RecFlag, LHsBinds (GhcPass idL))]
binds [LSig (GhcPass 'Renamed)]
_) -> Bool
-> CollectFlag (GhcPass idL)
-> [(RecFlag, LHsBinds (GhcPass idL))]
-> [IdP (GhcPass idL)]
forall p.
CollectPass p =>
Bool -> CollectFlag p -> [(RecFlag, LHsBinds p)] -> [IdP p]
collect_out_binds Bool
ps CollectFlag (GhcPass idL)
flag [(RecFlag, LHsBinds (GhcPass idL))]
binds
collect_out_binds :: forall p. CollectPass p
=> Bool
-> CollectFlag p
-> [(RecFlag, LHsBinds p)]
-> [IdP p]
collect_out_binds :: forall p.
CollectPass p =>
Bool -> CollectFlag p -> [(RecFlag, LHsBinds p)] -> [IdP p]
collect_out_binds Bool
ps CollectFlag p
flag = ((RecFlag, [XRec p (HsBindLR p p)]) -> [IdP p] -> [IdP p])
-> [IdP p] -> [(RecFlag, [XRec p (HsBindLR p p)])] -> [IdP p]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (Bool
-> CollectFlag p -> [XRec p (HsBindLR p p)] -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> CollectFlag p -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
collect_binds Bool
ps CollectFlag p
flag ([XRec p (HsBindLR p p)] -> [IdP p] -> [IdP p])
-> ((RecFlag, [XRec p (HsBindLR p p)]) -> [XRec p (HsBindLR p p)])
-> (RecFlag, [XRec p (HsBindLR p p)])
-> [IdP p]
-> [IdP p]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RecFlag, [XRec p (HsBindLR p p)]) -> [XRec p (HsBindLR p p)]
forall a b. (a, b) -> b
snd) []
collect_binds :: forall p idR. CollectPass p
=> Bool
-> CollectFlag p
-> LHsBindsLR p idR
-> [IdP p]
-> [IdP p]
collect_binds :: forall p idR.
CollectPass p =>
Bool -> CollectFlag p -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
collect_binds Bool
ps CollectFlag p
flag LHsBindsLR p idR
binds [IdP p]
acc = (XRec p (HsBindLR p idR) -> [IdP p] -> [IdP p])
-> [IdP p] -> LHsBindsLR p idR -> [IdP p]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (Bool -> CollectFlag p -> HsBindLR p idR -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> CollectFlag p -> HsBindLR p idR -> [IdP p] -> [IdP p]
collect_bind Bool
ps CollectFlag p
flag (HsBindLR p idR -> [IdP p] -> [IdP p])
-> (XRec p (HsBindLR p idR) -> HsBindLR p idR)
-> XRec p (HsBindLR p idR)
-> [IdP p]
-> [IdP p]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall p a. UnXRec p => XRec p a -> a
unXRec @p) [IdP p]
acc LHsBindsLR p idR
binds
collect_bind :: forall p idR. CollectPass p
=> Bool
-> CollectFlag p
-> HsBindLR p idR
-> [IdP p]
-> [IdP p]
collect_bind :: forall p idR.
CollectPass p =>
Bool -> CollectFlag p -> HsBindLR p idR -> [IdP p] -> [IdP p]
collect_bind Bool
_ CollectFlag p
_ (FunBind { fun_id :: forall idL idR. HsBindLR idL idR -> LIdP idL
fun_id = LIdP p
f }) [IdP p]
acc = forall p a. UnXRec p => XRec p a -> a
unXRec @p LIdP p
f IdP p -> [IdP p] -> [IdP p]
forall a. a -> [a] -> [a]
: [IdP p]
acc
collect_bind Bool
_ CollectFlag p
flag (PatBind { pat_lhs :: forall idL idR. HsBindLR idL idR -> LPat idL
pat_lhs = LPat p
p }) [IdP p]
acc = CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
p [IdP p]
acc
collect_bind Bool
_ CollectFlag p
_ (VarBind { var_id :: forall idL idR. HsBindLR idL idR -> IdP idL
var_id = IdP p
f }) [IdP p]
acc = IdP p
f IdP p -> [IdP p] -> [IdP p]
forall a. a -> [a] -> [a]
: [IdP p]
acc
collect_bind Bool
omitPatSyn CollectFlag p
_ (PatSynBind XPatSynBind p idR
_ (PSB { psb_id :: forall idL idR. PatSynBind idL idR -> LIdP idL
psb_id = LIdP p
ps })) [IdP p]
acc
| Bool
omitPatSyn = [IdP p]
acc
| Bool
otherwise = forall p a. UnXRec p => XRec p a -> a
unXRec @p LIdP p
ps IdP p -> [IdP p] -> [IdP p]
forall a. a -> [a] -> [a]
: [IdP p]
acc
collect_bind Bool
_ CollectFlag p
_ (PatSynBind XPatSynBind p idR
_ (XPatSynBind XXPatSynBind p idR
_)) [IdP p]
acc = [IdP p]
acc
collect_bind Bool
_ CollectFlag p
_ (XHsBindsLR XXHsBindsLR p idR
b) [IdP p]
acc = forall p pR.
CollectPass p =>
XXHsBindsLR p pR -> [IdP p] -> [IdP p]
collectXXHsBindsLR @p @idR XXHsBindsLR p idR
b [IdP p]
acc
collectMethodBinders :: forall idL idR. UnXRec idL => LHsBindsLR idL idR -> [LIdP idL]
collectMethodBinders :: forall idL idR. UnXRec idL => LHsBindsLR idL idR -> [LIdP idL]
collectMethodBinders LHsBindsLR idL idR
binds = (XRec idL (HsBindLR idL idR)
-> [XRec idL (IdP idL)] -> [XRec idL (IdP idL)])
-> [XRec idL (IdP idL)]
-> LHsBindsLR idL idR
-> [XRec idL (IdP idL)]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (HsBindLR idL idR -> [XRec idL (IdP idL)] -> [XRec idL (IdP idL)]
forall {idL} {idR}.
HsBindLR idL idR -> [XRec idL (IdP idL)] -> [XRec idL (IdP idL)]
get (HsBindLR idL idR -> [XRec idL (IdP idL)] -> [XRec idL (IdP idL)])
-> (XRec idL (HsBindLR idL idR) -> HsBindLR idL idR)
-> XRec idL (HsBindLR idL idR)
-> [XRec idL (IdP idL)]
-> [XRec idL (IdP idL)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall p a. UnXRec p => XRec p a -> a
unXRec @idL) [] LHsBindsLR idL idR
binds
where
get :: HsBindLR idL idR -> [XRec idL (IdP idL)] -> [XRec idL (IdP idL)]
get (FunBind { fun_id :: forall idL idR. HsBindLR idL idR -> LIdP idL
fun_id = XRec idL (IdP idL)
f }) [XRec idL (IdP idL)]
fs = XRec idL (IdP idL)
f XRec idL (IdP idL) -> [XRec idL (IdP idL)] -> [XRec idL (IdP idL)]
forall a. a -> [a] -> [a]
: [XRec idL (IdP idL)]
fs
get HsBindLR idL idR
_ [XRec idL (IdP idL)]
fs = [XRec idL (IdP idL)]
fs
collectLStmtsBinders
:: (IsPass idL, IsPass idR, CollectPass (GhcPass idL))
=> CollectFlag (GhcPass idL)
-> [LStmtLR (GhcPass idL) (GhcPass idR) body]
-> [IdP (GhcPass idL)]
collectLStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> [LStmtLR (GhcPass idL) (GhcPass idR) body]
-> [IdP (GhcPass idL)]
collectLStmtsBinders CollectFlag (GhcPass idL)
flag = (GenLocated
(Anno (StmtLR (GhcPass idL) (GhcPass idR) body))
(StmtLR (GhcPass idL) (GhcPass idR) body)
-> [IdGhcP idL])
-> [GenLocated
(Anno (StmtLR (GhcPass idL) (GhcPass idR) body))
(StmtLR (GhcPass idL) (GhcPass idR) body)]
-> [IdGhcP idL]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (CollectFlag (GhcPass idL)
-> XRec (GhcPass idL) (StmtLR (GhcPass idL) (GhcPass idR) body)
-> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
collectLStmtBinders CollectFlag (GhcPass idL)
flag)
collectStmtsBinders
:: (IsPass idL, IsPass idR, CollectPass (GhcPass idL))
=> CollectFlag (GhcPass idL)
-> [StmtLR (GhcPass idL) (GhcPass idR) body]
-> [IdP (GhcPass idL)]
collectStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> [StmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
collectStmtsBinders CollectFlag (GhcPass idL)
flag = (StmtLR (GhcPass idL) (GhcPass idR) body -> [IdGhcP idL])
-> [StmtLR (GhcPass idL) (GhcPass idR) body] -> [IdGhcP idL]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (CollectFlag (GhcPass idL)
-> StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
collectStmtBinders CollectFlag (GhcPass idL)
flag)
collectLStmtBinders
:: (IsPass idL, IsPass idR, CollectPass (GhcPass idL))
=> CollectFlag (GhcPass idL)
-> LStmtLR (GhcPass idL) (GhcPass idR) body
-> [IdP (GhcPass idL)]
collectLStmtBinders :: forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
collectLStmtBinders CollectFlag (GhcPass idL)
flag = CollectFlag (GhcPass idL)
-> StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
collectStmtBinders CollectFlag (GhcPass idL)
flag (StmtLR (GhcPass idL) (GhcPass idR) body -> [IdGhcP idL])
-> (GenLocated
(Anno (StmtLR (GhcPass idL) (GhcPass idR) body))
(StmtLR (GhcPass idL) (GhcPass idR) body)
-> StmtLR (GhcPass idL) (GhcPass idR) body)
-> GenLocated
(Anno (StmtLR (GhcPass idL) (GhcPass idR) body))
(StmtLR (GhcPass idL) (GhcPass idR) body)
-> [IdGhcP idL]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated
(Anno (StmtLR (GhcPass idL) (GhcPass idR) body))
(StmtLR (GhcPass idL) (GhcPass idR) body)
-> StmtLR (GhcPass idL) (GhcPass idR) body
forall l e. GenLocated l e -> e
unLoc
collectStmtBinders
:: forall idL idR body . (IsPass idL, IsPass idR, CollectPass (GhcPass idL))
=> CollectFlag (GhcPass idL)
-> StmtLR (GhcPass idL) (GhcPass idR) body
-> [IdP (GhcPass idL)]
collectStmtBinders :: forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
collectStmtBinders CollectFlag (GhcPass idL)
flag = \case
BindStmt XBindStmt (GhcPass idL) (GhcPass idR) body
_ LPat (GhcPass idL)
pat body
_ -> CollectFlag (GhcPass idL)
-> LPat (GhcPass idL) -> [IdP (GhcPass idL)]
forall p. CollectPass p => CollectFlag p -> LPat p -> [IdP p]
collectPatBinders CollectFlag (GhcPass idL)
flag LPat (GhcPass idL)
pat
LetStmt XLetStmt (GhcPass idL) (GhcPass idR) body
_ HsLocalBindsLR (GhcPass idL) (GhcPass idR)
binds -> CollectFlag (GhcPass idL)
-> HsLocalBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass).
CollectPass (GhcPass idL) =>
CollectFlag (GhcPass idL)
-> HsLocalBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
collectLocalBinders CollectFlag (GhcPass idL)
flag HsLocalBindsLR (GhcPass idL) (GhcPass idR)
binds
BodyStmt {} -> []
LastStmt {} -> []
ParStmt XParStmt (GhcPass idL) (GhcPass idR) body
_ [ParStmtBlock (GhcPass idL) (GhcPass idR)]
xs HsExpr (GhcPass idR)
_ SyntaxExpr (GhcPass idR)
_ -> CollectFlag (GhcPass idL)
-> [LStmtLR
(GhcPass idL)
(GhcPass idL)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass idL)))]
-> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> [LStmtLR (GhcPass idL) (GhcPass idR) body]
-> [IdP (GhcPass idL)]
collectLStmtsBinders CollectFlag (GhcPass idL)
flag [LStmtLR
(GhcPass idL)
(GhcPass idL)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass idL)))
GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass idL)
(GhcPass idL)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass idL))))
s | ParStmtBlock XParStmtBlock (GhcPass idL) (GhcPass idR)
_ [ExprLStmt (GhcPass idL)]
ss [IdP (GhcPass idR)]
_ SyntaxExpr (GhcPass idR)
_ <- [ParStmtBlock (GhcPass idL) (GhcPass idR)]
xs, GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass idL)
(GhcPass idL)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass idL))))
s <- [ExprLStmt (GhcPass idL)]
[GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass idL)
(GhcPass idL)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass idL))))]
ss]
TransStmt { trS_stmts :: forall idL idR body. StmtLR idL idR body -> [ExprLStmt idL]
trS_stmts = [ExprLStmt (GhcPass idL)]
stmts } -> CollectFlag (GhcPass idL)
-> [LStmtLR
(GhcPass idL)
(GhcPass idL)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass idL)))]
-> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> [LStmtLR (GhcPass idL) (GhcPass idR) body]
-> [IdP (GhcPass idL)]
collectLStmtsBinders CollectFlag (GhcPass idL)
flag [ExprLStmt (GhcPass idL)]
[LStmtLR
(GhcPass idL)
(GhcPass idL)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass idL)))]
stmts
RecStmt { recS_stmts :: forall idL idR body.
StmtLR idL idR body -> XRec idR [LStmtLR idL idR body]
recS_stmts = L Anno
[GenLocated
(Anno (StmtLR (GhcPass idL) (GhcPass idR) body))
(StmtLR (GhcPass idL) (GhcPass idR) body)]
_ [GenLocated
(Anno (StmtLR (GhcPass idL) (GhcPass idR) body))
(StmtLR (GhcPass idL) (GhcPass idR) body)]
ss } -> CollectFlag (GhcPass idL)
-> [LStmtLR (GhcPass idL) (GhcPass idR) body]
-> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass) body.
(IsPass idL, IsPass idR, CollectPass (GhcPass idL)) =>
CollectFlag (GhcPass idL)
-> [LStmtLR (GhcPass idL) (GhcPass idR) body]
-> [IdP (GhcPass idL)]
collectLStmtsBinders CollectFlag (GhcPass idL)
flag [LStmtLR (GhcPass idL) (GhcPass idR) body]
[GenLocated
(Anno (StmtLR (GhcPass idL) (GhcPass idR) body))
(StmtLR (GhcPass idL) (GhcPass idR) body)]
ss
XStmtLR XXStmtLR (GhcPass idL) (GhcPass idR) body
x -> case GhcPass idR
forall (p :: Pass). IsPass p => GhcPass p
ghcPass :: GhcPass idR of
GhcPass idR
GhcRn -> ApplicativeStmt (GhcPass idL) (GhcPass 'Renamed)
-> [IdP (GhcPass idL)]
forall a. ApplicativeStmt (GhcPass idL) a -> [IdP (GhcPass idL)]
collectApplicativeStmtBndrs XXStmtLR (GhcPass idL) (GhcPass idR) body
ApplicativeStmt (GhcPass idL) (GhcPass 'Renamed)
x
GhcPass idR
GhcTc -> ApplicativeStmt (GhcPass idL) GhcTc -> [IdP (GhcPass idL)]
forall a. ApplicativeStmt (GhcPass idL) a -> [IdP (GhcPass idL)]
collectApplicativeStmtBndrs XXStmtLR (GhcPass idL) (GhcPass idR) body
ApplicativeStmt (GhcPass idL) GhcTc
x
where
collectApplicativeStmtBndrs :: ApplicativeStmt (GhcPass idL) a -> [IdP (GhcPass idL)]
collectApplicativeStmtBndrs :: forall a. ApplicativeStmt (GhcPass idL) a -> [IdP (GhcPass idL)]
collectApplicativeStmtBndrs (ApplicativeStmt XApplicativeStmt (GhcPass idL) a
_ [(SyntaxExpr a, ApplicativeArg (GhcPass idL))]
args Maybe (SyntaxExpr a)
_) = ((SyntaxExpr a, ApplicativeArg (GhcPass idL)) -> [IdGhcP idL])
-> [(SyntaxExpr a, ApplicativeArg (GhcPass idL))] -> [IdGhcP idL]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (ApplicativeArg (GhcPass idL) -> [IdP (GhcPass idL)]
ApplicativeArg (GhcPass idL) -> [IdGhcP idL]
collectArgBinders (ApplicativeArg (GhcPass idL) -> [IdGhcP idL])
-> ((SyntaxExpr a, ApplicativeArg (GhcPass idL))
-> ApplicativeArg (GhcPass idL))
-> (SyntaxExpr a, ApplicativeArg (GhcPass idL))
-> [IdGhcP idL]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SyntaxExpr a, ApplicativeArg (GhcPass idL))
-> ApplicativeArg (GhcPass idL)
forall a b. (a, b) -> b
snd) [(SyntaxExpr a, ApplicativeArg (GhcPass idL))]
args
collectArgBinders :: ApplicativeArg (GhcPass idL) -> [IdP (GhcPass idL)]
collectArgBinders = \case
ApplicativeArgOne { app_arg_pattern :: forall idL. ApplicativeArg idL -> LPat idL
app_arg_pattern = LPat (GhcPass idL)
pat } -> CollectFlag (GhcPass idL)
-> LPat (GhcPass idL) -> [IdP (GhcPass idL)]
forall p. CollectPass p => CollectFlag p -> LPat p -> [IdP p]
collectPatBinders CollectFlag (GhcPass idL)
flag LPat (GhcPass idL)
pat
ApplicativeArgMany { bv_pattern :: forall idL. ApplicativeArg idL -> LPat idL
bv_pattern = LPat (GhcPass idL)
pat } -> CollectFlag (GhcPass idL)
-> LPat (GhcPass idL) -> [IdP (GhcPass idL)]
forall p. CollectPass p => CollectFlag p -> LPat p -> [IdP p]
collectPatBinders CollectFlag (GhcPass idL)
flag LPat (GhcPass idL)
pat
collectPatBinders
:: CollectPass p
=> CollectFlag p
-> LPat p
-> [IdP p]
collectPatBinders :: forall p. CollectPass p => CollectFlag p -> LPat p -> [IdP p]
collectPatBinders CollectFlag p
flag LPat p
pat = CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat []
collectPatsBinders
:: CollectPass p
=> CollectFlag p
-> [LPat p]
-> [IdP p]
collectPatsBinders :: forall p. CollectPass p => CollectFlag p -> [LPat p] -> [IdP p]
collectPatsBinders CollectFlag p
flag [LPat p]
pats = (LPat p -> [IdP p] -> [IdP p]) -> [IdP p] -> [LPat p] -> [IdP p]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag) [] [LPat p]
pats
data CollectFlag p where
CollNoDictBinders :: CollectFlag p
CollWithDictBinders :: CollectFlag GhcTc
CollVarTyVarBinders :: CollectFlag GhcRn
collect_lpat :: forall p. CollectPass p
=> CollectFlag p
-> LPat p
-> [IdP p]
-> [IdP p]
collect_lpat :: forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs = CollectFlag p -> Pat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> Pat p -> [IdP p] -> [IdP p]
collect_pat CollectFlag p
flag (forall p a. UnXRec p => XRec p a -> a
unXRec @p LPat p
pat) [IdP p]
bndrs
collect_pat :: forall p. CollectPass p
=> CollectFlag p
-> Pat p
-> [IdP p]
-> [IdP p]
collect_pat :: forall p.
CollectPass p =>
CollectFlag p -> Pat p -> [IdP p] -> [IdP p]
collect_pat CollectFlag p
flag Pat p
pat [IdP p]
bndrs = case Pat p
pat of
VarPat XVarPat p
_ LIdP p
var -> forall p a. UnXRec p => XRec p a -> a
unXRec @p LIdP p
var IdP p -> [IdP p] -> [IdP p]
forall a. a -> [a] -> [a]
: [IdP p]
bndrs
WildPat XWildPat p
_ -> [IdP p]
bndrs
LazyPat XLazyPat p
_ LPat p
pat -> CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs
BangPat XBangPat p
_ LPat p
pat -> CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs
AsPat XAsPat p
_ LIdP p
a LPat p
pat -> forall p a. UnXRec p => XRec p a -> a
unXRec @p LIdP p
a IdP p -> [IdP p] -> [IdP p]
forall a. a -> [a] -> [a]
: CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs
ViewPat XViewPat p
_ LHsExpr p
_ LPat p
pat -> CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs
ParPat XParPat p
_ LPat p
pat -> CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs
ListPat XListPat p
_ [LPat p]
pats -> (LPat p -> [IdP p] -> [IdP p]) -> [IdP p] -> [LPat p] -> [IdP p]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag) [IdP p]
bndrs [LPat p]
pats
TuplePat XTuplePat p
_ [LPat p]
pats Boxity
_ -> (LPat p -> [IdP p] -> [IdP p]) -> [IdP p] -> [LPat p] -> [IdP p]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag) [IdP p]
bndrs [LPat p]
pats
OrPat XOrPat p
_ NonEmpty (LPat p)
_ -> []
SumPat XSumPat p
_ LPat p
pat Int
_ Int
_ -> CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs
LitPat XLitPat p
_ HsLit p
_ -> [IdP p]
bndrs
NPat {} -> [IdP p]
bndrs
NPlusKPat XNPlusKPat p
_ LIdP p
n XRec p (HsOverLit p)
_ HsOverLit p
_ SyntaxExpr p
_ SyntaxExpr p
_ -> forall p a. UnXRec p => XRec p a -> a
unXRec @p LIdP p
n IdP p -> [IdP p] -> [IdP p]
forall a. a -> [a] -> [a]
: [IdP p]
bndrs
SigPat XSigPat p
_ LPat p
pat HsPatSigType (NoGhcTc p)
sig -> case CollectFlag p
flag of
CollectFlag p
CollNoDictBinders -> CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs
CollectFlag p
CollWithDictBinders -> CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs
CollectFlag p
CollVarTyVarBinders -> CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag LPat p
pat [IdP p]
bndrs [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ HsPatSigType (GhcPass 'Renamed) -> [Name]
collectPatSigBndrs HsPatSigType (NoGhcTc p)
HsPatSigType (GhcPass 'Renamed)
sig
XPat XXPat p
ext -> forall p.
CollectPass p =>
CollectFlag p -> XXPat p -> [IdP p] -> [IdP p]
collectXXPat @p CollectFlag p
flag XXPat p
ext [IdP p]
bndrs
SplicePat XSplicePat p
ext HsUntypedSplice p
_ -> forall p.
CollectPass p =>
CollectFlag p -> XSplicePat p -> [IdP p] -> [IdP p]
collectXSplicePat @p CollectFlag p
flag XSplicePat p
ext [IdP p]
bndrs
EmbTyPat XEmbTyPat p
_ HsTyPat (NoGhcTc p)
tp -> CollectFlag p -> HsTyPat (NoGhcTc p) -> [IdP p] -> [IdP p]
forall p.
CollectFlag p -> HsTyPat (NoGhcTc p) -> [IdP p] -> [IdP p]
collect_ty_pat_bndrs CollectFlag p
flag HsTyPat (NoGhcTc p)
tp [IdP p]
bndrs
InvisPat XInvisPat p
_ HsTyPat (NoGhcTc p)
tp -> CollectFlag p -> HsTyPat (NoGhcTc p) -> [IdP p] -> [IdP p]
forall p.
CollectFlag p -> HsTyPat (NoGhcTc p) -> [IdP p] -> [IdP p]
collect_ty_pat_bndrs CollectFlag p
flag HsTyPat (NoGhcTc p)
tp [IdP p]
bndrs
ConPat {pat_args :: forall p. Pat p -> HsConPatDetails p
pat_args=HsConPatDetails p
ps} -> case CollectFlag p
flag of
CollectFlag p
CollNoDictBinders -> (LPat p -> [IdP p] -> [IdP p]) -> [IdP p] -> [LPat p] -> [IdP p]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag) [IdP p]
bndrs (HsConPatDetails p -> [LPat p]
forall p. UnXRec p => HsConPatDetails p -> [LPat p]
hsConPatArgs HsConPatDetails p
ps)
CollectFlag p
CollWithDictBinders -> (GenLocated SrcSpanAnnA (Pat GhcTc) -> [Id] -> [Id])
-> [Id] -> [GenLocated SrcSpanAnnA (Pat GhcTc)] -> [Id]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag) [IdP p]
[Id]
bndrs (HsConPatDetails p -> [LPat p]
forall p. UnXRec p => HsConPatDetails p -> [LPat p]
hsConPatArgs HsConPatDetails p
ps)
[Id] -> [Id] -> [Id]
forall a. [a] -> [a] -> [a]
++ TcEvBinds -> [Id]
collectEvBinders (ConPatTc -> TcEvBinds
cpt_binds (Pat p -> XConPat p
forall p. Pat p -> XConPat p
pat_con_ext Pat p
pat))
CollectFlag p
CollVarTyVarBinders -> (GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [Name] -> [Name])
-> [Name]
-> [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [Name]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
forall p.
CollectPass p =>
CollectFlag p -> LPat p -> [IdP p] -> [IdP p]
collect_lpat CollectFlag p
flag) [IdP p]
[Name]
bndrs (HsConPatDetails p -> [LPat p]
forall p. UnXRec p => HsConPatDetails p -> [LPat p]
hsConPatArgs HsConPatDetails p
ps)
[Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ (HsConPatTyArg (GhcPass 'Renamed) -> [Name])
-> [HsConPatTyArg (GhcPass 'Renamed)] -> [Name]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap HsConPatTyArg (GhcPass 'Renamed) -> [Name]
collectConPatTyArgBndrs (HsConPatDetails p -> [HsConPatTyArg (NoGhcTc p)]
forall p. HsConPatDetails p -> [HsConPatTyArg (NoGhcTc p)]
hsConPatTyArgs HsConPatDetails p
ps)
collectEvBinders :: TcEvBinds -> [Id]
collectEvBinders :: TcEvBinds -> [Id]
collectEvBinders (EvBinds Bag EvBind
bs) = (EvBind -> [Id] -> [Id]) -> [Id] -> Bag EvBind -> [Id]
forall a b. (a -> b -> b) -> b -> Bag a -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr EvBind -> [Id] -> [Id]
add_ev_bndr [] Bag EvBind
bs
collectEvBinders (TcEvBinds {}) = String -> [Id]
forall a. HasCallStack => String -> a
panic String
"ToDo: collectEvBinders"
collectConPatTyArgBndrs :: HsConPatTyArg GhcRn -> [Name]
collectConPatTyArgBndrs :: HsConPatTyArg (GhcPass 'Renamed) -> [Name]
collectConPatTyArgBndrs (HsConPatTyArg XConPatTyArg (GhcPass 'Renamed)
_ HsTyPat (GhcPass 'Renamed)
tp) = HsTyPat (GhcPass 'Renamed) -> [Name]
collectTyPatBndrs HsTyPat (GhcPass 'Renamed)
tp
collect_ty_pat_bndrs :: CollectFlag p -> HsTyPat (NoGhcTc p) -> [IdP p] -> [IdP p]
collect_ty_pat_bndrs :: forall p.
CollectFlag p -> HsTyPat (NoGhcTc p) -> [IdP p] -> [IdP p]
collect_ty_pat_bndrs CollectFlag p
CollNoDictBinders HsTyPat (NoGhcTc p)
_ [IdP p]
bndrs = [IdP p]
bndrs
collect_ty_pat_bndrs CollectFlag p
CollWithDictBinders HsTyPat (NoGhcTc p)
_ [IdP p]
bndrs = [IdP p]
bndrs
collect_ty_pat_bndrs CollectFlag p
CollVarTyVarBinders HsTyPat (NoGhcTc p)
tp [IdP p]
bndrs = HsTyPat (GhcPass 'Renamed) -> [Name]
collectTyPatBndrs HsTyPat (NoGhcTc p)
HsTyPat (GhcPass 'Renamed)
tp [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [IdP p]
[Name]
bndrs
collectTyPatBndrs :: HsTyPat GhcRn -> [Name]
collectTyPatBndrs :: HsTyPat (GhcPass 'Renamed) -> [Name]
collectTyPatBndrs (HsTP (HsTPRn [Name]
nwcs [Name]
imp_tvs [Name]
exp_tvs) LHsType (GhcPass 'Renamed)
_) = [Name]
nwcs [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [Name]
imp_tvs [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [Name]
exp_tvs
collectPatSigBndrs :: HsPatSigType GhcRn -> [Name]
collectPatSigBndrs :: HsPatSigType (GhcPass 'Renamed) -> [Name]
collectPatSigBndrs (HsPS (HsPSRn [Name]
nwcs [Name]
imp_tvs) LHsType (GhcPass 'Renamed)
_) = [Name]
nwcs [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [Name]
imp_tvs
add_ev_bndr :: EvBind -> [Id] -> [Id]
add_ev_bndr :: EvBind -> [Id] -> [Id]
add_ev_bndr (EvBind { eb_lhs :: EvBind -> Id
eb_lhs = Id
b }) [Id]
bs | Id -> Bool
isId Id
b = Id
bId -> [Id] -> [Id]
forall a. a -> [a] -> [a]
:[Id]
bs
| Bool
otherwise = [Id]
bs
class UnXRec p => CollectPass p where
collectXXPat :: CollectFlag p -> XXPat p -> [IdP p] -> [IdP p]
collectXXHsBindsLR :: forall pR. XXHsBindsLR p pR -> [IdP p] -> [IdP p]
collectXSplicePat :: CollectFlag p -> XSplicePat p -> [IdP p] -> [IdP p]
instance IsPass p => CollectPass (GhcPass p) where
collectXXPat :: CollectFlag (GhcPass p)
-> XXPat (GhcPass p) -> [IdP (GhcPass p)] -> [IdP (GhcPass p)]
collectXXPat CollectFlag (GhcPass p)
flag XXPat (GhcPass p)
ext =
case forall (p :: Pass). IsPass p => GhcPass p
ghcPass @p of
GhcPass p
GhcPs -> DataConCantHappen -> [RdrName] -> [RdrName]
forall a. DataConCantHappen -> a
dataConCantHappen XXPat (GhcPass p)
DataConCantHappen
ext
GhcPass p
GhcRn
| HsPatExpanded Pat (GhcPass 'Renamed)
_ Pat (GhcPass p)
pat <- XXPat (GhcPass p)
ext
-> CollectFlag (GhcPass p)
-> Pat (GhcPass p) -> [IdP (GhcPass p)] -> [IdP (GhcPass p)]
forall p.
CollectPass p =>
CollectFlag p -> Pat p -> [IdP p] -> [IdP p]
collect_pat CollectFlag (GhcPass p)
flag Pat (GhcPass p)
pat
GhcPass p
GhcTc -> case XXPat (GhcPass p)
ext of
CoPat HsWrapper
_ Pat GhcTc
pat Type
_ -> CollectFlag (GhcPass p)
-> Pat (GhcPass p) -> [IdP (GhcPass p)] -> [IdP (GhcPass p)]
forall p.
CollectPass p =>
CollectFlag p -> Pat p -> [IdP p] -> [IdP p]
collect_pat CollectFlag (GhcPass p)
flag Pat (GhcPass p)
Pat GhcTc
pat
ExpansionPat Pat (GhcPass 'Renamed)
_ Pat GhcTc
pat -> CollectFlag (GhcPass p)
-> Pat (GhcPass p) -> [IdP (GhcPass p)] -> [IdP (GhcPass p)]
forall p.
CollectPass p =>
CollectFlag p -> Pat p -> [IdP p] -> [IdP p]
collect_pat CollectFlag (GhcPass p)
flag Pat (GhcPass p)
Pat GhcTc
pat
collectXXHsBindsLR :: forall pR.
XXHsBindsLR (GhcPass p) pR
-> [IdP (GhcPass p)] -> [IdP (GhcPass p)]
collectXXHsBindsLR XXHsBindsLR (GhcPass p) pR
ext =
case forall (p :: Pass). IsPass p => GhcPass p
ghcPass @p of
GhcPass p
GhcPs -> DataConCantHappen -> [RdrName] -> [RdrName]
forall a. DataConCantHappen -> a
dataConCantHappen XXHsBindsLR (GhcPass p) pR
DataConCantHappen
ext
GhcPass p
GhcRn -> DataConCantHappen -> [Name] -> [Name]
forall a. DataConCantHappen -> a
dataConCantHappen XXHsBindsLR (GhcPass p) pR
DataConCantHappen
ext
GhcPass p
GhcTc -> case XXHsBindsLR (GhcPass p) pR
ext of
AbsBinds { abs_exports :: AbsBinds -> [ABExport]
abs_exports = [ABExport]
dbinds } -> ((ABExport -> Id) -> [ABExport] -> [Id]
forall a b. (a -> b) -> [a] -> [b]
map ABExport -> Id
abe_poly [ABExport]
dbinds [Id] -> [Id] -> [Id]
forall a. [a] -> [a] -> [a]
++)
collectXSplicePat :: CollectFlag (GhcPass p)
-> XSplicePat (GhcPass p) -> [IdP (GhcPass p)] -> [IdP (GhcPass p)]
collectXSplicePat CollectFlag (GhcPass p)
flag XSplicePat (GhcPass p)
ext =
case forall (p :: Pass). IsPass p => GhcPass p
ghcPass @p of
GhcPass p
GhcPs -> [IdP (GhcPass p)] -> [IdP (GhcPass p)]
[RdrName] -> [RdrName]
forall a. a -> a
id
GhcPass p
GhcRn | (HsUntypedSpliceTop ThModFinalizers
_ Pat (GhcPass p)
pat) <- XSplicePat (GhcPass p)
ext -> CollectFlag (GhcPass p)
-> Pat (GhcPass p) -> [IdP (GhcPass p)] -> [IdP (GhcPass p)]
forall p.
CollectPass p =>
CollectFlag p -> Pat p -> [IdP p] -> [IdP p]
collect_pat CollectFlag (GhcPass p)
flag Pat (GhcPass p)
pat
GhcPass p
GhcRn | (HsUntypedSpliceNested Name
_) <- XSplicePat (GhcPass p)
ext -> [IdP (GhcPass p)] -> [IdP (GhcPass p)]
[Name] -> [Name]
forall a. a -> a
id
GhcPass p
GhcTc -> DataConCantHappen -> [Id] -> [Id]
forall a. DataConCantHappen -> a
dataConCantHappen XSplicePat (GhcPass p)
DataConCantHappen
ext
hsGroupBinders :: HsGroup GhcRn -> [Name]
hsGroupBinders :: HsGroup (GhcPass 'Renamed) -> [Name]
hsGroupBinders (HsGroup { hs_valds :: forall p. HsGroup p -> HsValBinds p
hs_valds = HsValBinds (GhcPass 'Renamed)
val_decls, hs_tyclds :: forall p. HsGroup p -> [TyClGroup p]
hs_tyclds = [TyClGroup (GhcPass 'Renamed)]
tycl_decls,
hs_fords :: forall p. HsGroup p -> [LForeignDecl p]
hs_fords = [LForeignDecl (GhcPass 'Renamed)]
foreign_decls })
= CollectFlag (GhcPass 'Renamed)
-> HsValBinds (GhcPass 'Renamed) -> [IdP (GhcPass 'Renamed)]
forall (idL :: Pass) idR.
CollectPass (GhcPass idL) =>
CollectFlag (GhcPass idL)
-> HsValBindsLR (GhcPass idL) idR -> [IdP (GhcPass idL)]
collectHsValBinders CollectFlag (GhcPass 'Renamed)
forall p. CollectFlag p
CollNoDictBinders HsValBinds (GhcPass 'Renamed)
val_decls
[Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [TyClGroup (GhcPass 'Renamed)]
-> [LForeignDecl (GhcPass 'Renamed)] -> [Name]
hsTyClForeignBinders [TyClGroup (GhcPass 'Renamed)]
tycl_decls [LForeignDecl (GhcPass 'Renamed)]
foreign_decls
hsTyClForeignBinders :: [TyClGroup GhcRn]
-> [LForeignDecl GhcRn]
-> [Name]
hsTyClForeignBinders :: [TyClGroup (GhcPass 'Renamed)]
-> [LForeignDecl (GhcPass 'Renamed)] -> [Name]
hsTyClForeignBinders [TyClGroup (GhcPass 'Renamed)]
tycl_decls [LForeignDecl (GhcPass 'Renamed)]
foreign_decls
= (GenLocated (Anno (IdGhcP 'Renamed)) Name -> Name)
-> [GenLocated (Anno (IdGhcP 'Renamed)) Name] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated (Anno (IdGhcP 'Renamed)) Name -> Name
forall l e. GenLocated l e -> e
unLoc ([LForeignDecl (GhcPass 'Renamed)] -> [LIdP (GhcPass 'Renamed)]
forall (p :: Pass) a.
(UnXRec (GhcPass p), IsSrcSpanAnn p a) =>
[LForeignDecl (GhcPass p)] -> [LIdP (GhcPass p)]
hsForeignDeclsBinders [LForeignDecl (GhcPass 'Renamed)]
foreign_decls)
[Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([LocatedA Name], [LFieldOcc (GhcPass 'Renamed)]) -> [Name]
getSelectorNames
((TyClGroup (GhcPass 'Renamed)
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))]))
-> [TyClGroup (GhcPass 'Renamed)]
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((LocatedA (TyClDecl (GhcPass 'Renamed))
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))]))
-> [LocatedA (TyClDecl (GhcPass 'Renamed))]
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (TyDeclBinders 'Renamed
-> ([LocatedA (IdP (GhcPass 'Renamed))],
[LFieldOcc (GhcPass 'Renamed)])
TyDeclBinders 'Renamed
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall (p :: Pass).
TyDeclBinders p
-> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
tyDeclBinders (TyDeclBinders 'Renamed
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))]))
-> (LocatedA (TyClDecl (GhcPass 'Renamed))
-> TyDeclBinders 'Renamed)
-> LocatedA (TyClDecl (GhcPass 'Renamed))
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LocatedA (TyClDecl (GhcPass 'Renamed)) -> TyDeclBinders 'Renamed
forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
LocatedA (TyClDecl (GhcPass p)) -> TyDeclBinders p
hsLTyClDeclBinders) ([LocatedA (TyClDecl (GhcPass 'Renamed))]
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))]))
-> (TyClGroup (GhcPass 'Renamed)
-> [LocatedA (TyClDecl (GhcPass 'Renamed))])
-> TyClGroup (GhcPass 'Renamed)
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TyClGroup (GhcPass 'Renamed) -> [LTyClDecl (GhcPass 'Renamed)]
TyClGroup (GhcPass 'Renamed)
-> [LocatedA (TyClDecl (GhcPass 'Renamed))]
forall pass. TyClGroup pass -> [LTyClDecl pass]
group_tyclds) [TyClGroup (GhcPass 'Renamed)]
tycl_decls
([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall a. Monoid a => a -> a -> a
`mappend`
((TyClGroup (GhcPass 'Renamed)
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))]))
-> [TyClGroup (GhcPass 'Renamed)]
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((GenLocated SrcSpanAnnA (InstDecl (GhcPass 'Renamed))
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))]))
-> [GenLocated SrcSpanAnnA (InstDecl (GhcPass 'Renamed))]
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap LInstDecl (GhcPass 'Renamed)
-> ([LocatedA (IdP (GhcPass 'Renamed))],
[LFieldOcc (GhcPass 'Renamed)])
GenLocated SrcSpanAnnA (InstDecl (GhcPass 'Renamed))
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
LInstDecl (GhcPass p)
-> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsLInstDeclBinders ([GenLocated SrcSpanAnnA (InstDecl (GhcPass 'Renamed))]
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))]))
-> (TyClGroup (GhcPass 'Renamed)
-> [GenLocated SrcSpanAnnA (InstDecl (GhcPass 'Renamed))])
-> TyClGroup (GhcPass 'Renamed)
-> ([LocatedA Name],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TyClGroup (GhcPass 'Renamed) -> [LInstDecl (GhcPass 'Renamed)]
TyClGroup (GhcPass 'Renamed)
-> [GenLocated SrcSpanAnnA (InstDecl (GhcPass 'Renamed))]
forall pass. TyClGroup pass -> [LInstDecl pass]
group_instds) [TyClGroup (GhcPass 'Renamed)]
tycl_decls))
where
getSelectorNames :: ([LocatedA Name], [LFieldOcc GhcRn]) -> [Name]
getSelectorNames :: ([LocatedA Name], [LFieldOcc (GhcPass 'Renamed)]) -> [Name]
getSelectorNames ([LocatedA Name]
ns, [LFieldOcc (GhcPass 'Renamed)]
fs) = (LocatedA Name -> Name) -> [LocatedA Name] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map LocatedA Name -> Name
forall l e. GenLocated l e -> e
unLoc [LocatedA Name]
ns [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ (GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)) -> Name)
-> [GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map (FieldOcc (GhcPass 'Renamed) -> XCFieldOcc (GhcPass 'Renamed)
FieldOcc (GhcPass 'Renamed) -> Name
forall pass. FieldOcc pass -> XCFieldOcc pass
foExt (FieldOcc (GhcPass 'Renamed) -> Name)
-> (GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))
-> FieldOcc (GhcPass 'Renamed))
-> GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))
-> Name
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))
-> FieldOcc (GhcPass 'Renamed)
forall l e. GenLocated l e -> e
unLoc) [LFieldOcc (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed))]
fs
data TyDeclBinders p
= TyDeclBinders
{ forall (p :: Pass).
TyDeclBinders p -> (LocatedA (IdP (GhcPass p)), TyConFlavour ())
tyDeclMainBinder :: !(LocatedA (IdP (GhcPass p)), TyConFlavour ())
, forall (p :: Pass).
TyDeclBinders p -> [(LocatedA (IdP (GhcPass p)), TyConFlavour ())]
tyDeclATs :: ![(LocatedA (IdP (GhcPass p)), TyConFlavour ())]
, forall (p :: Pass). TyDeclBinders p -> [LocatedA (IdP (GhcPass p))]
tyDeclOpSigs :: ![LocatedA (IdP (GhcPass p))]
, forall (p :: Pass). TyDeclBinders p -> LConsWithFields p
tyDeclConsWithFields :: !(LConsWithFields p) }
tyDeclBinders :: TyDeclBinders p -> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
tyDeclBinders :: forall (p :: Pass).
TyDeclBinders p
-> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
tyDeclBinders (TyDeclBinders (LocatedA (IdP (GhcPass p)), TyConFlavour ())
main [(LocatedA (IdP (GhcPass p)), TyConFlavour ())]
ats [LocatedA (IdP (GhcPass p))]
sigs LConsWithFields p
consWithFields)
= ((LocatedA (IdGhcP p), TyConFlavour ()) -> LocatedA (IdGhcP p)
forall a b. (a, b) -> a
fst (LocatedA (IdP (GhcPass p)), TyConFlavour ())
(LocatedA (IdGhcP p), TyConFlavour ())
main LocatedA (IdGhcP p)
-> [LocatedA (IdGhcP p)] -> [LocatedA (IdGhcP p)]
forall a. a -> [a] -> [a]
: (((LocatedA (IdGhcP p), TyConFlavour ()) -> LocatedA (IdGhcP p))
-> [(LocatedA (IdGhcP p), TyConFlavour ())]
-> [LocatedA (IdGhcP p)]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (LocatedA (IdGhcP p), TyConFlavour ()) -> LocatedA (IdGhcP p)
forall a b. (a, b) -> a
fst [(LocatedA (IdP (GhcPass p)), TyConFlavour ())]
[(LocatedA (IdGhcP p), TyConFlavour ())]
ats [LocatedA (IdGhcP p)]
-> [LocatedA (IdGhcP p)] -> [LocatedA (IdGhcP p)]
forall a. [a] -> [a] -> [a]
++ [LocatedA (IdP (GhcPass p))]
[LocatedA (IdGhcP p)]
sigs [LocatedA (IdGhcP p)]
-> [LocatedA (IdGhcP p)] -> [LocatedA (IdGhcP p)]
forall a. [a] -> [a] -> [a]
++ [LocatedA (IdP (GhcPass p))]
[LocatedA (IdGhcP p)]
cons), [LFieldOcc (GhcPass p)]
flds)
where
([LocatedA (IdP (GhcPass p))]
cons, [LFieldOcc (GhcPass p)]
flds) = LConsWithFields p
-> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
forall (p :: Pass).
LConsWithFields p
-> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
lconsWithFieldsBinders LConsWithFields p
consWithFields
hsLTyClDeclBinders :: (IsPass p, OutputableBndrId p)
=> LocatedA (TyClDecl (GhcPass p))
-> TyDeclBinders p
hsLTyClDeclBinders :: forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
LocatedA (TyClDecl (GhcPass p)) -> TyDeclBinders p
hsLTyClDeclBinders (L SrcSpanAnnA
loc (FamDecl { tcdFam :: forall pass. TyClDecl pass -> FamilyDecl pass
tcdFam = FamilyDecl
{ fdLName :: forall pass. FamilyDecl pass -> LIdP pass
fdLName = (L Anno (IdGhcP p)
_ IdGhcP p
name)
, fdInfo :: forall pass. FamilyDecl pass -> FamilyInfo pass
fdInfo = FamilyInfo (GhcPass p)
fd_info } }))
= TyDeclBinders
{ tyDeclMainBinder :: (LocatedA (IdP (GhcPass p)), TyConFlavour ())
tyDeclMainBinder = (SrcSpanAnnA -> IdGhcP p -> GenLocated SrcSpanAnnA (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc IdGhcP p
name, Maybe () -> FamilyInfo (GhcPass p) -> TyConFlavour ()
forall tc pass. Maybe tc -> FamilyInfo pass -> TyConFlavour tc
familyInfoTyConFlavour Maybe ()
forall a. Maybe a
Nothing FamilyInfo (GhcPass p)
fd_info)
, tyDeclATs :: [(LocatedA (IdP (GhcPass p)), TyConFlavour ())]
tyDeclATs = [], tyDeclOpSigs :: [LocatedA (IdP (GhcPass p))]
tyDeclOpSigs = []
, tyDeclConsWithFields :: LConsWithFields p
tyDeclConsWithFields = LConsWithFields p
forall (p :: Pass). LConsWithFields p
emptyLConsWithFields }
hsLTyClDeclBinders (L SrcSpanAnnA
loc (SynDecl
{ tcdLName :: forall pass. TyClDecl pass -> LIdP pass
tcdLName = (L Anno (IdGhcP p)
_ IdGhcP p
name) }))
= TyDeclBinders
{ tyDeclMainBinder :: (LocatedA (IdP (GhcPass p)), TyConFlavour ())
tyDeclMainBinder = (SrcSpanAnnA -> IdGhcP p -> GenLocated SrcSpanAnnA (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc IdGhcP p
name, TyConFlavour ()
forall tc. TyConFlavour tc
TypeSynonymFlavour)
, tyDeclATs :: [(LocatedA (IdP (GhcPass p)), TyConFlavour ())]
tyDeclATs = [], tyDeclOpSigs :: [LocatedA (IdP (GhcPass p))]
tyDeclOpSigs = []
, tyDeclConsWithFields :: LConsWithFields p
tyDeclConsWithFields = LConsWithFields p
forall (p :: Pass). LConsWithFields p
emptyLConsWithFields }
hsLTyClDeclBinders (L SrcSpanAnnA
loc (ClassDecl
{ tcdLName :: forall pass. TyClDecl pass -> LIdP pass
tcdLName = (L Anno (IdGhcP p)
_ IdGhcP p
cls_name)
, tcdSigs :: forall pass. TyClDecl pass -> [LSig pass]
tcdSigs = [LSig (GhcPass p)]
sigs
, tcdATs :: forall pass. TyClDecl pass -> [LFamilyDecl pass]
tcdATs = [LFamilyDecl (GhcPass p)]
ats }))
= TyDeclBinders
{ tyDeclMainBinder :: (LocatedA (IdP (GhcPass p)), TyConFlavour ())
tyDeclMainBinder = (SrcSpanAnnA -> IdGhcP p -> GenLocated SrcSpanAnnA (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc IdGhcP p
cls_name, TyConFlavour ()
forall tc. TyConFlavour tc
ClassFlavour)
, tyDeclATs :: [(LocatedA (IdP (GhcPass p)), TyConFlavour ())]
tyDeclATs = [ (SrcSpanAnnA -> IdGhcP p -> GenLocated SrcSpanAnnA (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
fam_loc IdGhcP p
fam_name, Maybe () -> FamilyInfo (GhcPass p) -> TyConFlavour ()
forall tc pass. Maybe tc -> FamilyInfo pass -> TyConFlavour tc
familyInfoTyConFlavour (() -> Maybe ()
forall a. a -> Maybe a
Just ()) FamilyInfo (GhcPass p)
fd_info)
| (L SrcSpanAnnA
fam_loc (FamilyDecl { fdLName :: forall pass. FamilyDecl pass -> LIdP pass
fdLName = L Anno (IdGhcP p)
_ IdGhcP p
fam_name
, fdInfo :: forall pass. FamilyDecl pass -> FamilyInfo pass
fdInfo = FamilyInfo (GhcPass p)
fd_info })) <- [LFamilyDecl (GhcPass p)]
[GenLocated SrcSpanAnnA (FamilyDecl (GhcPass p))]
ats ]
, tyDeclOpSigs :: [LocatedA (IdP (GhcPass p))]
tyDeclOpSigs = [ SrcSpanAnnA -> IdGhcP p -> GenLocated SrcSpanAnnA (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
mem_loc IdGhcP p
mem_name
| (L SrcSpanAnnA
mem_loc (ClassOpSig XClassOpSig (GhcPass p)
_ Bool
False [LIdP (GhcPass p)]
ns LHsSigType (GhcPass p)
_)) <- [LSig (GhcPass p)]
[GenLocated SrcSpanAnnA (Sig (GhcPass p))]
sigs
, (L Anno (IdGhcP p)
_ IdGhcP p
mem_name) <- [LIdP (GhcPass p)]
[GenLocated (Anno (IdGhcP p)) (IdGhcP p)]
ns ]
, tyDeclConsWithFields :: LConsWithFields p
tyDeclConsWithFields = LConsWithFields p
forall (p :: Pass). LConsWithFields p
emptyLConsWithFields }
hsLTyClDeclBinders (L SrcSpanAnnA
loc (DataDecl { tcdLName :: forall pass. TyClDecl pass -> LIdP pass
tcdLName = (L Anno (IdGhcP p)
_ IdGhcP p
name)
, tcdDataDefn :: forall pass. TyClDecl pass -> HsDataDefn pass
tcdDataDefn = HsDataDefn (GhcPass p)
defn }))
= TyDeclBinders
{ tyDeclMainBinder :: (LocatedA (IdP (GhcPass p)), TyConFlavour ())
tyDeclMainBinder = (SrcSpanAnnA -> IdGhcP p -> GenLocated SrcSpanAnnA (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc IdGhcP p
name, TyConFlavour ()
flav )
, tyDeclATs :: [(LocatedA (IdP (GhcPass p)), TyConFlavour ())]
tyDeclATs = []
, tyDeclOpSigs :: [LocatedA (IdP (GhcPass p))]
tyDeclOpSigs = []
, tyDeclConsWithFields :: LConsWithFields p
tyDeclConsWithFields = HsDataDefn (GhcPass p) -> LConsWithFields p
forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
HsDataDefn (GhcPass p) -> LConsWithFields p
hsDataDefnBinders HsDataDefn (GhcPass p)
defn }
where
flav :: TyConFlavour ()
flav = NewOrData -> TyConFlavour ()
forall tc. NewOrData -> TyConFlavour tc
newOrDataToFlavour (NewOrData -> TyConFlavour ()) -> NewOrData -> TyConFlavour ()
forall a b. (a -> b) -> a -> b
$ DataDefnCons (GenLocated SrcSpanAnnA (ConDecl (GhcPass p)))
-> NewOrData
forall a. DataDefnCons a -> NewOrData
dataDefnConsNewOrData (DataDefnCons (GenLocated SrcSpanAnnA (ConDecl (GhcPass p)))
-> NewOrData)
-> DataDefnCons (GenLocated SrcSpanAnnA (ConDecl (GhcPass p)))
-> NewOrData
forall a b. (a -> b) -> a -> b
$ HsDataDefn (GhcPass p) -> DataDefnCons (LConDecl (GhcPass p))
forall pass. HsDataDefn pass -> DataDefnCons (LConDecl pass)
dd_cons HsDataDefn (GhcPass p)
defn
hsForeignDeclsBinders :: forall p a. (UnXRec (GhcPass p), IsSrcSpanAnn p a)
=> [LForeignDecl (GhcPass p)] -> [LIdP (GhcPass p)]
hsForeignDeclsBinders :: forall (p :: Pass) a.
(UnXRec (GhcPass p), IsSrcSpanAnn p a) =>
[LForeignDecl (GhcPass p)] -> [LIdP (GhcPass p)]
hsForeignDeclsBinders [LForeignDecl (GhcPass p)]
foreign_decls
= [ EpAnn a -> IdGhcP p -> GenLocated (EpAnn a) (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L (SrcSpan -> EpAnn a
forall e. HasAnnotation e => SrcSpan -> e
noAnnSrcSpan (SrcSpanAnnA -> SrcSpan
forall a. HasLoc a => a -> SrcSpan
locA SrcSpanAnnA
decl_loc)) IdGhcP p
n
| L SrcSpanAnnA
decl_loc (ForeignImport { fd_name :: forall pass. ForeignDecl pass -> LIdP pass
fd_name = L EpAnn a
_ IdGhcP p
n })
<- [LForeignDecl (GhcPass p)]
[GenLocated SrcSpanAnnA (ForeignDecl (GhcPass p))]
foreign_decls]
hsPatSynSelectors :: IsPass p => HsValBinds (GhcPass p) -> [FieldOcc (GhcPass p)]
hsPatSynSelectors :: forall (p :: Pass).
IsPass p =>
HsValBinds (GhcPass p) -> [FieldOcc (GhcPass p)]
hsPatSynSelectors (ValBinds XValBinds (GhcPass p) (GhcPass p)
_ LHsBindsLR (GhcPass p) (GhcPass p)
_ [LSig (GhcPass p)]
_) = String -> [FieldOcc (GhcPass p)]
forall a. HasCallStack => String -> a
panic String
"hsPatSynSelectors"
hsPatSynSelectors (XValBindsLR (NValBinds [(RecFlag, LHsBindsLR (GhcPass p) (GhcPass p))]
binds [LSig (GhcPass 'Renamed)]
_))
= (GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))
-> [FieldOcc (GhcPass p)] -> [FieldOcc (GhcPass p)])
-> [FieldOcc (GhcPass p)]
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
-> [FieldOcc (GhcPass p)]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr LHsBind (GhcPass p)
-> [FieldOcc (GhcPass p)] -> [FieldOcc (GhcPass p)]
GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))
-> [FieldOcc (GhcPass p)] -> [FieldOcc (GhcPass p)]
forall p. UnXRec p => LHsBind p -> [FieldOcc p] -> [FieldOcc p]
addPatSynSelector [] ([GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
-> [FieldOcc (GhcPass p)])
-> ([[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]]
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])
-> [[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]]
-> [FieldOcc (GhcPass p)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]]
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]]
-> [FieldOcc (GhcPass p)])
-> [[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]]
-> [FieldOcc (GhcPass p)]
forall a b. (a -> b) -> a -> b
$ ((RecFlag,
[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])
-> [(RecFlag,
[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])]
-> [[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]]
forall a b. (a -> b) -> [a] -> [b]
map (RecFlag,
[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])
-> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))]
forall a b. (a, b) -> b
snd [(RecFlag, LHsBindsLR (GhcPass p) (GhcPass p))]
[(RecFlag,
[GenLocated SrcSpanAnnA (HsBindLR (GhcPass p) (GhcPass p))])]
binds
addPatSynSelector :: forall p. UnXRec p => LHsBind p -> [FieldOcc p] -> [FieldOcc p]
addPatSynSelector :: forall p. UnXRec p => LHsBind p -> [FieldOcc p] -> [FieldOcc p]
addPatSynSelector LHsBind p
bind [FieldOcc p]
sels
| PatSynBind XPatSynBind p p
_ (PSB { psb_args :: forall idL idR. PatSynBind idL idR -> HsPatSynDetails idR
psb_args = RecCon [RecordPatSynField p]
as }) <- forall p a. UnXRec p => XRec p a -> a
unXRec @p LHsBind p
bind
= (RecordPatSynField p -> FieldOcc p)
-> [RecordPatSynField p] -> [FieldOcc p]
forall a b. (a -> b) -> [a] -> [b]
map RecordPatSynField p -> FieldOcc p
forall pass. RecordPatSynField pass -> FieldOcc pass
recordPatSynField [RecordPatSynField p]
as [FieldOcc p] -> [FieldOcc p] -> [FieldOcc p]
forall a. [a] -> [a] -> [a]
++ [FieldOcc p]
sels
| Bool
otherwise = [FieldOcc p]
sels
getPatSynBinds :: forall id. UnXRec id
=> [(RecFlag, LHsBinds id)] -> [PatSynBind id id]
getPatSynBinds :: forall id.
UnXRec id =>
[(RecFlag, LHsBinds id)] -> [PatSynBind id id]
getPatSynBinds [(RecFlag, LHsBinds id)]
binds
= [ PatSynBind id id
psb | (RecFlag
_, LHsBinds id
lbinds) <- [(RecFlag, LHsBinds id)]
binds
, (forall p a. UnXRec p => XRec p a -> a
unXRec @id -> (PatSynBind XPatSynBind id id
_ PatSynBind id id
psb)) <- LHsBinds id
lbinds ]
hsLInstDeclBinders :: (IsPass p, OutputableBndrId p)
=> LInstDecl (GhcPass p)
-> ([(LocatedA (IdP (GhcPass p)))], [LFieldOcc (GhcPass p)])
hsLInstDeclBinders :: forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
LInstDecl (GhcPass p)
-> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsLInstDeclBinders (L SrcSpanAnnA
_ (ClsInstD
{ cid_inst :: forall pass. InstDecl pass -> ClsInstDecl pass
cid_inst = ClsInstDecl
{ cid_datafam_insts :: forall pass. ClsInstDecl pass -> [LDataFamInstDecl pass]
cid_datafam_insts = [LDataFamInstDecl (GhcPass p)]
dfis }}))
= (GenLocated SrcSpanAnnA (DataFamInstDecl (GhcPass p))
-> ([LocatedA (IdGhcP p)],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))]))
-> [GenLocated SrcSpanAnnA (DataFamInstDecl (GhcPass p))]
-> ([LocatedA (IdGhcP p)],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))])
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (LConsWithFields p
-> ([GenLocated SrcSpanAnnA (IdP (GhcPass p))],
[XRec (GhcPass p) (FieldOcc (GhcPass p))])
LConsWithFields p
-> ([LocatedA (IdGhcP p)],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))])
forall (p :: Pass).
LConsWithFields p
-> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
lconsWithFieldsBinders (LConsWithFields p
-> ([LocatedA (IdGhcP p)],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))]))
-> (GenLocated SrcSpanAnnA (DataFamInstDecl (GhcPass p))
-> LConsWithFields p)
-> GenLocated SrcSpanAnnA (DataFamInstDecl (GhcPass p))
-> ([LocatedA (IdGhcP p)],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DataFamInstDecl (GhcPass p) -> LConsWithFields p
forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
DataFamInstDecl (GhcPass p) -> LConsWithFields p
hsDataFamInstBinders (DataFamInstDecl (GhcPass p) -> LConsWithFields p)
-> (GenLocated SrcSpanAnnA (DataFamInstDecl (GhcPass p))
-> DataFamInstDecl (GhcPass p))
-> GenLocated SrcSpanAnnA (DataFamInstDecl (GhcPass p))
-> LConsWithFields p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (DataFamInstDecl (GhcPass p))
-> DataFamInstDecl (GhcPass p)
forall l e. GenLocated l e -> e
unLoc) [LDataFamInstDecl (GhcPass p)]
[GenLocated SrcSpanAnnA (DataFamInstDecl (GhcPass p))]
dfis
hsLInstDeclBinders (L SrcSpanAnnA
_ (DataFamInstD { dfid_inst :: forall pass. InstDecl pass -> DataFamInstDecl pass
dfid_inst = DataFamInstDecl (GhcPass p)
fi }))
= LConsWithFields p
-> ([GenLocated SrcSpanAnnA (IdP (GhcPass p))],
[XRec (GhcPass p) (FieldOcc (GhcPass p))])
forall (p :: Pass).
LConsWithFields p
-> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
lconsWithFieldsBinders (LConsWithFields p
-> ([GenLocated SrcSpanAnnA (IdP (GhcPass p))],
[XRec (GhcPass p) (FieldOcc (GhcPass p))]))
-> LConsWithFields p
-> ([GenLocated SrcSpanAnnA (IdP (GhcPass p))],
[XRec (GhcPass p) (FieldOcc (GhcPass p))])
forall a b. (a -> b) -> a -> b
$ DataFamInstDecl (GhcPass p) -> LConsWithFields p
forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
DataFamInstDecl (GhcPass p) -> LConsWithFields p
hsDataFamInstBinders DataFamInstDecl (GhcPass p)
fi
hsLInstDeclBinders (L SrcSpanAnnA
_ (TyFamInstD {})) = ([GenLocated SrcSpanAnnA (IdP (GhcPass p))],
[XRec (GhcPass p) (FieldOcc (GhcPass p))])
([LocatedA (IdGhcP p)],
[GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))])
forall a. Monoid a => a
mempty
hsDataFamInstBinders :: (IsPass p, OutputableBndrId p)
=> DataFamInstDecl (GhcPass p)
-> LConsWithFields p
hsDataFamInstBinders :: forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
DataFamInstDecl (GhcPass p) -> LConsWithFields p
hsDataFamInstBinders (DataFamInstDecl { dfid_eqn :: forall pass. DataFamInstDecl pass -> FamEqn pass (HsDataDefn pass)
dfid_eqn = FamEqn { feqn_rhs :: forall pass rhs. FamEqn pass rhs -> rhs
feqn_rhs = HsDataDefn (GhcPass p)
defn }})
= HsDataDefn (GhcPass p) -> LConsWithFields p
forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
HsDataDefn (GhcPass p) -> LConsWithFields p
hsDataDefnBinders HsDataDefn (GhcPass p)
defn
hsDataDefnBinders :: (IsPass p, OutputableBndrId p)
=> HsDataDefn (GhcPass p)
-> LConsWithFields p
hsDataDefnBinders :: forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
HsDataDefn (GhcPass p) -> LConsWithFields p
hsDataDefnBinders (HsDataDefn { dd_cons :: forall pass. HsDataDefn pass -> DataDefnCons (LConDecl pass)
dd_cons = DataDefnCons (LConDecl (GhcPass p))
cons })
= [LConDecl (GhcPass p)] -> LConsWithFields p
forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
[LConDecl (GhcPass p)] -> LConsWithFields p
hsConDeclsBinders (DataDefnCons (GenLocated SrcSpanAnnA (ConDecl (GhcPass p)))
-> [GenLocated SrcSpanAnnA (ConDecl (GhcPass p))]
forall a. DataDefnCons a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList DataDefnCons (LConDecl (GhcPass p))
DataDefnCons (GenLocated SrcSpanAnnA (ConDecl (GhcPass p)))
cons)
data LConsWithFields p =
LConsWithFields
{ forall (p :: Pass).
LConsWithFields p
-> [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
consWithFieldIndices :: [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
, forall (p :: Pass).
LConsWithFields p -> IntMap (LFieldOcc (GhcPass p))
consFields :: IntMap (LFieldOcc (GhcPass p))
}
lconsWithFieldsBinders :: LConsWithFields p
-> ([(LocatedA (IdP (GhcPass p)))], [LFieldOcc (GhcPass p)])
lconsWithFieldsBinders :: forall (p :: Pass).
LConsWithFields p
-> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
lconsWithFieldsBinders (LConsWithFields [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
cons IntMap (LFieldOcc (GhcPass p))
fields)
= (((LocatedA (IdGhcP p), Maybe [Located Int]) -> LocatedA (IdGhcP p))
-> [(LocatedA (IdGhcP p), Maybe [Located Int])]
-> [LocatedA (IdGhcP p)]
forall a b. (a -> b) -> [a] -> [b]
map (LocatedA (IdGhcP p), Maybe [Located Int]) -> LocatedA (IdGhcP p)
forall a b. (a, b) -> a
fst [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
[(LocatedA (IdGhcP p), Maybe [Located Int])]
cons, IntMap (GenLocated SrcSpanAnnA (FieldOcc (GhcPass p)))
-> [GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))]
forall a. IntMap a -> [a]
IntMap.elems IntMap (LFieldOcc (GhcPass p))
IntMap (GenLocated SrcSpanAnnA (FieldOcc (GhcPass p)))
fields)
emptyLConsWithFields :: LConsWithFields p
emptyLConsWithFields :: forall (p :: Pass). LConsWithFields p
emptyLConsWithFields = [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
-> IntMap (LFieldOcc (GhcPass p)) -> LConsWithFields p
forall (p :: Pass).
[(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
-> IntMap (LFieldOcc (GhcPass p)) -> LConsWithFields p
LConsWithFields [] IntMap (LFieldOcc (GhcPass p))
IntMap (GenLocated SrcSpanAnnA (FieldOcc (GhcPass p)))
forall a. IntMap a
IntMap.empty
hsConDeclsBinders :: forall p. (IsPass p, OutputableBndrId p)
=> [LConDecl (GhcPass p)]
-> LConsWithFields p
hsConDeclsBinders :: forall (p :: Pass).
(IsPass p, OutputableBndrId p) =>
[LConDecl (GhcPass p)] -> LConsWithFields p
hsConDeclsBinders [LConDecl (GhcPass p)]
cons = FieldIndices p -> [LConDecl (GhcPass p)] -> LConsWithFields p
go FieldIndices p
forall (p :: Pass). FieldIndices p
emptyFieldIndices [LConDecl (GhcPass p)]
cons
where
go :: FieldIndices p -> [LConDecl (GhcPass p)] -> LConsWithFields p
go :: FieldIndices p -> [LConDecl (GhcPass p)] -> LConsWithFields p
go FieldIndices p
seen [] = [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
-> IntMap (LFieldOcc (GhcPass p)) -> LConsWithFields p
forall (p :: Pass).
[(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
-> IntMap (LFieldOcc (GhcPass p)) -> LConsWithFields p
LConsWithFields [] (FieldIndices p -> IntMap (LFieldOcc (GhcPass p))
forall (p :: Pass).
FieldIndices p -> IntMap (LFieldOcc (GhcPass p))
fields FieldIndices p
seen)
go FieldIndices p
seen (LConDecl (GhcPass p)
r:[LConDecl (GhcPass p)]
rs)
= let loc :: SrcSpanAnnA
loc = GenLocated SrcSpanAnnA (ConDecl (GhcPass p)) -> SrcSpanAnnA
forall l e. GenLocated l e -> l
getLoc LConDecl (GhcPass p)
GenLocated SrcSpanAnnA (ConDecl (GhcPass p))
r
in case GenLocated SrcSpanAnnA (ConDecl (GhcPass p)) -> ConDecl (GhcPass p)
forall l e. GenLocated l e -> e
unLoc LConDecl (GhcPass p)
GenLocated SrcSpanAnnA (ConDecl (GhcPass p))
r of
ConDeclGADT { con_names :: forall pass. ConDecl pass -> NonEmpty (LIdP pass)
con_names = NonEmpty (LIdP (GhcPass p))
names, con_g_args :: forall pass. ConDecl pass -> HsConDeclGADTDetails pass
con_g_args = HsConDeclGADTDetails (GhcPass p)
args }
-> [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
-> IntMap (LFieldOcc (GhcPass p)) -> LConsWithFields p
forall (p :: Pass).
[(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
-> IntMap (LFieldOcc (GhcPass p)) -> LConsWithFields p
LConsWithFields ([(LocatedA (IdGhcP p), Maybe [Located Int])]
cons [(LocatedA (IdGhcP p), Maybe [Located Int])]
-> [(LocatedA (IdGhcP p), Maybe [Located Int])]
-> [(LocatedA (IdGhcP p), Maybe [Located Int])]
forall a. [a] -> [a] -> [a]
++ [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
[(LocatedA (IdGhcP p), Maybe [Located Int])]
ns) IntMap (LFieldOcc (GhcPass p))
fs
where
cons :: [(LocatedA (IdGhcP p), Maybe [Located Int])]
cons = (LocatedA (IdGhcP p) -> (LocatedA (IdGhcP p), Maybe [Located Int]))
-> [LocatedA (IdGhcP p)]
-> [(LocatedA (IdGhcP p), Maybe [Located Int])]
forall a b. (a -> b) -> [a] -> [b]
map ( , Maybe [Located Int]
con_flds ) ([LocatedA (IdGhcP p)]
-> [(LocatedA (IdGhcP p), Maybe [Located Int])])
-> [LocatedA (IdGhcP p)]
-> [(LocatedA (IdGhcP p), Maybe [Located Int])]
forall a b. (a -> b) -> a -> b
$ NonEmpty (LocatedA (IdGhcP p)) -> [LocatedA (IdGhcP p)]
forall a. NonEmpty a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (SrcSpanAnnA -> IdGhcP p -> LocatedA (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc (IdGhcP p -> LocatedA (IdGhcP p))
-> (GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p)
-> GenLocated (Anno (IdGhcP p)) (IdGhcP p)
-> LocatedA (IdGhcP p)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc (GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> LocatedA (IdGhcP p))
-> NonEmpty (GenLocated (Anno (IdGhcP p)) (IdGhcP p))
-> NonEmpty (LocatedA (IdGhcP p))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (LIdP (GhcPass p))
NonEmpty (GenLocated (Anno (IdGhcP p)) (IdGhcP p))
names)
(Maybe [Located Int]
con_flds, FieldIndices p
seen') = FieldIndices p
-> HsConDeclGADTDetails (GhcPass p)
-> (Maybe [Located Int], FieldIndices p)
get_flds_gadt FieldIndices p
seen HsConDeclGADTDetails (GhcPass p)
args
LConsWithFields [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
ns IntMap (LFieldOcc (GhcPass p))
fs = FieldIndices p -> [LConDecl (GhcPass p)] -> LConsWithFields p
go FieldIndices p
seen' [LConDecl (GhcPass p)]
rs
ConDeclH98 { con_name :: forall pass. ConDecl pass -> LIdP pass
con_name = LIdP (GhcPass p)
name, con_args :: forall pass. ConDecl pass -> HsConDeclH98Details pass
con_args = HsConDeclH98Details (GhcPass p)
args }
-> [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
-> IntMap (LFieldOcc (GhcPass p)) -> LConsWithFields p
forall (p :: Pass).
[(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
-> IntMap (LFieldOcc (GhcPass p)) -> LConsWithFields p
LConsWithFields ([(SrcSpanAnnA -> IdGhcP p -> LocatedA (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
loc (GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc LIdP (GhcPass p)
GenLocated (Anno (IdGhcP p)) (IdGhcP p)
name), Maybe [Located Int]
con_flds)] [(LocatedA (IdGhcP p), Maybe [Located Int])]
-> [(LocatedA (IdGhcP p), Maybe [Located Int])]
-> [(LocatedA (IdGhcP p), Maybe [Located Int])]
forall a. [a] -> [a] -> [a]
++ [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
[(LocatedA (IdGhcP p), Maybe [Located Int])]
ns) IntMap (LFieldOcc (GhcPass p))
fs
where
(Maybe [Located Int]
con_flds, FieldIndices p
seen') = FieldIndices p
-> HsConDeclH98Details (GhcPass p)
-> (Maybe [Located Int], FieldIndices p)
get_flds_h98 FieldIndices p
seen HsConDeclH98Details (GhcPass p)
args
LConsWithFields [(LocatedA (IdP (GhcPass p)), Maybe [Located Int])]
ns IntMap (LFieldOcc (GhcPass p))
fs = FieldIndices p -> [LConDecl (GhcPass p)] -> LConsWithFields p
go FieldIndices p
seen' [LConDecl (GhcPass p)]
rs
get_flds_h98 :: FieldIndices p -> HsConDeclH98Details (GhcPass p)
-> (Maybe [Located Int], FieldIndices p)
get_flds_h98 :: FieldIndices p
-> HsConDeclH98Details (GhcPass p)
-> (Maybe [Located Int], FieldIndices p)
get_flds_h98 FieldIndices p
seen (RecCon XRec (GhcPass p) [LConDeclField (GhcPass p)]
flds) = ([Located Int] -> Maybe [Located Int])
-> ([Located Int], FieldIndices p)
-> (Maybe [Located Int], FieldIndices p)
forall b c d. (b -> c) -> (b, d) -> (c, d)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first [Located Int] -> Maybe [Located Int]
forall a. a -> Maybe a
Just (([Located Int], FieldIndices p)
-> (Maybe [Located Int], FieldIndices p))
-> ([Located Int], FieldIndices p)
-> (Maybe [Located Int], FieldIndices p)
forall a b. (a -> b) -> a -> b
$ FieldIndices p
-> LocatedL [LConDeclField (GhcPass p)]
-> ([Located Int], FieldIndices p)
get_flds FieldIndices p
seen XRec (GhcPass p) [LConDeclField (GhcPass p)]
LocatedL [LConDeclField (GhcPass p)]
flds
get_flds_h98 FieldIndices p
seen (PrefixCon [Void]
_ []) = ([Located Int] -> Maybe [Located Int]
forall a. a -> Maybe a
Just [], FieldIndices p
seen)
get_flds_h98 FieldIndices p
seen HsConDeclH98Details (GhcPass p)
_ = (Maybe [Located Int]
forall a. Maybe a
Nothing, FieldIndices p
seen)
get_flds_gadt :: FieldIndices p -> HsConDeclGADTDetails (GhcPass p)
-> (Maybe [Located Int], FieldIndices p)
get_flds_gadt :: FieldIndices p
-> HsConDeclGADTDetails (GhcPass p)
-> (Maybe [Located Int], FieldIndices p)
get_flds_gadt FieldIndices p
seen (RecConGADT XRecConGADT (GhcPass p)
_ XRec (GhcPass p) [LConDeclField (GhcPass p)]
flds) = ([Located Int] -> Maybe [Located Int])
-> ([Located Int], FieldIndices p)
-> (Maybe [Located Int], FieldIndices p)
forall b c d. (b -> c) -> (b, d) -> (c, d)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first [Located Int] -> Maybe [Located Int]
forall a. a -> Maybe a
Just (([Located Int], FieldIndices p)
-> (Maybe [Located Int], FieldIndices p))
-> ([Located Int], FieldIndices p)
-> (Maybe [Located Int], FieldIndices p)
forall a b. (a -> b) -> a -> b
$ FieldIndices p
-> LocatedL [LConDeclField (GhcPass p)]
-> ([Located Int], FieldIndices p)
get_flds FieldIndices p
seen XRec (GhcPass p) [LConDeclField (GhcPass p)]
LocatedL [LConDeclField (GhcPass p)]
flds
get_flds_gadt FieldIndices p
seen (PrefixConGADT XPrefixConGADT (GhcPass p)
_ []) = ([Located Int] -> Maybe [Located Int]
forall a. a -> Maybe a
Just [], FieldIndices p
seen)
get_flds_gadt FieldIndices p
seen HsConDeclGADTDetails (GhcPass p)
_ = (Maybe [Located Int]
forall a. Maybe a
Nothing, FieldIndices p
seen)
get_flds :: FieldIndices p -> LocatedL [LConDeclField (GhcPass p)]
-> ([Located Int], FieldIndices p)
get_flds :: FieldIndices p
-> LocatedL [LConDeclField (GhcPass p)]
-> ([Located Int], FieldIndices p)
get_flds FieldIndices p
seen LocatedL [LConDeclField (GhcPass p)]
flds =
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
-> ([Located Int], FieldIndices p)
-> ([Located Int], FieldIndices p))
-> ([Located Int], FieldIndices p)
-> [GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))]
-> ([Located Int], FieldIndices p)
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
-> ([Located Int], FieldIndices p)
-> ([Located Int], FieldIndices p)
forall {p :: Pass}.
GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
-> ([Located Int], FieldIndices p)
-> ([Located Int], FieldIndices p)
add_fld ([], FieldIndices p
seen) [GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))]
fld_names
where
add_fld :: GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
-> ([Located Int], FieldIndices p)
-> ([Located Int], FieldIndices p)
add_fld GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
fld ([Located Int]
is, FieldIndices p
ixs) =
let (Located Int
i, FieldIndices p
ixs') = LFieldOcc (GhcPass p)
-> FieldIndices p -> (Located Int, FieldIndices p)
forall (p :: Pass).
LFieldOcc (GhcPass p)
-> FieldIndices p -> (Located Int, FieldIndices p)
insertField LFieldOcc (GhcPass p)
GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
fld FieldIndices p
ixs
in (Located Int
iLocated Int -> [Located Int] -> [Located Int]
forall a. a -> [a] -> [a]
:[Located Int]
is, FieldIndices p
ixs')
fld_names :: [GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))]
fld_names = (GenLocated SrcSpanAnnA (ConDeclField (GhcPass p))
-> [GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))])
-> [GenLocated SrcSpanAnnA (ConDeclField (GhcPass p))]
-> [GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (ConDeclField (GhcPass p) -> [LFieldOcc (GhcPass p)]
ConDeclField (GhcPass p)
-> [GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))]
forall pass. ConDeclField pass -> [LFieldOcc pass]
cd_fld_names (ConDeclField (GhcPass p)
-> [GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))])
-> (GenLocated SrcSpanAnnA (ConDeclField (GhcPass p))
-> ConDeclField (GhcPass p))
-> GenLocated SrcSpanAnnA (ConDeclField (GhcPass p))
-> [GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (ConDeclField (GhcPass p))
-> ConDeclField (GhcPass p)
forall l e. GenLocated l e -> e
unLoc) (GenLocated
SrcSpanAnnL [GenLocated SrcSpanAnnA (ConDeclField (GhcPass p))]
-> [GenLocated SrcSpanAnnA (ConDeclField (GhcPass p))]
forall l e. GenLocated l e -> e
unLoc LocatedL [LConDeclField (GhcPass p)]
GenLocated
SrcSpanAnnL [GenLocated SrcSpanAnnA (ConDeclField (GhcPass p))]
flds)
data FieldIndices p =
FieldIndices
{ forall (p :: Pass).
FieldIndices p -> IntMap (LFieldOcc (GhcPass p))
fields :: IntMap (LFieldOcc (GhcPass p))
, forall (p :: Pass). FieldIndices p -> Map RdrName Int
fieldIndices :: Map RdrName Int
, forall (p :: Pass). FieldIndices p -> Int
newInt :: !Int
}
emptyFieldIndices :: FieldIndices p
emptyFieldIndices :: forall (p :: Pass). FieldIndices p
emptyFieldIndices =
FieldIndices { fields :: IntMap (LFieldOcc (GhcPass p))
fields = IntMap (LFieldOcc (GhcPass p))
IntMap (GenLocated SrcSpanAnnA (FieldOcc (GhcPass p)))
forall a. IntMap a
IntMap.empty
, fieldIndices :: Map RdrName Int
fieldIndices = Map RdrName Int
forall k a. Map k a
Map.empty
, newInt :: Int
newInt = Int
0 }
insertField :: LFieldOcc (GhcPass p) -> FieldIndices p -> (Located Int, FieldIndices p)
insertField :: forall (p :: Pass).
LFieldOcc (GhcPass p)
-> FieldIndices p -> (Located Int, FieldIndices p)
insertField LFieldOcc (GhcPass p)
new_fld fi :: FieldIndices p
fi@(FieldIndices IntMap (LFieldOcc (GhcPass p))
flds Map RdrName Int
idxs Int
new_idx)
| Just Int
i <- RdrName -> Map RdrName Int -> Maybe Int
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup RdrName
rdr Map RdrName Int
idxs
= (SrcSpan -> Int -> Located Int
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc Int
i, FieldIndices p
fi)
| Bool
otherwise
= (SrcSpan -> Int -> Located Int
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc Int
new_idx,
IntMap (LFieldOcc (GhcPass p))
-> Map RdrName Int -> Int -> FieldIndices p
forall (p :: Pass).
IntMap (LFieldOcc (GhcPass p))
-> Map RdrName Int -> Int -> FieldIndices p
FieldIndices (Int
-> GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
-> IntMap (GenLocated SrcSpanAnnA (FieldOcc (GhcPass p)))
-> IntMap (GenLocated SrcSpanAnnA (FieldOcc (GhcPass p)))
forall a. Int -> a -> IntMap a -> IntMap a
IntMap.insert Int
new_idx LFieldOcc (GhcPass p)
GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
new_fld IntMap (LFieldOcc (GhcPass p))
IntMap (GenLocated SrcSpanAnnA (FieldOcc (GhcPass p)))
flds)
(RdrName -> Int -> Map RdrName Int -> Map RdrName Int
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert RdrName
rdr Int
new_idx Map RdrName Int
idxs)
(Int
new_idx Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1))
where
loc :: SrcSpan
loc = GenLocated SrcSpanAnnA (FieldOcc (GhcPass p)) -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA LFieldOcc (GhcPass p)
GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
new_fld
rdr :: RdrName
rdr = LocatedN RdrName -> RdrName
forall l e. GenLocated l e -> e
unLoc (LocatedN RdrName -> RdrName)
-> (LFieldOcc (GhcPass p) -> LocatedN RdrName)
-> LFieldOcc (GhcPass p)
-> RdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FieldOcc (GhcPass p) -> XRec (GhcPass p) RdrName
FieldOcc (GhcPass p) -> LocatedN RdrName
forall pass. FieldOcc pass -> XRec pass RdrName
foLabel (FieldOcc (GhcPass p) -> LocatedN RdrName)
-> (GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
-> FieldOcc (GhcPass p))
-> GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
-> LocatedN RdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (FieldOcc (GhcPass p))
-> FieldOcc (GhcPass p)
forall l e. GenLocated l e -> e
unLoc (LFieldOcc (GhcPass p) -> RdrName)
-> LFieldOcc (GhcPass p) -> RdrName
forall a b. (a -> b) -> a -> b
$ LFieldOcc (GhcPass p)
new_fld
data ImplicitFieldBinders
= ImplicitFieldBinders { ImplicitFieldBinders -> Name
implFlBndr_field :: Name
, ImplicitFieldBinders -> [Name]
implFlBndr_binders :: [Name]
}
lStmtsImplicits :: forall idR body . IsPass idR => [LStmtLR GhcRn (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
lStmtsImplicits :: forall (idR :: Pass) (body :: * -> *).
IsPass idR =>
[LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
lStmtsImplicits = [LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (idR :: Pass) (body :: * -> *).
IsPass idR =>
[LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lstmts
where
hs_lstmts :: forall idR body . IsPass idR => [LStmtLR GhcRn (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lstmts :: forall (idR :: Pass) (body :: * -> *).
IsPass idR =>
[LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lstmts = (GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR))))
-> [(SrcSpan, [ImplicitFieldBinders])])
-> [GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR))))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (idR :: Pass) (body :: * -> *).
IsPass idR =>
StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_stmt (StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
-> [(SrcSpan, [ImplicitFieldBinders])])
-> (GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR))))
-> StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR))))
-> GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR))))
-> [(SrcSpan, [ImplicitFieldBinders])]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR))))
-> StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
forall l e. GenLocated l e -> e
unLoc)
hs_stmt :: forall idR body . IsPass idR => StmtLR GhcRn (GhcPass idR) (LocatedA (body (GhcPass idR)))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_stmt :: forall (idR :: Pass) (body :: * -> *).
IsPass idR =>
StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_stmt (BindStmt XBindStmt
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
_ LPat (GhcPass 'Renamed)
pat LocatedA (body (GhcPass idR))
_) = LPat (GhcPass 'Renamed) -> [(SrcSpan, [ImplicitFieldBinders])]
lPatImplicits LPat (GhcPass 'Renamed)
pat
hs_stmt (XStmtLR XXStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
x) = case GhcPass idR
forall (p :: Pass). IsPass p => GhcPass p
ghcPass :: GhcPass idR of
GhcPass idR
GhcRn -> ApplicativeStmt (GhcPass 'Renamed) (GhcPass 'Renamed)
-> [(SrcSpan, [ImplicitFieldBinders])]
forall {idR}.
ApplicativeStmt (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_applicative_stmt XXStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
ApplicativeStmt (GhcPass 'Renamed) (GhcPass 'Renamed)
x
GhcPass idR
GhcTc -> ApplicativeStmt (GhcPass 'Renamed) GhcTc
-> [(SrcSpan, [ImplicitFieldBinders])]
forall {idR}.
ApplicativeStmt (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_applicative_stmt XXStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
ApplicativeStmt (GhcPass 'Renamed) GhcTc
x
hs_stmt (LetStmt XLetStmt
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
_ HsLocalBindsLR (GhcPass 'Renamed) (GhcPass idR)
binds) = HsLocalBindsLR (GhcPass 'Renamed) (GhcPass idR)
-> [(SrcSpan, [ImplicitFieldBinders])]
forall {idR :: Pass}.
HsLocalBindsLR (GhcPass 'Renamed) (GhcPass idR)
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_local_binds HsLocalBindsLR (GhcPass 'Renamed) (GhcPass idR)
binds
hs_stmt (BodyStmt {}) = []
hs_stmt (LastStmt {}) = []
hs_stmt (ParStmt XParStmt
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))
_ [ParStmtBlock (GhcPass 'Renamed) (GhcPass idR)]
xs HsExpr (GhcPass idR)
_ SyntaxExpr (GhcPass idR)
_) = [LStmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (idR :: Pass) (body :: * -> *).
IsPass idR =>
[LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lstmts [LStmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)))
GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))))
s | ParStmtBlock XParStmtBlock (GhcPass 'Renamed) (GhcPass idR)
_ [ExprLStmt (GhcPass 'Renamed)]
ss [IdP (GhcPass idR)]
_ SyntaxExpr (GhcPass idR)
_ <- [ParStmtBlock (GhcPass 'Renamed) (GhcPass idR)]
xs , GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))))
s <- [ExprLStmt (GhcPass 'Renamed)]
[GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))))]
ss]
hs_stmt (TransStmt { trS_stmts :: forall idL idR body. StmtLR idL idR body -> [ExprLStmt idL]
trS_stmts = [ExprLStmt (GhcPass 'Renamed)]
stmts }) = [LStmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (idR :: Pass) (body :: * -> *).
IsPass idR =>
[LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lstmts [ExprLStmt (GhcPass 'Renamed)]
[LStmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)))]
stmts
hs_stmt (RecStmt { recS_stmts :: forall idL idR body.
StmtLR idL idR body -> XRec idR [LStmtLR idL idR body]
recS_stmts = L SrcSpanAnnL
_ [GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR))))]
ss }) = [LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (idR :: Pass) (body :: * -> *).
IsPass idR =>
[LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lstmts [LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
[GenLocated
SrcSpanAnnA
(StmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR))))]
ss
hs_local_binds :: HsLocalBindsLR (GhcPass 'Renamed) (GhcPass idR)
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_local_binds (HsValBinds XHsValBinds (GhcPass 'Renamed) (GhcPass idR)
_ HsValBindsLR (GhcPass 'Renamed) (GhcPass idR)
val_binds) = HsValBindsLR (GhcPass 'Renamed) (GhcPass idR)
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (idR :: Pass).
HsValBindsLR (GhcPass 'Renamed) (GhcPass idR)
-> [(SrcSpan, [ImplicitFieldBinders])]
hsValBindsImplicits HsValBindsLR (GhcPass 'Renamed) (GhcPass idR)
val_binds
hs_local_binds (HsIPBinds {}) = []
hs_local_binds (EmptyLocalBinds XEmptyLocalBinds (GhcPass 'Renamed) (GhcPass idR)
_) = []
hs_applicative_stmt :: ApplicativeStmt (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_applicative_stmt (ApplicativeStmt XApplicativeStmt (GhcPass 'Renamed) idR
_ [(SyntaxExpr idR, ApplicativeArg (GhcPass 'Renamed))]
args Maybe (SyntaxExpr idR)
_) = ((SyntaxExpr idR, ApplicativeArg (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])])
-> [(SyntaxExpr idR, ApplicativeArg (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (SyntaxExpr idR, ApplicativeArg (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
forall {a}.
(a, ApplicativeArg (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
do_arg [(SyntaxExpr idR, ApplicativeArg (GhcPass 'Renamed))]
args
where do_arg :: (a, ApplicativeArg (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
do_arg (a
_, ApplicativeArgOne { app_arg_pattern :: forall idL. ApplicativeArg idL -> LPat idL
app_arg_pattern = LPat (GhcPass 'Renamed)
pat }) = LPat (GhcPass 'Renamed) -> [(SrcSpan, [ImplicitFieldBinders])]
lPatImplicits LPat (GhcPass 'Renamed)
pat
do_arg (a
_, ApplicativeArgMany { app_stmts :: forall idL. ApplicativeArg idL -> [ExprLStmt idL]
app_stmts = [ExprLStmt (GhcPass 'Renamed)]
stmts }) = [LStmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (idR :: Pass) (body :: * -> *).
IsPass idR =>
[LStmtLR
(GhcPass 'Renamed) (GhcPass idR) (LocatedA (body (GhcPass idR)))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lstmts [ExprLStmt (GhcPass 'Renamed)]
[LStmtLR
(GhcPass 'Renamed)
(GhcPass 'Renamed)
(GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)))]
stmts
hsValBindsImplicits :: HsValBindsLR GhcRn (GhcPass idR)
-> [(SrcSpan, [ImplicitFieldBinders])]
hsValBindsImplicits :: forall (idR :: Pass).
HsValBindsLR (GhcPass 'Renamed) (GhcPass idR)
-> [(SrcSpan, [ImplicitFieldBinders])]
hsValBindsImplicits (XValBindsLR (NValBinds [(RecFlag, LHsBinds (GhcPass 'Renamed))]
binds [LSig (GhcPass 'Renamed)]
_))
= ((RecFlag,
[GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))])
-> [(SrcSpan, [ImplicitFieldBinders])])
-> [(RecFlag,
[GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))])]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (LHsBinds (GhcPass 'Renamed) -> [(SrcSpan, [ImplicitFieldBinders])]
[GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall idR.
LHsBindsLR (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])]
lhsBindsImplicits ([GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])])
-> ((RecFlag,
[GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))])
-> [GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))])
-> (RecFlag,
[GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))])
-> [(SrcSpan, [ImplicitFieldBinders])]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RecFlag,
[GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))])
-> [GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))]
forall a b. (a, b) -> b
snd) [(RecFlag, LHsBinds (GhcPass 'Renamed))]
[(RecFlag,
[GenLocated
(Anno (HsBind (GhcPass 'Renamed))) (HsBind (GhcPass 'Renamed))])]
binds
hsValBindsImplicits (ValBinds XValBinds (GhcPass 'Renamed) (GhcPass idR)
_ LHsBindsLR (GhcPass 'Renamed) (GhcPass idR)
binds [LSig (GhcPass idR)]
_)
= LHsBindsLR (GhcPass 'Renamed) (GhcPass idR)
-> [(SrcSpan, [ImplicitFieldBinders])]
forall idR.
LHsBindsLR (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])]
lhsBindsImplicits LHsBindsLR (GhcPass 'Renamed) (GhcPass idR)
binds
lhsBindsImplicits :: LHsBindsLR GhcRn idR -> [(SrcSpan, [ImplicitFieldBinders])]
lhsBindsImplicits :: forall idR.
LHsBindsLR (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])]
lhsBindsImplicits = (GenLocated
(Anno (HsBindLR (GhcPass 'Renamed) idR))
(HsBindLR (GhcPass 'Renamed) idR)
-> [(SrcSpan, [ImplicitFieldBinders])])
-> [GenLocated
(Anno (HsBindLR (GhcPass 'Renamed) idR))
(HsBindLR (GhcPass 'Renamed) idR)]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (HsBindLR (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])]
forall {idR}.
HsBindLR (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])]
lhs_bind (HsBindLR (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])])
-> (GenLocated
(Anno (HsBindLR (GhcPass 'Renamed) idR))
(HsBindLR (GhcPass 'Renamed) idR)
-> HsBindLR (GhcPass 'Renamed) idR)
-> GenLocated
(Anno (HsBindLR (GhcPass 'Renamed) idR))
(HsBindLR (GhcPass 'Renamed) idR)
-> [(SrcSpan, [ImplicitFieldBinders])]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated
(Anno (HsBindLR (GhcPass 'Renamed) idR))
(HsBindLR (GhcPass 'Renamed) idR)
-> HsBindLR (GhcPass 'Renamed) idR
forall l e. GenLocated l e -> e
unLoc)
where
lhs_bind :: HsBindLR (GhcPass 'Renamed) idR
-> [(SrcSpan, [ImplicitFieldBinders])]
lhs_bind (PatBind { pat_lhs :: forall idL idR. HsBindLR idL idR -> LPat idL
pat_lhs = LPat (GhcPass 'Renamed)
lpat }) = LPat (GhcPass 'Renamed) -> [(SrcSpan, [ImplicitFieldBinders])]
lPatImplicits LPat (GhcPass 'Renamed)
lpat
lhs_bind HsBindLR (GhcPass 'Renamed) idR
_ = []
lPatImplicits :: LPat GhcRn -> [(SrcSpan, [ImplicitFieldBinders])]
lPatImplicits :: LPat (GhcPass 'Renamed) -> [(SrcSpan, [ImplicitFieldBinders])]
lPatImplicits = LPat (GhcPass 'Renamed) -> [(SrcSpan, [ImplicitFieldBinders])]
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat
where
hs_lpat :: GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
lpat = Pat (GhcPass 'Renamed) -> [(SrcSpan, [ImplicitFieldBinders])]
hs_pat (GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> Pat (GhcPass 'Renamed)
forall l e. GenLocated l e -> e
unLoc GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
lpat)
hs_lpats :: [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpats = (GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
-> [(SrcSpan, [ImplicitFieldBinders])])
-> [(SrcSpan, [ImplicitFieldBinders])]
-> [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (\GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
pat [(SrcSpan, [ImplicitFieldBinders])]
rest -> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
pat [(SrcSpan, [ImplicitFieldBinders])]
-> [(SrcSpan, [ImplicitFieldBinders])]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall a. [a] -> [a] -> [a]
++ [(SrcSpan, [ImplicitFieldBinders])]
rest) []
hs_pat :: Pat (GhcPass 'Renamed) -> [(SrcSpan, [ImplicitFieldBinders])]
hs_pat (LazyPat XLazyPat (GhcPass 'Renamed)
_ LPat (GhcPass 'Renamed)
pat) = GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat LPat (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
pat
hs_pat (BangPat XBangPat (GhcPass 'Renamed)
_ LPat (GhcPass 'Renamed)
pat) = GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat LPat (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
pat
hs_pat (AsPat XAsPat (GhcPass 'Renamed)
_ LIdP (GhcPass 'Renamed)
_ LPat (GhcPass 'Renamed)
pat) = GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat LPat (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
pat
hs_pat (ViewPat XViewPat (GhcPass 'Renamed)
_ LHsExpr (GhcPass 'Renamed)
_ LPat (GhcPass 'Renamed)
pat) = GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat LPat (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
pat
hs_pat (ParPat XParPat (GhcPass 'Renamed)
_ LPat (GhcPass 'Renamed)
pat) = GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat LPat (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
pat
hs_pat (ListPat XListPat (GhcPass 'Renamed)
_ [LPat (GhcPass 'Renamed)]
pats) = [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpats [LPat (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
pats
hs_pat (TuplePat XTuplePat (GhcPass 'Renamed)
_ [LPat (GhcPass 'Renamed)]
pats Boxity
_) = [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpats [LPat (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
pats
hs_pat (SigPat XSigPat (GhcPass 'Renamed)
_ LPat (GhcPass 'Renamed)
pat HsPatSigType (NoGhcTc (GhcPass 'Renamed))
_) = GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat LPat (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
pat
hs_pat (ConPat {pat_args :: forall p. Pat p -> HsConPatDetails p
pat_args=HsConPatDetails (GhcPass 'Renamed)
ps}) = HsConPatDetails (GhcPass 'Renamed)
-> [(SrcSpan, [ImplicitFieldBinders])]
details HsConPatDetails (GhcPass 'Renamed)
ps
hs_pat Pat (GhcPass 'Renamed)
_ = []
details :: HsConPatDetails GhcRn -> [(SrcSpan, [ImplicitFieldBinders])]
details :: HsConPatDetails (GhcPass 'Renamed)
-> [(SrcSpan, [ImplicitFieldBinders])]
details (PrefixCon [HsConPatTyArg (NoGhcTc (GhcPass 'Renamed))]
_ [LPat (GhcPass 'Renamed)]
ps) = [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpats [LPat (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
ps
details (RecCon (HsRecFields { rec_dotdot :: forall p arg. HsRecFields p arg -> Maybe (XRec p RecFieldsDotDot)
rec_dotdot = Maybe (XRec (GhcPass 'Renamed) RecFieldsDotDot)
Nothing, [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
rec_flds :: [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
rec_flds :: forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds }))
= [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpats ([GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])])
-> [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall a b. (a -> b) -> a -> b
$ (GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
-> [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
forall a b. (a -> b) -> [a] -> [b]
map (HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall lhs rhs. HsFieldBind lhs rhs -> rhs
hfbRHS (HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> (GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
forall l e. GenLocated l e -> e
unLoc) [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
[GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
rec_flds
details (RecCon (HsRecFields { rec_dotdot :: forall p arg. HsRecFields p arg -> Maybe (XRec p RecFieldsDotDot)
rec_dotdot = Just (L EpaLocation
err_loc RecFieldsDotDot
rec_dotdot), [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
rec_flds :: forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds :: [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
rec_flds }))
= [(EpaLocation -> SrcSpan
forall a b. (HasLoc a, HasAnnotation b) => a -> b
l2l EpaLocation
err_loc, [ImplicitFieldBinders]
implicit_field_binders)]
[(SrcSpan, [ImplicitFieldBinders])]
-> [(SrcSpan, [ImplicitFieldBinders])]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall a. [a] -> [a] -> [a]
++ [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpats [LPat (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
explicit_pats
where ([LPat (GhcPass 'Renamed)]
explicit_pats, [ImplicitFieldBinders]
implicit_field_binders)
= [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
-> RecFieldsDotDot
-> ([LPat (GhcPass 'Renamed)], [ImplicitFieldBinders])
rec_field_expl_impl [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
rec_flds RecFieldsDotDot
rec_dotdot
details (InfixCon LPat (GhcPass 'Renamed)
p1 LPat (GhcPass 'Renamed)
p2) = GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat LPat (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
p1 [(SrcSpan, [ImplicitFieldBinders])]
-> [(SrcSpan, [ImplicitFieldBinders])]
-> [(SrcSpan, [ImplicitFieldBinders])]
forall a. [a] -> [a] -> [a]
++ GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
-> [(SrcSpan, [ImplicitFieldBinders])]
hs_lpat LPat (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
p2
lHsRecFieldsImplicits :: [LHsRecField GhcRn (LPat GhcRn)]
-> RecFieldsDotDot
-> [ImplicitFieldBinders]
lHsRecFieldsImplicits :: [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
-> RecFieldsDotDot -> [ImplicitFieldBinders]
lHsRecFieldsImplicits [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
rec_flds RecFieldsDotDot
rec_dotdot
= ([LPat (GhcPass 'Renamed)], [ImplicitFieldBinders])
-> [ImplicitFieldBinders]
forall a b. (a, b) -> b
snd (([LPat (GhcPass 'Renamed)], [ImplicitFieldBinders])
-> [ImplicitFieldBinders])
-> ([LPat (GhcPass 'Renamed)], [ImplicitFieldBinders])
-> [ImplicitFieldBinders]
forall a b. (a -> b) -> a -> b
$ [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
-> RecFieldsDotDot
-> ([LPat (GhcPass 'Renamed)], [ImplicitFieldBinders])
rec_field_expl_impl [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
rec_flds RecFieldsDotDot
rec_dotdot
rec_field_expl_impl :: [LHsRecField GhcRn (LPat GhcRn)]
-> RecFieldsDotDot
-> ([LPat GhcRn], [ImplicitFieldBinders])
rec_field_expl_impl :: [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
-> RecFieldsDotDot
-> ([LPat (GhcPass 'Renamed)], [ImplicitFieldBinders])
rec_field_expl_impl [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
rec_flds (RecFieldsDotDot { Int
unRecFieldsDotDot :: Int
unRecFieldsDotDot :: RecFieldsDotDot -> Int
.. })
= ( (GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
-> [GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))]
forall a b. (a -> b) -> [a] -> [b]
map (HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall lhs rhs. HsFieldBind lhs rhs -> rhs
hfbRHS (HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
-> (GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed)))
forall l e. GenLocated l e -> e
unLoc) [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
explicit_binds
, (GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> ImplicitFieldBinders)
-> [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
-> [ImplicitFieldBinders]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(LPat (GhcPass 'Renamed)))
-> ImplicitFieldBinders
GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))
-> ImplicitFieldBinders
forall {p} {pass} {l} {l}.
(IdP p ~ Name, XCFieldOcc pass ~ Name, CollectPass p) =>
GenLocated
l (HsFieldBind (GenLocated l (FieldOcc pass)) (XRec p (Pat p)))
-> ImplicitFieldBinders
implicit_field_binders [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
implicit_binds )
where ([GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
explicit_binds, [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
implicit_binds) = Int
-> [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
-> ([GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))],
[GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))])
forall a. Int -> [a] -> ([a], [a])
splitAt Int
unRecFieldsDotDot [LHsRecField (GhcPass 'Renamed) (LPat (GhcPass 'Renamed))]
[GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated SrcSpanAnnA (FieldOcc (GhcPass 'Renamed)))
(GenLocated SrcSpanAnnA (Pat (GhcPass 'Renamed))))]
rec_flds
implicit_field_binders :: GenLocated
l (HsFieldBind (GenLocated l (FieldOcc pass)) (XRec p (Pat p)))
-> ImplicitFieldBinders
implicit_field_binders (L l
_ (HsFieldBind { hfbLHS :: forall lhs rhs. HsFieldBind lhs rhs -> lhs
hfbLHS = L l
_ FieldOcc pass
fld, hfbRHS :: forall lhs rhs. HsFieldBind lhs rhs -> rhs
hfbRHS = XRec p (Pat p)
rhs }))
= ImplicitFieldBinders
{ implFlBndr_field :: Name
implFlBndr_field = FieldOcc pass -> XCFieldOcc pass
forall pass. FieldOcc pass -> XCFieldOcc pass
foExt FieldOcc pass
fld
, implFlBndr_binders :: [Name]
implFlBndr_binders = CollectFlag p -> XRec p (Pat p) -> [IdP p]
forall p. CollectPass p => CollectFlag p -> LPat p -> [IdP p]
collectPatBinders CollectFlag p
forall p. CollectFlag p
CollNoDictBinders XRec p (Pat p)
rhs }