{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
module GHC.Hs.Utils(
mkHsPar, mkHsApp, mkHsAppType, mkHsAppTypes, mkHsCaseAlt,
mkSimpleMatch, unguardedGRHSs, unguardedRHS,
mkMatchGroup, mkMatch, mkPrefixFunRhs, mkHsLam, mkHsIf,
mkHsWrap, mkLHsWrap, mkHsWrapCo, mkHsWrapCoR, mkLHsWrapCo,
mkHsDictLet, mkHsLams,
mkHsOpApp, mkHsDo, mkHsComp, mkHsWrapPat, mkHsWrapPatCo,
mkLHsPar, mkHsCmdWrap, mkLHsCmdWrap,
mkHsCmdIf,
nlHsTyApp, nlHsTyApps, nlHsVar, nl_HsVar, nlHsDataCon,
nlHsLit, nlHsApp, nlHsApps, nlHsSyntaxApps,
nlHsIntLit, nlHsVarApps,
nlHsDo, nlHsOpApp, nlHsLam, nlHsPar, nlHsIf, nlHsCase, nlList,
mkLHsTupleExpr, mkLHsVarTuple, missingTupArg,
typeToLHsType,
mkChunkified, chunkify,
mkFunBind, mkVarBind, mkHsVarBind, mkSimpleGeneratedFunBind, mkTopFunBind,
mkPatSynBind,
isInfixFunBind,
mkHsIntegral, mkHsFractional, mkHsIsString, mkHsString, mkHsStringPrimLit,
mkNPat, mkNPlusKPat, nlVarPat, nlLitPat, nlConVarPat, nlConVarPatName, nlConPat,
nlConPatName, nlInfixConPat, nlNullaryConPat, nlWildConPat, nlWildPat,
nlWildPatName, nlTuplePat, mkParPat, nlParPat,
mkBigLHsVarTup, mkBigLHsTup, mkBigLHsVarPatTup, mkBigLHsPatTup,
mkHsAppTy, mkHsAppKindTy,
mkLHsSigType, mkLHsSigWcType, mkClassOpSigs, mkHsSigEnv,
nlHsAppTy, nlHsAppKindTy, nlHsTyVar, nlHsFunTy, nlHsParTy, nlHsTyConApp,
mkTransformStmt, mkTransformByStmt, mkBodyStmt,
mkPsBindStmt, mkRnBindStmt, mkTcBindStmt,
mkLastStmt,
emptyTransStmt, mkGroupUsingStmt, mkGroupByUsingStmt,
emptyRecStmt, emptyRecStmtName, emptyRecStmtId, mkRecStmt,
unitRecStmtTc,
mkUntypedSplice, mkTypedSplice,
mkHsQuasiQuote,
isUnliftedHsBind, isBangedHsBind,
collectLocalBinders, collectHsValBinders, collectHsBindListBinders,
collectHsIdBinders,
collectHsBindsBinders, collectHsBindBinders, collectMethodBinders,
collectPatBinders, collectPatsBinders,
collectLStmtsBinders, collectStmtsBinders,
collectLStmtBinders, collectStmtBinders,
CollectPass(..),
hsLTyClDeclBinders, hsTyClForeignBinders,
hsPatSynSelectors, getPatSynBinds,
hsForeignDeclsBinders, hsGroupBinders, hsDataFamInstBinders,
lStmtsImplicits, hsValBindsImplicits, lPatImplicits
) where
#include "HsVersions.h"
import GHC.Prelude
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 GHC.Hs.Extension
import GHC.Tc.Types.Evidence
import GHC.Types.Name.Reader
import GHC.Types.Var
import GHC.Core.TyCo.Rep
import GHC.Core.TyCon
import GHC.Core.Type ( appTyArgFlags, splitAppTys, tyConArgFlags, tyConAppNeedsKindSig )
import GHC.Builtin.Types ( unitTy )
import GHC.Tc.Utils.TcType
import GHC.Core.DataCon
import GHC.Core.ConLike
import GHC.Types.Id
import GHC.Types.Name
import GHC.Types.Name.Set hiding ( unitFV )
import GHC.Types.Name.Env
import GHC.Types.Basic
import GHC.Types.SrcLoc
import GHC.Data.FastString
import GHC.Utils.Misc
import GHC.Data.Bag
import GHC.Utils.Outputable
import GHC.Settings.Constants
import Data.Either
import Data.Function
import Data.List
import Data.Proxy
mkHsPar :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsPar :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsPar LHsExpr (GhcPass id)
e = SrcSpan -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)
forall l e. l -> e -> GenLocated l e
L (LHsExpr (GhcPass id) -> SrcSpan
forall l e. GenLocated l e -> l
getLoc LHsExpr (GhcPass id)
e) (XPar (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id)
forall p. XPar p -> LHsExpr p -> HsExpr p
HsPar XPar (GhcPass id)
NoExtField
noExtField LHsExpr (GhcPass id)
e)
mkSimpleMatch :: HsMatchContext (NoGhcTc (GhcPass p))
-> [LPat (GhcPass p)] -> Located (body (GhcPass p))
-> LMatch (GhcPass p) (Located (body (GhcPass p)))
mkSimpleMatch :: HsMatchContext (NoGhcTc (GhcPass p))
-> [LPat (GhcPass p)]
-> Located (body (GhcPass p))
-> LMatch (GhcPass p) (Located (body (GhcPass p)))
mkSimpleMatch HsMatchContext (NoGhcTc (GhcPass p))
ctxt [LPat (GhcPass p)]
pats Located (body (GhcPass p))
rhs
= SrcSpan
-> Match (GhcPass p) (Located (body (GhcPass p)))
-> LMatch (GhcPass p) (Located (body (GhcPass p)))
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc (Match (GhcPass p) (Located (body (GhcPass p)))
-> LMatch (GhcPass p) (Located (body (GhcPass p))))
-> Match (GhcPass p) (Located (body (GhcPass p)))
-> LMatch (GhcPass p) (Located (body (GhcPass p)))
forall a b. (a -> b) -> a -> b
$
Match :: forall p body.
XCMatch p body
-> HsMatchContext (NoGhcTc p)
-> [LPat p]
-> GRHSs p body
-> Match p body
Match { m_ext :: XCMatch (GhcPass p) (Located (body (GhcPass p)))
m_ext = XCMatch (GhcPass p) (Located (body (GhcPass p)))
NoExtField
noExtField, m_ctxt :: HsMatchContext (NoGhcTc (GhcPass p))
m_ctxt = HsMatchContext (NoGhcTc (GhcPass p))
ctxt, m_pats :: [LPat (GhcPass p)]
m_pats = [LPat (GhcPass p)]
pats
, m_grhss :: GRHSs (GhcPass p) (Located (body (GhcPass p)))
m_grhss = Located (body (GhcPass p))
-> GRHSs (GhcPass p) (Located (body (GhcPass p)))
forall (body :: * -> *) (p :: Pass).
Located (body (GhcPass p))
-> GRHSs (GhcPass p) (Located (body (GhcPass p)))
unguardedGRHSs Located (body (GhcPass p))
rhs }
where
loc :: SrcSpan
loc = case [LPat (GhcPass p)]
pats of
[] -> Located (body (GhcPass p)) -> SrcSpan
forall l e. GenLocated l e -> l
getLoc Located (body (GhcPass p))
rhs
(LPat (GhcPass p)
pat:[LPat (GhcPass p)]
_) -> SrcSpan -> SrcSpan -> SrcSpan
combineSrcSpans (GenLocated SrcSpan (Pat (GhcPass p)) -> SrcSpan
forall l e. GenLocated l e -> l
getLoc GenLocated SrcSpan (Pat (GhcPass p))
LPat (GhcPass p)
pat) (Located (body (GhcPass p)) -> SrcSpan
forall l e. GenLocated l e -> l
getLoc Located (body (GhcPass p))
rhs)
unguardedGRHSs :: Located (body (GhcPass p))
-> GRHSs (GhcPass p) (Located (body (GhcPass p)))
unguardedGRHSs :: Located (body (GhcPass p))
-> GRHSs (GhcPass p) (Located (body (GhcPass p)))
unguardedGRHSs rhs :: Located (body (GhcPass p))
rhs@(L SrcSpan
loc body (GhcPass p)
_)
= XCGRHSs (GhcPass p) (Located (body (GhcPass p)))
-> [LGRHS (GhcPass p) (Located (body (GhcPass p)))]
-> LHsLocalBinds (GhcPass p)
-> GRHSs (GhcPass p) (Located (body (GhcPass p)))
forall p body.
XCGRHSs p body -> [LGRHS p body] -> LHsLocalBinds p -> GRHSs p body
GRHSs XCGRHSs (GhcPass p) (Located (body (GhcPass p)))
NoExtField
noExtField (SrcSpan
-> Located (body (GhcPass p))
-> [LGRHS (GhcPass p) (Located (body (GhcPass p)))]
forall (body :: * -> *) (p :: Pass).
SrcSpan
-> Located (body (GhcPass p))
-> [LGRHS (GhcPass p) (Located (body (GhcPass p)))]
unguardedRHS SrcSpan
loc Located (body (GhcPass p))
rhs) (HsLocalBindsLR (GhcPass p) (GhcPass p) -> LHsLocalBinds (GhcPass p)
forall e. e -> Located e
noLoc HsLocalBindsLR (GhcPass p) (GhcPass p)
forall (a :: Pass) (b :: Pass).
HsLocalBindsLR (GhcPass a) (GhcPass b)
emptyLocalBinds)
unguardedRHS :: SrcSpan -> Located (body (GhcPass p))
-> [LGRHS (GhcPass p) (Located (body (GhcPass p)))]
unguardedRHS :: SrcSpan
-> Located (body (GhcPass p))
-> [LGRHS (GhcPass p) (Located (body (GhcPass p)))]
unguardedRHS SrcSpan
loc Located (body (GhcPass p))
rhs = [SrcSpan
-> GRHS (GhcPass p) (Located (body (GhcPass p)))
-> LGRHS (GhcPass p) (Located (body (GhcPass p)))
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc (XCGRHS (GhcPass p) (Located (body (GhcPass p)))
-> [GuardLStmt (GhcPass p)]
-> Located (body (GhcPass p))
-> GRHS (GhcPass p) (Located (body (GhcPass p)))
forall p body.
XCGRHS p body -> [GuardLStmt p] -> body -> GRHS p body
GRHS XCGRHS (GhcPass p) (Located (body (GhcPass p)))
NoExtField
noExtField [] Located (body (GhcPass p))
rhs)]
mkMatchGroup :: (XMG name (Located (body name)) ~ NoExtField)
=> Origin -> [LMatch name (Located (body name))]
-> MatchGroup name (Located (body name))
mkMatchGroup :: Origin
-> [LMatch name (Located (body name))]
-> MatchGroup name (Located (body name))
mkMatchGroup Origin
origin [LMatch name (Located (body name))]
matches = MG :: forall p body.
XMG p body
-> Located [LMatch p body] -> Origin -> MatchGroup p body
MG { mg_ext :: XMG name (Located (body name))
mg_ext = XMG name (Located (body name))
NoExtField
noExtField
, mg_alts :: Located [LMatch name (Located (body name))]
mg_alts = [LMatch name (Located (body name))]
-> Located [LMatch name (Located (body name))]
forall a. [Located a] -> Located [Located a]
mkLocatedList [LMatch name (Located (body name))]
matches
, mg_origin :: Origin
mg_origin = Origin
origin }
mkLocatedList :: [Located a] -> Located [Located a]
mkLocatedList :: [Located a] -> Located [Located a]
mkLocatedList [] = [Located a] -> Located [Located a]
forall e. e -> Located e
noLoc []
mkLocatedList [Located a]
ms = SrcSpan -> [Located a] -> Located [Located a]
forall l e. l -> e -> GenLocated l e
L (Located a -> Located a -> SrcSpan
forall a b. Located a -> Located b -> SrcSpan
combineLocs ([Located a] -> Located a
forall a. [a] -> a
head [Located a]
ms) ([Located a] -> Located a
forall a. [a] -> a
last [Located a]
ms)) [Located a]
ms
mkHsApp :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsApp :: LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsApp LHsExpr (GhcPass id)
e1 LHsExpr (GhcPass id)
e2 = LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
-> HsExpr (GhcPass id)
-> LHsExpr (GhcPass id)
forall a b c. Located a -> Located b -> c -> Located c
addCLoc 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)
mkHsAppType :: LHsExpr GhcRn -> LHsWcType GhcRn -> LHsExpr GhcRn
mkHsAppType :: Located (HsExpr GhcRn) -> LHsWcType GhcRn -> Located (HsExpr GhcRn)
mkHsAppType Located (HsExpr GhcRn)
e LHsWcType GhcRn
t = Located (HsExpr GhcRn)
-> Located (HsType GhcRn) -> HsExpr GhcRn -> Located (HsExpr GhcRn)
forall a b c. Located a -> Located b -> c -> Located c
addCLoc Located (HsExpr GhcRn)
e Located (HsType GhcRn)
t_body (XAppTypeE GhcRn
-> Located (HsExpr GhcRn)
-> LHsWcType (NoGhcTc GhcRn)
-> HsExpr GhcRn
forall p.
XAppTypeE p -> LHsExpr p -> LHsWcType (NoGhcTc p) -> HsExpr p
HsAppType XAppTypeE GhcRn
NoExtField
noExtField Located (HsExpr GhcRn)
e LHsWcType (NoGhcTc GhcRn)
LHsWcType GhcRn
paren_wct)
where
t_body :: Located (HsType GhcRn)
t_body = LHsWcType GhcRn -> Located (HsType GhcRn)
forall pass thing. HsWildCardBndrs pass thing -> thing
hswc_body LHsWcType GhcRn
t
paren_wct :: LHsWcType GhcRn
paren_wct = LHsWcType GhcRn
t { hswc_body :: Located (HsType GhcRn)
hswc_body = PprPrec -> Located (HsType GhcRn) -> Located (HsType GhcRn)
forall (p :: Pass).
PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType PprPrec
appPrec Located (HsType GhcRn)
t_body }
mkHsAppTypes :: LHsExpr GhcRn -> [LHsWcType GhcRn] -> LHsExpr GhcRn
mkHsAppTypes :: Located (HsExpr GhcRn)
-> [LHsWcType GhcRn] -> Located (HsExpr GhcRn)
mkHsAppTypes = (Located (HsExpr GhcRn)
-> LHsWcType GhcRn -> Located (HsExpr GhcRn))
-> Located (HsExpr GhcRn)
-> [LHsWcType GhcRn]
-> Located (HsExpr GhcRn)
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldl' Located (HsExpr GhcRn) -> LHsWcType GhcRn -> Located (HsExpr GhcRn)
mkHsAppType
mkHsLam :: IsPass p
=> (XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ NoExtField)
=> [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> LHsExpr (GhcPass p)
mkHsLam :: [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
mkHsLam [LPat (GhcPass p)]
pats LHsExpr (GhcPass p)
body = LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsPar (SrcSpan -> HsExpr (GhcPass p) -> LHsExpr (GhcPass p)
forall l e. l -> e -> GenLocated l e
L (LHsExpr (GhcPass p) -> SrcSpan
forall l e. GenLocated l e -> l
getLoc LHsExpr (GhcPass p)
body) (XLam (GhcPass p)
-> MatchGroup (GhcPass p) (LHsExpr (GhcPass p))
-> HsExpr (GhcPass p)
forall p. XLam p -> MatchGroup p (LHsExpr p) -> HsExpr p
HsLam XLam (GhcPass p)
NoExtField
noExtField MatchGroup (GhcPass p) (LHsExpr (GhcPass p))
matches))
where
matches :: MatchGroup (GhcPass p) (LHsExpr (GhcPass p))
matches = Origin
-> [LMatch (GhcPass p) (LHsExpr (GhcPass p))]
-> MatchGroup (GhcPass p) (LHsExpr (GhcPass p))
forall name (body :: * -> *).
(XMG name (Located (body name)) ~ NoExtField) =>
Origin
-> [LMatch name (Located (body name))]
-> MatchGroup name (Located (body name))
Evidence bound by a type signature of the constraint type XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ NoExtField
Evidence bound by a type signature of the constraint type XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ NoExtField
Evidence bound by a type signature of the constraint type XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ NoExtField
mkMatchGroup Origin
Generated
[HsMatchContext (NoGhcTc (GhcPass p))
-> [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> LMatch (GhcPass p) (LHsExpr (GhcPass p))
forall (p :: Pass) (body :: * -> *).
HsMatchContext (NoGhcTc (GhcPass p))
-> [LPat (GhcPass p)]
-> Located (body (GhcPass p))
-> LMatch (GhcPass p) (Located (body (GhcPass p)))
mkSimpleMatch HsMatchContext (NoGhcTc (GhcPass p))
forall p. HsMatchContext p
LambdaExpr [Located (Pat (GhcPass p))]
[LPat (GhcPass p)]
pats' LHsExpr (GhcPass p)
body]
pats' :: [Located (Pat (GhcPass p))]
pats' = (Located (Pat (GhcPass p)) -> Located (Pat (GhcPass p)))
-> [Located (Pat (GhcPass p))] -> [Located (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)
Evidence bound by a type signature of the constraint type IsPass p
parenthesizePat PprPrec
appPrec) [Located (Pat (GhcPass p))]
[LPat (GhcPass p)]
pats
mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsLams :: [TyVar] -> [TyVar] -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsLams [TyVar]
tyvars [TyVar]
dicts LHsExpr GhcTc
expr = HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap ([TyVar] -> HsWrapper
mkWpTyLams [TyVar]
tyvars
HsWrapper -> HsWrapper -> HsWrapper
<.> [TyVar] -> HsWrapper
mkWpLams [TyVar]
dicts) LHsExpr GhcTc
expr
mkHsCaseAlt :: LPat (GhcPass p) -> (Located (body (GhcPass p)))
-> LMatch (GhcPass p) (Located (body (GhcPass p)))
mkHsCaseAlt :: LPat (GhcPass p)
-> Located (body (GhcPass p))
-> LMatch (GhcPass p) (Located (body (GhcPass p)))
mkHsCaseAlt LPat (GhcPass p)
pat Located (body (GhcPass p))
expr
= HsMatchContext (NoGhcTc (GhcPass p))
-> [LPat (GhcPass p)]
-> Located (body (GhcPass p))
-> LMatch (GhcPass p) (Located (body (GhcPass p)))
forall (p :: Pass) (body :: * -> *).
HsMatchContext (NoGhcTc (GhcPass p))
-> [LPat (GhcPass p)]
-> Located (body (GhcPass p))
-> LMatch (GhcPass p) (Located (body (GhcPass p)))
mkSimpleMatch HsMatchContext (NoGhcTc (GhcPass p))
forall p. HsMatchContext p
CaseAlt [LPat (GhcPass p)
pat] Located (body (GhcPass p))
expr
nlHsTyApp :: Id -> [Type] -> LHsExpr GhcTc
nlHsTyApp :: TyVar -> [Type] -> LHsExpr GhcTc
nlHsTyApp TyVar
fun_id [Type]
tys
= HsExpr GhcTc -> LHsExpr GhcTc
forall e. e -> Located e
noLoc (HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap ([Type] -> HsWrapper
mkWpTyApps [Type]
tys) (XVar GhcTc -> Located (IdP GhcTc) -> HsExpr GhcTc
forall p. XVar p -> Located (IdP p) -> HsExpr p
HsVar XVar GhcTc
NoExtField
noExtField (TyVar -> Located TyVar
forall e. e -> Located e
noLoc TyVar
fun_id)))
nlHsTyApps :: Id -> [Type] -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsTyApps :: TyVar -> [Type] -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsTyApps TyVar
fun_id [Type]
tys [LHsExpr GhcTc]
xs = (LHsExpr GhcTc -> LHsExpr GhcTc -> LHsExpr GhcTc)
-> LHsExpr GhcTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldl' LHsExpr GhcTc -> LHsExpr GhcTc -> LHsExpr GhcTc
forall (id :: Pass).
IsPass id =>
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
External instance of the constraint type IsPass 'Typechecked
nlHsApp (TyVar -> [Type] -> LHsExpr GhcTc
nlHsTyApp TyVar
fun_id [Type]
tys) [LHsExpr GhcTc]
xs
mkLHsPar :: IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkLHsPar :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkLHsPar le :: LHsExpr (GhcPass id)
le@(L SrcSpan
loc HsExpr (GhcPass id)
e)
| PprPrec -> HsExpr (GhcPass id) -> Bool
forall (p :: Pass).
IsPass p =>
PprPrec -> HsExpr (GhcPass p) -> Bool
Evidence bound by a type signature of the constraint type IsPass id
hsExprNeedsParens PprPrec
appPrec HsExpr (GhcPass id)
e = SrcSpan -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc (XPar (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id)
forall p. XPar p -> LHsExpr p -> HsExpr p
HsPar XPar (GhcPass id)
NoExtField
noExtField LHsExpr (GhcPass id)
le)
| Bool
otherwise = LHsExpr (GhcPass id)
le
mkParPat :: IsPass p => LPat (GhcPass p) -> LPat (GhcPass p)
mkParPat :: LPat (GhcPass p) -> LPat (GhcPass p)
mkParPat lp :: LPat (GhcPass p)
lp@(L SrcSpan
loc Pat (GhcPass p)
p)
| PprPrec -> Pat (GhcPass p) -> Bool
forall (p :: Pass). IsPass p => PprPrec -> Pat (GhcPass p) -> Bool
Evidence bound by a type signature of the constraint type IsPass p
patNeedsParens PprPrec
appPrec Pat (GhcPass p)
p = SrcSpan -> Pat (GhcPass p) -> GenLocated SrcSpan (Pat (GhcPass p))
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc (XParPat (GhcPass p) -> LPat (GhcPass p) -> Pat (GhcPass p)
forall p. XParPat p -> LPat p -> Pat p
ParPat XParPat (GhcPass p)
NoExtField
noExtField LPat (GhcPass p)
lp)
| Bool
otherwise = LPat (GhcPass p)
lp
nlParPat :: LPat (GhcPass name) -> LPat (GhcPass name)
nlParPat :: LPat (GhcPass name) -> LPat (GhcPass name)
nlParPat LPat (GhcPass name)
p = Pat (GhcPass name) -> Located (Pat (GhcPass name))
forall e. e -> Located e
noLoc (XParPat (GhcPass name) -> LPat (GhcPass name) -> Pat (GhcPass name)
forall p. XParPat p -> LPat p -> Pat p
ParPat XParPat (GhcPass name)
NoExtField
noExtField LPat (GhcPass name)
p)
mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
mkHsFractional :: FractionalLit -> HsOverLit GhcPs
mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs
mkHsDo :: HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> HsExpr GhcPs
mkHsComp :: HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> HsExpr GhcPs
mkNPat :: Located (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs)
-> Pat GhcPs
mkNPlusKPat :: Located RdrName -> Located (HsOverLit GhcPs) -> Pat GhcPs
mkLastStmt :: IsPass idR => Located (bodyR (GhcPass idR))
-> StmtLR (GhcPass idL) (GhcPass idR) (Located (bodyR (GhcPass idR)))
mkBodyStmt :: Located (bodyR GhcPs)
-> StmtLR (GhcPass idL) GhcPs (Located (bodyR GhcPs))
mkPsBindStmt :: LPat GhcPs -> Located (bodyR GhcPs)
-> StmtLR GhcPs GhcPs (Located (bodyR GhcPs))
mkRnBindStmt :: LPat GhcRn -> Located (bodyR GhcRn)
-> StmtLR GhcRn GhcRn (Located (bodyR GhcRn))
mkTcBindStmt :: LPat GhcTc -> Located (bodyR GhcTc)
-> StmtLR GhcTc GhcTc (Located (bodyR GhcTc))
emptyRecStmt :: StmtLR (GhcPass idL) GhcPs bodyR
emptyRecStmtName :: StmtLR GhcRn GhcRn bodyR
emptyRecStmtId :: StmtLR GhcTc GhcTc bodyR
mkRecStmt :: [LStmtLR (GhcPass idL) GhcPs bodyR]
-> StmtLR (GhcPass idL) GhcPs bodyR
mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
mkHsIntegral IntegralLit
i = XOverLit GhcPs -> OverLitVal -> HsExpr GhcPs -> HsOverLit GhcPs
forall p. XOverLit p -> OverLitVal -> HsExpr p -> HsOverLit p
OverLit XOverLit GhcPs
NoExtField
noExtField (IntegralLit -> OverLitVal
HsIntegral IntegralLit
i) HsExpr GhcPs
forall (p :: Pass). HsExpr (GhcPass p)
noExpr
mkHsFractional :: FractionalLit -> HsOverLit GhcPs
mkHsFractional FractionalLit
f = XOverLit GhcPs -> OverLitVal -> HsExpr GhcPs -> HsOverLit GhcPs
forall p. XOverLit p -> OverLitVal -> HsExpr p -> HsOverLit p
OverLit XOverLit GhcPs
NoExtField
noExtField (FractionalLit -> OverLitVal
HsFractional FractionalLit
f) HsExpr GhcPs
forall (p :: Pass). HsExpr (GhcPass p)
noExpr
mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs
mkHsIsString SourceText
src FastString
s = XOverLit GhcPs -> OverLitVal -> HsExpr GhcPs -> HsOverLit GhcPs
forall p. XOverLit p -> OverLitVal -> HsExpr p -> HsOverLit p
OverLit XOverLit GhcPs
NoExtField
noExtField (SourceText -> FastString -> OverLitVal
HsIsString SourceText
src FastString
s) HsExpr GhcPs
forall (p :: Pass). HsExpr (GhcPass p)
noExpr
mkHsDo :: HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> HsExpr GhcPs
mkHsDo HsStmtContext GhcRn
ctxt [ExprLStmt GhcPs]
stmts = XDo GhcPs
-> HsStmtContext GhcRn -> Located [ExprLStmt GhcPs] -> HsExpr GhcPs
forall p.
XDo p -> HsStmtContext GhcRn -> Located [ExprLStmt p] -> HsExpr p
HsDo XDo GhcPs
NoExtField
noExtField HsStmtContext GhcRn
ctxt ([ExprLStmt GhcPs] -> Located [ExprLStmt GhcPs]
forall a. [Located a] -> Located [Located a]
mkLocatedList [ExprLStmt GhcPs]
stmts)
mkHsComp :: HsStmtContext GhcRn
-> [ExprLStmt GhcPs] -> Located (HsExpr GhcPs) -> HsExpr GhcPs
mkHsComp HsStmtContext GhcRn
ctxt [ExprLStmt GhcPs]
stmts Located (HsExpr GhcPs)
expr = HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> HsExpr GhcPs
mkHsDo HsStmtContext GhcRn
ctxt ([ExprLStmt GhcPs]
stmts [ExprLStmt GhcPs] -> [ExprLStmt GhcPs] -> [ExprLStmt GhcPs]
forall a. [a] -> [a] -> [a]
++ [ExprLStmt GhcPs
last_stmt])
where
last_stmt :: ExprLStmt GhcPs
last_stmt = SrcSpan
-> StmtLR GhcPs GhcPs (Located (HsExpr GhcPs)) -> ExprLStmt GhcPs
forall l e. l -> e -> GenLocated l e
L (Located (HsExpr GhcPs) -> SrcSpan
forall l e. GenLocated l e -> l
getLoc Located (HsExpr GhcPs)
expr) (StmtLR GhcPs GhcPs (Located (HsExpr GhcPs)) -> ExprLStmt GhcPs)
-> StmtLR GhcPs GhcPs (Located (HsExpr GhcPs)) -> ExprLStmt GhcPs
forall a b. (a -> b) -> a -> b
$ Located (HsExpr GhcPs)
-> StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
forall (idR :: Pass) (bodyR :: * -> *) (idL :: Pass).
IsPass idR =>
Located (bodyR (GhcPass idR))
-> StmtLR
(GhcPass idL) (GhcPass idR) (Located (bodyR (GhcPass idR)))
External instance of the constraint type IsPass 'Parsed
mkLastStmt Located (HsExpr GhcPs)
expr
mkHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
mkHsIf :: Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs) -> Located (HsExpr GhcPs) -> HsExpr GhcPs
mkHsIf Located (HsExpr GhcPs)
c Located (HsExpr GhcPs)
a Located (HsExpr GhcPs)
b = XIf GhcPs
-> SyntaxExpr GhcPs
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> HsExpr GhcPs
forall p.
XIf p
-> SyntaxExpr p -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p
HsIf Bool
XIf GhcPs
True SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr Located (HsExpr GhcPs)
c Located (HsExpr GhcPs)
a Located (HsExpr GhcPs)
b
mkHsCmdIf :: LHsExpr GhcPs -> LHsCmd GhcPs -> LHsCmd GhcPs -> HsCmd GhcPs
mkHsCmdIf :: Located (HsExpr GhcPs)
-> LHsCmd GhcPs -> LHsCmd GhcPs -> HsCmd GhcPs
mkHsCmdIf Located (HsExpr GhcPs)
c LHsCmd GhcPs
a LHsCmd GhcPs
b = XCmdIf GhcPs
-> SyntaxExpr GhcPs
-> Located (HsExpr GhcPs)
-> LHsCmd GhcPs
-> LHsCmd GhcPs
-> HsCmd GhcPs
forall id.
XCmdIf id
-> SyntaxExpr id
-> LHsExpr id
-> LHsCmd id
-> LHsCmd id
-> HsCmd id
HsCmdIf XCmdIf GhcPs
NoExtField
noExtField SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr Located (HsExpr GhcPs)
c LHsCmd GhcPs
a LHsCmd GhcPs
b
mkNPat :: Located (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> Pat GhcPs
mkNPat Located (HsOverLit GhcPs)
lit Maybe (SyntaxExpr GhcPs)
neg = XNPat GhcPs
-> Located (HsOverLit GhcPs)
-> Maybe (SyntaxExpr GhcPs)
-> SyntaxExpr GhcPs
-> Pat GhcPs
forall p.
XNPat p
-> Located (HsOverLit p)
-> Maybe (SyntaxExpr p)
-> SyntaxExpr p
-> Pat p
NPat XNPat GhcPs
NoExtField
noExtField Located (HsOverLit GhcPs)
lit Maybe (SyntaxExpr GhcPs)
neg SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr
mkNPlusKPat :: Located RdrName -> Located (HsOverLit GhcPs) -> Pat GhcPs
mkNPlusKPat Located RdrName
id Located (HsOverLit GhcPs)
lit
= XNPlusKPat GhcPs
-> Located (IdP GhcPs)
-> Located (HsOverLit GhcPs)
-> HsOverLit GhcPs
-> SyntaxExpr GhcPs
-> SyntaxExpr GhcPs
-> Pat GhcPs
forall p.
XNPlusKPat p
-> Located (IdP p)
-> Located (HsOverLit p)
-> HsOverLit p
-> SyntaxExpr p
-> SyntaxExpr p
-> Pat p
NPlusKPat XNPlusKPat GhcPs
NoExtField
noExtField Located RdrName
Located (IdP GhcPs)
id Located (HsOverLit GhcPs)
lit (Located (HsOverLit GhcPs) -> HsOverLit GhcPs
forall l e. GenLocated l e -> e
unLoc Located (HsOverLit GhcPs)
lit) SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr
mkTransformStmt :: [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkTransformByStmt :: [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkGroupUsingStmt :: [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkGroupByUsingStmt :: [ExprLStmt GhcPs] -> LHsExpr GhcPs
-> LHsExpr GhcPs
-> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyTransStmt :: StmtLR GhcPs GhcPs (LHsExpr GhcPs)
emptyTransStmt :: StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
emptyTransStmt = TransStmt :: forall idL idR body.
XTransStmt idL idR body
-> TransForm
-> [ExprLStmt idL]
-> [(IdP idR, IdP idR)]
-> LHsExpr idR
-> Maybe (LHsExpr idR)
-> SyntaxExpr idR
-> SyntaxExpr idR
-> HsExpr idR
-> StmtLR idL idR body
TransStmt { trS_ext :: XTransStmt GhcPs GhcPs (Located (HsExpr GhcPs))
trS_ext = XTransStmt GhcPs GhcPs (Located (HsExpr GhcPs))
NoExtField
noExtField
, trS_form :: TransForm
trS_form = String -> TransForm
forall a. String -> a
panic String
"emptyTransStmt: form"
, trS_stmts :: [ExprLStmt GhcPs]
trS_stmts = [], trS_bndrs :: [(IdP GhcPs, IdP GhcPs)]
trS_bndrs = []
, trS_by :: Maybe (Located (HsExpr GhcPs))
trS_by = Maybe (Located (HsExpr GhcPs))
forall a. Maybe a
Nothing, trS_using :: Located (HsExpr GhcPs)
trS_using = HsExpr GhcPs -> Located (HsExpr GhcPs)
forall e. e -> Located e
noLoc 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)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr, trS_bind :: SyntaxExpr GhcPs
trS_bind = SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr
, trS_fmap :: HsExpr GhcPs
trS_fmap = HsExpr GhcPs
forall (p :: Pass). HsExpr (GhcPass p)
noExpr }
mkTransformStmt :: [ExprLStmt GhcPs]
-> Located (HsExpr GhcPs)
-> StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
mkTransformStmt [ExprLStmt GhcPs]
ss Located (HsExpr GhcPs)
u = StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
emptyTransStmt { trS_form :: TransForm
trS_form = TransForm
ThenForm, trS_stmts :: [ExprLStmt GhcPs]
trS_stmts = [ExprLStmt GhcPs]
ss, trS_using :: Located (HsExpr GhcPs)
trS_using = Located (HsExpr GhcPs)
u }
mkTransformByStmt :: [ExprLStmt GhcPs]
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
mkTransformByStmt [ExprLStmt GhcPs]
ss Located (HsExpr GhcPs)
u Located (HsExpr GhcPs)
b = StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
emptyTransStmt { trS_form :: TransForm
trS_form = TransForm
ThenForm, trS_stmts :: [ExprLStmt GhcPs]
trS_stmts = [ExprLStmt GhcPs]
ss, trS_using :: Located (HsExpr GhcPs)
trS_using = Located (HsExpr GhcPs)
u, trS_by :: Maybe (Located (HsExpr GhcPs))
trS_by = Located (HsExpr GhcPs) -> Maybe (Located (HsExpr GhcPs))
forall a. a -> Maybe a
Just Located (HsExpr GhcPs)
b }
mkGroupUsingStmt :: [ExprLStmt GhcPs]
-> Located (HsExpr GhcPs)
-> StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
mkGroupUsingStmt [ExprLStmt GhcPs]
ss Located (HsExpr GhcPs)
u = StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
emptyTransStmt { trS_form :: TransForm
trS_form = TransForm
GroupForm, trS_stmts :: [ExprLStmt GhcPs]
trS_stmts = [ExprLStmt GhcPs]
ss, trS_using :: Located (HsExpr GhcPs)
trS_using = Located (HsExpr GhcPs)
u }
mkGroupByUsingStmt :: [ExprLStmt GhcPs]
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
mkGroupByUsingStmt [ExprLStmt GhcPs]
ss Located (HsExpr GhcPs)
b Located (HsExpr GhcPs)
u = StmtLR GhcPs GhcPs (Located (HsExpr GhcPs))
emptyTransStmt { trS_form :: TransForm
trS_form = TransForm
GroupForm, trS_stmts :: [ExprLStmt GhcPs]
trS_stmts = [ExprLStmt GhcPs]
ss, trS_using :: Located (HsExpr GhcPs)
trS_using = Located (HsExpr GhcPs)
u, trS_by :: Maybe (Located (HsExpr GhcPs))
trS_by = Located (HsExpr GhcPs) -> Maybe (Located (HsExpr GhcPs))
forall a. a -> Maybe a
Just Located (HsExpr GhcPs)
b }
mkLastStmt :: Located (bodyR (GhcPass idR))
-> StmtLR
(GhcPass idL) (GhcPass idR) (Located (bodyR (GhcPass idR)))
mkLastStmt Located (bodyR (GhcPass idR))
body = XLastStmt
(GhcPass idL) (GhcPass idR) (Located (bodyR (GhcPass idR)))
-> Located (bodyR (GhcPass idR))
-> Maybe Bool
-> SyntaxExpr (GhcPass idR)
-> StmtLR
(GhcPass idL) (GhcPass idR) (Located (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) (Located (bodyR (GhcPass idR)))
NoExtField
noExtField Located (bodyR (GhcPass idR))
body Maybe Bool
forall a. Maybe a
Nothing SyntaxExpr (GhcPass idR)
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
Evidence bound by a type signature of the constraint type IsPass idR
noSyntaxExpr
mkBodyStmt :: Located (bodyR GhcPs)
-> StmtLR (GhcPass idL) GhcPs (Located (bodyR GhcPs))
mkBodyStmt Located (bodyR GhcPs)
body
= XBodyStmt (GhcPass idL) GhcPs (Located (bodyR GhcPs))
-> Located (bodyR GhcPs)
-> SyntaxExpr GhcPs
-> SyntaxExpr GhcPs
-> StmtLR (GhcPass idL) GhcPs (Located (bodyR GhcPs))
forall idL idR body.
XBodyStmt idL idR body
-> body -> SyntaxExpr idR -> SyntaxExpr idR -> StmtLR idL idR body
BodyStmt XBodyStmt (GhcPass idL) GhcPs (Located (bodyR GhcPs))
NoExtField
noExtField Located (bodyR GhcPs)
body SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr
mkPsBindStmt :: LPat GhcPs
-> Located (bodyR GhcPs)
-> StmtLR GhcPs GhcPs (Located (bodyR GhcPs))
mkPsBindStmt LPat GhcPs
pat Located (bodyR GhcPs)
body = XBindStmt GhcPs GhcPs (Located (bodyR GhcPs))
-> LPat GhcPs
-> Located (bodyR GhcPs)
-> StmtLR GhcPs GhcPs (Located (bodyR GhcPs))
forall idL idR body.
XBindStmt idL idR body -> LPat idL -> body -> StmtLR idL idR body
BindStmt XBindStmt GhcPs GhcPs (Located (bodyR GhcPs))
NoExtField
noExtField LPat GhcPs
pat Located (bodyR GhcPs)
body
mkRnBindStmt :: LPat GhcRn
-> Located (bodyR GhcRn)
-> StmtLR GhcRn GhcRn (Located (bodyR GhcRn))
mkRnBindStmt LPat GhcRn
pat Located (bodyR GhcRn)
body = XBindStmt GhcRn GhcRn (Located (bodyR GhcRn))
-> LPat GhcRn
-> Located (bodyR GhcRn)
-> StmtLR GhcRn GhcRn (Located (bodyR GhcRn))
forall idL idR body.
XBindStmt idL idR body -> LPat idL -> body -> StmtLR idL idR body
BindStmt (XBindStmtRn :: SyntaxExpr GhcRn -> FailOperator GhcRn -> XBindStmtRn
XBindStmtRn { xbsrn_bindOp :: SyntaxExpr GhcRn
xbsrn_bindOp = SyntaxExpr GhcRn
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Renamed
noSyntaxExpr, xbsrn_failOp :: FailOperator GhcRn
xbsrn_failOp = FailOperator GhcRn
forall a. Maybe a
Nothing }) LPat GhcRn
pat Located (bodyR GhcRn)
body
mkTcBindStmt :: LPat GhcTc
-> Located (bodyR GhcTc)
-> StmtLR GhcTc GhcTc (Located (bodyR GhcTc))
mkTcBindStmt LPat GhcTc
pat Located (bodyR GhcTc)
body = XBindStmt GhcTc GhcTc (Located (bodyR GhcTc))
-> LPat GhcTc
-> Located (bodyR GhcTc)
-> StmtLR GhcTc GhcTc (Located (bodyR GhcTc))
forall idL idR body.
XBindStmt idL idR body -> LPat idL -> body -> StmtLR idL idR body
BindStmt (XBindStmtTc :: SyntaxExpr GhcTc -> Type -> FailOperator GhcTc -> XBindStmtTc
XBindStmtTc { xbstc_bindOp :: SyntaxExpr GhcTc
xbstc_bindOp = SyntaxExpr GhcTc
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Typechecked
noSyntaxExpr, xbstc_boundResultType :: Type
xbstc_boundResultType =Type
unitTy, xbstc_failOp :: FailOperator GhcTc
xbstc_failOp = FailOperator GhcTc
forall a. Maybe a
Nothing }) LPat GhcTc
pat Located (bodyR GhcTc)
body
emptyRecStmt' :: forall idL idR body. IsPass idR
=> XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
emptyRecStmt' :: XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
emptyRecStmt' XRecStmt (GhcPass idL) (GhcPass idR) body
tyVal =
RecStmt :: forall idL idR body.
XRecStmt idL idR body
-> [LStmtLR idL idR body]
-> [IdP idR]
-> [IdP idR]
-> SyntaxExpr idR
-> SyntaxExpr idR
-> SyntaxExpr idR
-> StmtLR idL idR body
RecStmt
{ recS_stmts :: [LStmtLR (GhcPass idL) (GhcPass idR) body]
recS_stmts = [], 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)
Evidence bound by a type signature of the constraint type IsPass idR
noSyntaxExpr
, recS_mfix_fn :: SyntaxExpr (GhcPass idR)
recS_mfix_fn = SyntaxExpr (GhcPass idR)
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
Evidence bound by a type signature of the constraint type IsPass idR
noSyntaxExpr
, recS_bind_fn :: SyntaxExpr (GhcPass idR)
recS_bind_fn = SyntaxExpr (GhcPass idR)
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
Evidence bound by a type signature of the constraint type IsPass idR
noSyntaxExpr
, recS_ext :: XRecStmt (GhcPass idL) (GhcPass idR) body
recS_ext = XRecStmt (GhcPass idL) (GhcPass idR) body
tyVal }
unitRecStmtTc :: RecStmtTc
unitRecStmtTc :: RecStmtTc
unitRecStmtTc = RecStmtTc :: Type -> [HsExpr GhcTc] -> [HsExpr GhcTc] -> Type -> RecStmtTc
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 :: StmtLR (GhcPass idL) GhcPs bodyR
emptyRecStmt = XRecStmt (GhcPass idL) GhcPs bodyR
-> StmtLR (GhcPass idL) GhcPs bodyR
forall (idL :: Pass) (idR :: Pass) body.
IsPass idR =>
XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
External instance of the constraint type IsPass 'Parsed
emptyRecStmt' XRecStmt (GhcPass idL) GhcPs bodyR
NoExtField
noExtField
emptyRecStmtName :: StmtLR GhcRn GhcRn bodyR
emptyRecStmtName = XRecStmt GhcRn GhcRn bodyR -> StmtLR GhcRn GhcRn bodyR
forall (idL :: Pass) (idR :: Pass) body.
IsPass idR =>
XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
External instance of the constraint type IsPass 'Renamed
emptyRecStmt' XRecStmt GhcRn GhcRn bodyR
NoExtField
noExtField
emptyRecStmtId :: StmtLR GhcTc GhcTc bodyR
emptyRecStmtId = XRecStmt GhcTc GhcTc bodyR -> StmtLR GhcTc GhcTc bodyR
forall (idL :: Pass) (idR :: Pass) body.
IsPass idR =>
XRecStmt (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
External instance of the constraint type IsPass 'Typechecked
emptyRecStmt' XRecStmt GhcTc GhcTc bodyR
RecStmtTc
unitRecStmtTc
mkRecStmt :: [LStmtLR (GhcPass idL) GhcPs bodyR]
-> StmtLR (GhcPass idL) GhcPs bodyR
mkRecStmt [LStmtLR (GhcPass idL) GhcPs bodyR]
stmts = StmtLR (GhcPass idL) GhcPs bodyR
forall (idL :: Pass) bodyR. StmtLR (GhcPass idL) GhcPs bodyR
emptyRecStmt { recS_stmts :: [LStmtLR (GhcPass idL) GhcPs bodyR]
recS_stmts = [LStmtLR (GhcPass idL) GhcPs bodyR]
stmts }
mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
mkHsOpApp :: Located (HsExpr GhcPs)
-> IdP GhcPs -> Located (HsExpr GhcPs) -> HsExpr GhcPs
mkHsOpApp Located (HsExpr GhcPs)
e1 IdP GhcPs
op Located (HsExpr GhcPs)
e2 = XOpApp GhcPs
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> HsExpr GhcPs
forall p.
XOpApp p -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p
OpApp XOpApp GhcPs
NoExtField
noExtField Located (HsExpr GhcPs)
e1 (HsExpr GhcPs -> Located (HsExpr GhcPs)
forall e. e -> Located e
noLoc (XVar GhcPs -> Located (IdP GhcPs) -> HsExpr GhcPs
forall p. XVar p -> Located (IdP p) -> HsExpr p
HsVar XVar GhcPs
NoExtField
noExtField (RdrName -> Located RdrName
forall e. e -> Located e
noLoc RdrName
IdP GhcPs
op))) Located (HsExpr GhcPs)
e2
unqualSplice :: RdrName
unqualSplice :: RdrName
unqualSplice = OccName -> RdrName
mkRdrUnqual (FastString -> OccName
mkVarOccFS (String -> FastString
fsLit String
"splice"))
mkUntypedSplice :: SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs
mkUntypedSplice :: SpliceDecoration -> Located (HsExpr GhcPs) -> HsSplice GhcPs
mkUntypedSplice SpliceDecoration
hasParen Located (HsExpr GhcPs)
e = XUntypedSplice GhcPs
-> SpliceDecoration
-> IdP GhcPs
-> Located (HsExpr GhcPs)
-> HsSplice GhcPs
forall id.
XUntypedSplice id
-> SpliceDecoration -> IdP id -> LHsExpr id -> HsSplice id
HsUntypedSplice XUntypedSplice GhcPs
NoExtField
noExtField SpliceDecoration
hasParen RdrName
IdP GhcPs
unqualSplice Located (HsExpr GhcPs)
e
mkTypedSplice :: SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs
mkTypedSplice :: SpliceDecoration -> Located (HsExpr GhcPs) -> HsSplice GhcPs
mkTypedSplice SpliceDecoration
hasParen Located (HsExpr GhcPs)
e = XTypedSplice GhcPs
-> SpliceDecoration
-> IdP GhcPs
-> Located (HsExpr GhcPs)
-> HsSplice GhcPs
forall id.
XTypedSplice id
-> SpliceDecoration -> IdP id -> LHsExpr id -> HsSplice id
HsTypedSplice XTypedSplice GhcPs
NoExtField
noExtField SpliceDecoration
hasParen RdrName
IdP GhcPs
unqualSplice Located (HsExpr GhcPs)
e
mkHsQuasiQuote :: RdrName -> SrcSpan -> FastString -> HsSplice GhcPs
mkHsQuasiQuote :: RdrName -> SrcSpan -> FastString -> HsSplice GhcPs
mkHsQuasiQuote RdrName
quoter SrcSpan
span FastString
quote
= XQuasiQuote GhcPs
-> IdP GhcPs
-> IdP GhcPs
-> SrcSpan
-> FastString
-> HsSplice GhcPs
forall id.
XQuasiQuote id
-> IdP id -> IdP id -> SrcSpan -> FastString -> HsSplice id
HsQuasiQuote XQuasiQuote GhcPs
NoExtField
noExtField RdrName
IdP GhcPs
unqualSplice RdrName
IdP GhcPs
quoter SrcSpan
span FastString
quote
mkHsString :: String -> HsLit (GhcPass p)
mkHsString :: String -> HsLit (GhcPass p)
mkHsString String
s = XHsString (GhcPass p) -> FastString -> HsLit (GhcPass p)
forall x. XHsString x -> FastString -> HsLit x
HsString SourceText
XHsString (GhcPass p)
NoSourceText (String -> FastString
mkFastString String
s)
mkHsStringPrimLit :: FastString -> HsLit (GhcPass p)
mkHsStringPrimLit :: FastString -> HsLit (GhcPass p)
mkHsStringPrimLit FastString
fs = XHsStringPrim (GhcPass p) -> ByteString -> HsLit (GhcPass p)
forall x. XHsStringPrim x -> ByteString -> HsLit x
HsStringPrim SourceText
XHsStringPrim (GhcPass p)
NoSourceText (FastString -> ByteString
bytesFS FastString
fs)
nlHsVar :: IdP (GhcPass id) -> LHsExpr (GhcPass id)
nlHsVar :: IdP (GhcPass id) -> LHsExpr (GhcPass id)
nlHsVar IdP (GhcPass id)
n = HsExpr (GhcPass id) -> LHsExpr (GhcPass id)
forall e. e -> Located e
noLoc (XVar (GhcPass id)
-> Located (IdP (GhcPass id)) -> HsExpr (GhcPass id)
forall p. XVar p -> Located (IdP p) -> HsExpr p
HsVar XVar (GhcPass id)
NoExtField
noExtField (IdGhcP id -> Located (IdGhcP id)
forall e. e -> Located e
noLoc IdGhcP id
IdP (GhcPass id)
n))
nl_HsVar :: IdP (GhcPass id) -> HsExpr (GhcPass id)
nl_HsVar :: IdP (GhcPass id) -> HsExpr (GhcPass id)
nl_HsVar IdP (GhcPass id)
n = XVar (GhcPass id)
-> Located (IdP (GhcPass id)) -> HsExpr (GhcPass id)
forall p. XVar p -> Located (IdP p) -> HsExpr p
HsVar XVar (GhcPass id)
NoExtField
noExtField (IdGhcP id -> Located (IdGhcP id)
forall e. e -> Located e
noLoc IdGhcP id
IdP (GhcPass id)
n)
nlHsDataCon :: DataCon -> LHsExpr GhcTc
nlHsDataCon :: DataCon -> LHsExpr GhcTc
nlHsDataCon DataCon
con = HsExpr GhcTc -> LHsExpr GhcTc
forall e. e -> Located e
noLoc (XConLikeOut GhcTc -> ConLike -> HsExpr GhcTc
forall p. XConLikeOut p -> ConLike -> HsExpr p
HsConLikeOut XConLikeOut GhcTc
NoExtField
noExtField (DataCon -> ConLike
RealDataCon DataCon
con))
nlHsLit :: HsLit (GhcPass p) -> LHsExpr (GhcPass p)
nlHsLit :: HsLit (GhcPass p) -> LHsExpr (GhcPass p)
nlHsLit HsLit (GhcPass p)
n = HsExpr (GhcPass p) -> LHsExpr (GhcPass p)
forall e. e -> Located e
noLoc (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 :: Integer -> LHsExpr (GhcPass p)
nlHsIntLit Integer
n = HsExpr (GhcPass p) -> LHsExpr (GhcPass p)
forall e. e -> Located e
noLoc (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
External instance of the constraint type Integral Integer
mkIntegralLit Integer
n)))
nlVarPat :: IdP (GhcPass id) -> LPat (GhcPass id)
nlVarPat :: IdP (GhcPass id) -> LPat (GhcPass id)
nlVarPat IdP (GhcPass id)
n = Pat (GhcPass id) -> Located (Pat (GhcPass id))
forall e. e -> Located e
noLoc (XVarPat (GhcPass id)
-> Located (IdP (GhcPass id)) -> Pat (GhcPass id)
forall p. XVarPat p -> Located (IdP p) -> Pat p
VarPat XVarPat (GhcPass id)
NoExtField
noExtField (IdGhcP id -> Located (IdGhcP id)
forall e. e -> Located e
noLoc IdGhcP id
IdP (GhcPass id)
n))
nlLitPat :: HsLit GhcPs -> LPat GhcPs
nlLitPat :: HsLit GhcPs -> LPat GhcPs
nlLitPat HsLit GhcPs
l = Pat GhcPs -> Located (Pat GhcPs)
forall e. e -> Located e
noLoc (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 :: LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsApp LHsExpr (GhcPass id)
f LHsExpr (GhcPass id)
x = HsExpr (GhcPass id) -> LHsExpr (GhcPass id)
forall e. e -> Located e
noLoc (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 (id :: Pass).
IsPass id =>
LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
Evidence bound by a type signature of the constraint type IsPass id
mkLHsPar LHsExpr (GhcPass id)
x))
nlHsSyntaxApps :: SyntaxExprTc -> [LHsExpr GhcTc]
-> LHsExpr GhcTc
nlHsSyntaxApps :: SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsSyntaxApps (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 ((LHsExpr GhcTc -> LHsExpr GhcTc -> LHsExpr GhcTc)
-> LHsExpr GhcTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldl' LHsExpr GhcTc -> LHsExpr GhcTc -> LHsExpr GhcTc
forall (id :: Pass).
IsPass id =>
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
External instance of the constraint type IsPass 'Typechecked
nlHsApp (HsExpr GhcTc -> LHsExpr GhcTc
forall e. e -> Located e
noLoc HsExpr GhcTc
fun) (String
-> (HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc)
-> [HsWrapper]
-> [LHsExpr GhcTc]
-> [LHsExpr GhcTc]
forall a b c. String -> (a -> b -> c) -> [a] -> [b] -> [c]
zipWithEqual String
"nlHsSyntaxApps"
HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap [HsWrapper]
arg_wraps [LHsExpr GhcTc]
args))
nlHsSyntaxApps SyntaxExprTc
NoSyntaxExprTc [LHsExpr GhcTc]
args = String -> SDoc -> LHsExpr GhcTc
forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"nlHsSyntaxApps" ([LHsExpr GhcTc] -> SDoc
forall a. Outputable a => a -> SDoc
External instance of the constraint type forall a. Outputable a => Outputable [a]
External instance of the constraint type forall l e.
(Outputable l, Outputable e) =>
Outputable (GenLocated l e)
External instance of the constraint type Outputable SrcSpan
External instance of the constraint type forall (p :: Pass).
OutputableBndrId p =>
Outputable (HsExpr (GhcPass p))
External instance of the constraint type OutputableBndr TyVar
External instance of the constraint type OutputableBndr Name
External instance of the constraint type IsPass 'Typechecked
ppr [LHsExpr GhcTc]
args)
nlHsApps :: IsPass id => IdP (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
nlHsApps :: IdP (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
nlHsApps IdP (GhcPass id)
f [LHsExpr (GhcPass id)]
xs = (LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id))
-> LHsExpr (GhcPass id)
-> [LHsExpr (GhcPass id)]
-> LHsExpr (GhcPass id)
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldl' LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
forall (id :: Pass).
IsPass id =>
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
Evidence bound by a type signature of the constraint type IsPass id
nlHsApp (IdP (GhcPass id) -> LHsExpr (GhcPass id)
forall (id :: Pass). IdP (GhcPass id) -> LHsExpr (GhcPass id)
nlHsVar IdP (GhcPass id)
f) [LHsExpr (GhcPass id)]
xs
nlHsVarApps :: IdP (GhcPass id) -> [IdP (GhcPass id)] -> LHsExpr (GhcPass id)
nlHsVarApps :: IdP (GhcPass id) -> [IdP (GhcPass id)] -> LHsExpr (GhcPass id)
nlHsVarApps IdP (GhcPass id)
f [IdP (GhcPass id)]
xs = HsExpr (GhcPass id) -> LHsExpr (GhcPass id)
forall e. e -> Located e
noLoc ((HsExpr (GhcPass id) -> HsExpr (GhcPass id) -> HsExpr (GhcPass id))
-> HsExpr (GhcPass id)
-> [HsExpr (GhcPass id)]
-> HsExpr (GhcPass id)
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldl' HsExpr (GhcPass id) -> HsExpr (GhcPass id) -> HsExpr (GhcPass id)
forall {p}.
(XApp p ~ NoExtField) =>
HsExpr p -> HsExpr p -> HsExpr p
mk (XVar (GhcPass id)
-> Located (IdP (GhcPass id)) -> HsExpr (GhcPass id)
forall p. XVar p -> Located (IdP p) -> HsExpr p
HsVar XVar (GhcPass id)
NoExtField
noExtField (IdGhcP id -> Located (IdGhcP id)
forall e. e -> Located e
noLoc IdGhcP id
IdP (GhcPass id)
f))
((IdGhcP id -> HsExpr (GhcPass id))
-> [IdGhcP id] -> [HsExpr (GhcPass id)]
forall a b. (a -> b) -> [a] -> [b]
map ((XVar (GhcPass id)
-> Located (IdP (GhcPass id)) -> HsExpr (GhcPass id)
forall p. XVar p -> Located (IdP p) -> HsExpr p
HsVar XVar (GhcPass id)
NoExtField
noExtField) (Located (IdGhcP id) -> HsExpr (GhcPass id))
-> (IdGhcP id -> Located (IdGhcP id))
-> IdGhcP id
-> HsExpr (GhcPass id)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IdGhcP id -> Located (IdGhcP id)
forall e. e -> Located e
noLoc) [IdGhcP id]
[IdP (GhcPass id)]
xs))
where
mk :: HsExpr p -> HsExpr p -> HsExpr p
mk HsExpr p
f HsExpr p
a = XApp p -> LHsExpr p -> LHsExpr p -> HsExpr p
forall p. XApp p -> LHsExpr p -> LHsExpr p -> HsExpr p
HsApp XApp p
NoExtField
noExtField (HsExpr p -> LHsExpr p
forall e. e -> Located e
noLoc HsExpr p
f) (HsExpr p -> LHsExpr p
forall e. e -> Located e
noLoc 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 -> Located (Pat GhcPs))
-> [RdrName] -> [Located (Pat GhcPs)]
forall a b. (a -> b) -> [a] -> [b]
map RdrName -> Located (Pat GhcPs)
forall (id :: Pass). IdP (GhcPass id) -> LPat (GhcPass id)
nlVarPat [RdrName]
vars)
nlConVarPatName :: Name -> [Name] -> LPat GhcRn
nlConVarPatName :: Name -> [Name] -> LPat GhcRn
nlConVarPatName Name
con [Name]
vars = Name -> [LPat GhcRn] -> LPat GhcRn
nlConPatName Name
con ((Name -> Located (Pat GhcRn)) -> [Name] -> [Located (Pat GhcRn)]
forall a b. (a -> b) -> [a] -> [b]
map Name -> Located (Pat GhcRn)
forall (id :: Pass). IdP (GhcPass id) -> LPat (GhcPass id)
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 -> Located (Pat GhcPs)
forall e. e -> Located e
noLoc (Pat GhcPs -> Located (Pat GhcPs))
-> Pat GhcPs -> Located (Pat GhcPs)
forall a b. (a -> b) -> a -> b
$ ConPat :: forall p.
XConPat p -> Located (ConLikeP p) -> HsConPatDetails p -> Pat p
ConPat
{ pat_con :: Located (ConLikeP GhcPs)
pat_con = RdrName -> Located RdrName
forall e. e -> Located e
noLoc RdrName
con
, pat_args :: HsConPatDetails GhcPs
pat_args = Located (Pat GhcPs)
-> Located (Pat GhcPs)
-> HsConDetails
(Located (Pat GhcPs)) (HsRecFields GhcPs (Located (Pat GhcPs)))
forall arg rec. arg -> arg -> HsConDetails arg rec
InfixCon (PprPrec -> LPat GhcPs -> LPat GhcPs
forall (p :: Pass).
IsPass p =>
PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
External instance of the constraint type IsPass 'Parsed
parenthesizePat PprPrec
opPrec LPat GhcPs
l)
(PprPrec -> LPat GhcPs -> LPat GhcPs
forall (p :: Pass).
IsPass p =>
PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
External instance of the constraint type IsPass 'Parsed
parenthesizePat PprPrec
opPrec LPat GhcPs
r)
, pat_con_ext :: XConPat GhcPs
pat_con_ext = XConPat GhcPs
NoExtField
noExtField
}
nlConPat :: RdrName -> [LPat GhcPs] -> LPat GhcPs
nlConPat :: RdrName -> [LPat GhcPs] -> LPat GhcPs
nlConPat RdrName
con [LPat GhcPs]
pats = Pat GhcPs -> Located (Pat GhcPs)
forall e. e -> Located e
noLoc (Pat GhcPs -> Located (Pat GhcPs))
-> Pat GhcPs -> Located (Pat GhcPs)
forall a b. (a -> b) -> a -> b
$ ConPat :: forall p.
XConPat p -> Located (ConLikeP p) -> HsConPatDetails p -> Pat p
ConPat
{ pat_con_ext :: XConPat GhcPs
pat_con_ext = XConPat GhcPs
NoExtField
noExtField
, pat_con :: Located (ConLikeP GhcPs)
pat_con = RdrName -> Located RdrName
forall e. e -> Located e
noLoc RdrName
con
, pat_args :: HsConPatDetails GhcPs
pat_args = [Located (Pat GhcPs)]
-> HsConDetails
(Located (Pat GhcPs)) (HsRecFields GhcPs (Located (Pat GhcPs)))
forall arg rec. [arg] -> HsConDetails arg rec
PrefixCon ((Located (Pat GhcPs) -> Located (Pat GhcPs))
-> [Located (Pat GhcPs)] -> [Located (Pat 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)
External instance of the constraint type IsPass 'Parsed
parenthesizePat PprPrec
appPrec) [Located (Pat GhcPs)]
[LPat GhcPs]
pats)
}
nlConPatName :: Name -> [LPat GhcRn] -> LPat GhcRn
nlConPatName :: Name -> [LPat GhcRn] -> LPat GhcRn
nlConPatName Name
con [LPat GhcRn]
pats = Pat GhcRn -> Located (Pat GhcRn)
forall e. e -> Located e
noLoc (Pat GhcRn -> Located (Pat GhcRn))
-> Pat GhcRn -> Located (Pat GhcRn)
forall a b. (a -> b) -> a -> b
$ ConPat :: forall p.
XConPat p -> Located (ConLikeP p) -> HsConPatDetails p -> Pat p
ConPat
{ pat_con_ext :: XConPat GhcRn
pat_con_ext = XConPat GhcRn
NoExtField
noExtField
, pat_con :: Located (ConLikeP GhcRn)
pat_con = Name -> Located Name
forall e. e -> Located e
noLoc Name
con
, pat_args :: HsConPatDetails GhcRn
pat_args = [Located (Pat GhcRn)]
-> HsConDetails
(Located (Pat GhcRn)) (HsRecFields GhcRn (Located (Pat GhcRn)))
forall arg rec. [arg] -> HsConDetails arg rec
PrefixCon ((Located (Pat GhcRn) -> Located (Pat GhcRn))
-> [Located (Pat GhcRn)] -> [Located (Pat GhcRn)]
forall a b. (a -> b) -> [a] -> [b]
map (PprPrec -> LPat GhcRn -> LPat GhcRn
forall (p :: Pass).
IsPass p =>
PprPrec -> LPat (GhcPass p) -> LPat (GhcPass p)
External instance of the constraint type IsPass 'Renamed
parenthesizePat PprPrec
appPrec) [Located (Pat GhcRn)]
[LPat GhcRn]
pats)
}
nlNullaryConPat :: RdrName -> LPat GhcPs
nlNullaryConPat :: RdrName -> LPat GhcPs
nlNullaryConPat RdrName
con = Pat GhcPs -> Located (Pat GhcPs)
forall e. e -> Located e
noLoc (Pat GhcPs -> Located (Pat GhcPs))
-> Pat GhcPs -> Located (Pat GhcPs)
forall a b. (a -> b) -> a -> b
$ ConPat :: forall p.
XConPat p -> Located (ConLikeP p) -> HsConPatDetails p -> Pat p
ConPat
{ pat_con_ext :: XConPat GhcPs
pat_con_ext = XConPat GhcPs
NoExtField
noExtField
, pat_con :: Located (ConLikeP GhcPs)
pat_con = RdrName -> Located RdrName
forall e. e -> Located e
noLoc RdrName
con
, pat_args :: HsConPatDetails GhcPs
pat_args = [Located (Pat GhcPs)]
-> HsConDetails
(Located (Pat GhcPs)) (HsRecFields GhcPs (Located (Pat GhcPs)))
forall arg rec. [arg] -> HsConDetails arg rec
PrefixCon []
}
nlWildConPat :: DataCon -> LPat GhcPs
nlWildConPat :: DataCon -> LPat GhcPs
nlWildConPat DataCon
con = Pat GhcPs -> Located (Pat GhcPs)
forall e. e -> Located e
noLoc (Pat GhcPs -> Located (Pat GhcPs))
-> Pat GhcPs -> Located (Pat GhcPs)
forall a b. (a -> b) -> a -> b
$ ConPat :: forall p.
XConPat p -> Located (ConLikeP p) -> HsConPatDetails p -> Pat p
ConPat
{ pat_con_ext :: XConPat GhcPs
pat_con_ext = XConPat GhcPs
NoExtField
noExtField
, pat_con :: Located (ConLikeP GhcPs)
pat_con = RdrName -> Located RdrName
forall e. e -> Located e
noLoc (RdrName -> Located RdrName) -> RdrName -> Located RdrName
forall a b. (a -> b) -> a -> b
$ DataCon -> RdrName
forall thing. NamedThing thing => thing -> RdrName
External instance of the constraint type NamedThing DataCon
getRdrName DataCon
con
, pat_args :: HsConPatDetails GhcPs
pat_args = [Located (Pat GhcPs)]
-> HsConDetails
(Located (Pat GhcPs)) (HsRecFields GhcPs (Located (Pat GhcPs)))
forall arg rec. [arg] -> HsConDetails arg rec
PrefixCon ([Located (Pat GhcPs)]
-> HsConDetails
(Located (Pat GhcPs)) (HsRecFields GhcPs (Located (Pat GhcPs))))
-> [Located (Pat GhcPs)]
-> HsConDetails
(Located (Pat GhcPs)) (HsRecFields GhcPs (Located (Pat GhcPs)))
forall a b. (a -> b) -> a -> b
$
Int -> Located (Pat GhcPs) -> [Located (Pat GhcPs)]
forall a. Int -> a -> [a]
replicate (DataCon -> Int
dataConSourceArity DataCon
con)
Located (Pat GhcPs)
LPat GhcPs
nlWildPat
}
nlWildPat :: LPat GhcPs
nlWildPat :: LPat GhcPs
nlWildPat = Pat GhcPs -> Located (Pat GhcPs)
forall e. e -> Located e
noLoc (XWildPat GhcPs -> Pat GhcPs
forall p. XWildPat p -> Pat p
WildPat XWildPat GhcPs
NoExtField
noExtField )
nlWildPatName :: LPat GhcRn
nlWildPatName :: LPat GhcRn
nlWildPatName = Pat GhcRn -> Located (Pat GhcRn)
forall e. e -> Located e
noLoc (XWildPat GhcRn -> Pat GhcRn
forall p. XWildPat p -> Pat p
WildPat XWildPat GhcRn
NoExtField
noExtField )
nlHsDo :: HsStmtContext GhcRn -> [LStmt GhcPs (LHsExpr GhcPs)]
-> LHsExpr GhcPs
nlHsDo :: HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> Located (HsExpr GhcPs)
nlHsDo HsStmtContext GhcRn
ctxt [ExprLStmt GhcPs]
stmts = HsExpr GhcPs -> Located (HsExpr GhcPs)
forall e. e -> Located e
noLoc (HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> HsExpr GhcPs
mkHsDo HsStmtContext GhcRn
ctxt [ExprLStmt GhcPs]
stmts)
nlHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsOpApp :: Located (HsExpr GhcPs)
-> IdP GhcPs -> Located (HsExpr GhcPs) -> Located (HsExpr GhcPs)
nlHsOpApp Located (HsExpr GhcPs)
e1 IdP GhcPs
op Located (HsExpr GhcPs)
e2 = HsExpr GhcPs -> Located (HsExpr GhcPs)
forall e. e -> Located e
noLoc (Located (HsExpr GhcPs)
-> IdP GhcPs -> Located (HsExpr GhcPs) -> HsExpr GhcPs
mkHsOpApp Located (HsExpr GhcPs)
e1 IdP GhcPs
op Located (HsExpr GhcPs)
e2)
nlHsLam :: LMatch GhcPs (LHsExpr GhcPs) -> LHsExpr GhcPs
nlHsPar :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsCase :: LHsExpr GhcPs -> [LMatch GhcPs (LHsExpr GhcPs)]
-> LHsExpr GhcPs
nlList :: [LHsExpr GhcPs] -> LHsExpr GhcPs
nlHsLam :: LMatch GhcPs (Located (HsExpr GhcPs)) -> Located (HsExpr GhcPs)
nlHsLam LMatch GhcPs (Located (HsExpr GhcPs))
match = HsExpr GhcPs -> Located (HsExpr GhcPs)
forall e. e -> Located e
noLoc (XLam GhcPs
-> MatchGroup GhcPs (Located (HsExpr GhcPs)) -> HsExpr GhcPs
forall p. XLam p -> MatchGroup p (LHsExpr p) -> HsExpr p
HsLam XLam GhcPs
NoExtField
noExtField (Origin
-> [LMatch GhcPs (Located (HsExpr GhcPs))]
-> MatchGroup GhcPs (Located (HsExpr GhcPs))
forall name (body :: * -> *).
(XMG name (Located (body name)) ~ NoExtField) =>
Origin
-> [LMatch name (Located (body name))]
-> MatchGroup name (Located (body name))
mkMatchGroup Origin
Generated [LMatch GhcPs (Located (HsExpr GhcPs))
match]))
nlHsPar :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsPar LHsExpr (GhcPass id)
e = HsExpr (GhcPass id) -> LHsExpr (GhcPass id)
forall e. e -> Located e
noLoc (XPar (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id)
forall p. XPar p -> LHsExpr p -> HsExpr p
HsPar XPar (GhcPass id)
NoExtField
noExtField LHsExpr (GhcPass id)
e)
nlHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsIf :: Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
nlHsIf Located (HsExpr GhcPs)
cond Located (HsExpr GhcPs)
true Located (HsExpr GhcPs)
false = HsExpr GhcPs -> Located (HsExpr GhcPs)
forall e. e -> Located e
noLoc (XIf GhcPs
-> SyntaxExpr GhcPs
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> Located (HsExpr GhcPs)
-> HsExpr GhcPs
forall p.
XIf p
-> SyntaxExpr p -> LHsExpr p -> LHsExpr p -> LHsExpr p -> HsExpr p
HsIf Bool
XIf GhcPs
False SyntaxExpr GhcPs
forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p)
External instance of the constraint type IsPass 'Parsed
noSyntaxExpr Located (HsExpr GhcPs)
cond Located (HsExpr GhcPs)
true Located (HsExpr GhcPs)
false)
nlHsCase :: Located (HsExpr GhcPs)
-> [LMatch GhcPs (Located (HsExpr GhcPs))]
-> Located (HsExpr GhcPs)
nlHsCase Located (HsExpr GhcPs)
expr [LMatch GhcPs (Located (HsExpr GhcPs))]
matches
= HsExpr GhcPs -> Located (HsExpr GhcPs)
forall e. e -> Located e
noLoc (XCase GhcPs
-> Located (HsExpr GhcPs)
-> MatchGroup GhcPs (Located (HsExpr GhcPs))
-> HsExpr GhcPs
forall p.
XCase p -> LHsExpr p -> MatchGroup p (LHsExpr p) -> HsExpr p
HsCase XCase GhcPs
NoExtField
noExtField Located (HsExpr GhcPs)
expr (Origin
-> [LMatch GhcPs (Located (HsExpr GhcPs))]
-> MatchGroup GhcPs (Located (HsExpr GhcPs))
forall name (body :: * -> *).
(XMG name (Located (body name)) ~ NoExtField) =>
Origin
-> [LMatch name (Located (body name))]
-> MatchGroup name (Located (body name))
mkMatchGroup Origin
Generated [LMatch GhcPs (Located (HsExpr GhcPs))]
matches))
nlList :: [Located (HsExpr GhcPs)] -> Located (HsExpr GhcPs)
nlList [Located (HsExpr GhcPs)]
exprs = HsExpr GhcPs -> Located (HsExpr GhcPs)
forall e. e -> Located e
noLoc (XExplicitList GhcPs
-> Maybe (SyntaxExpr GhcPs)
-> [Located (HsExpr GhcPs)]
-> HsExpr GhcPs
forall p.
XExplicitList p -> Maybe (SyntaxExpr p) -> [LHsExpr p] -> HsExpr p
ExplicitList XExplicitList GhcPs
NoExtField
noExtField Maybe (SyntaxExpr GhcPs)
forall a. Maybe a
Nothing [Located (HsExpr GhcPs)]
exprs)
nlHsAppTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsTyVar :: IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsFunTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsParTy :: LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppTy LHsType (GhcPass p)
f LHsType (GhcPass p)
t = HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (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 (PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType PprPrec
appPrec LHsType (GhcPass p)
t))
nlHsTyVar :: IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsTyVar IdP (GhcPass p)
x = HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (XTyVar (GhcPass p)
-> PromotionFlag -> Located (IdP (GhcPass p)) -> HsType (GhcPass p)
forall pass.
XTyVar pass -> PromotionFlag -> Located (IdP pass) -> HsType pass
HsTyVar XTyVar (GhcPass p)
NoExtField
noExtField PromotionFlag
NotPromoted (IdGhcP p -> Located (IdGhcP p)
forall e. e -> Located e
noLoc IdGhcP p
IdP (GhcPass p)
x))
nlHsFunTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsFunTy LHsType (GhcPass p)
a LHsType (GhcPass p)
b = HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (XFunTy (GhcPass p)
-> LHsType (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass.
XFunTy pass -> LHsType pass -> LHsType pass -> HsType pass
HsFunTy XFunTy (GhcPass p)
NoExtField
noExtField (PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType PprPrec
funPrec LHsType (GhcPass p)
a) LHsType (GhcPass p)
b)
nlHsParTy :: LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsParTy LHsType (GhcPass p)
t = HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (XParTy (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass. XParTy pass -> LHsType pass -> HsType pass
HsParTy XParTy (GhcPass p)
NoExtField
noExtField LHsType (GhcPass p)
t)
nlHsTyConApp :: LexicalFixity -> IdP (GhcPass p)
-> [LHsTypeArg (GhcPass p)] -> LHsType (GhcPass p)
nlHsTyConApp :: LexicalFixity
-> IdP (GhcPass p)
-> [LHsTypeArg (GhcPass p)]
-> LHsType (GhcPass p)
nlHsTyConApp LexicalFixity
fixity IdP (GhcPass p)
tycon [LHsTypeArg (GhcPass p)]
tys
| LexicalFixity
Infix <- LexicalFixity
fixity
, HsValArg LHsType (GhcPass p)
ty1 : HsValArg LHsType (GhcPass p)
ty2 : [LHsTypeArg (GhcPass p)]
rest <- [LHsTypeArg (GhcPass p)]
tys
= (LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p))
-> LHsType (GhcPass p)
-> [LHsTypeArg (GhcPass p)]
-> LHsType (GhcPass p)
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldl' LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
mk_app (HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (HsType (GhcPass p) -> LHsType (GhcPass p))
-> HsType (GhcPass p) -> LHsType (GhcPass p)
forall a b. (a -> b) -> a -> b
$ XOpTy (GhcPass p)
-> LHsType (GhcPass p)
-> Located (IdP (GhcPass p))
-> LHsType (GhcPass p)
-> HsType (GhcPass p)
forall pass.
XOpTy pass
-> LHsType pass
-> Located (IdP pass)
-> LHsType pass
-> HsType pass
HsOpTy XOpTy (GhcPass p)
NoExtField
noExtField LHsType (GhcPass p)
ty1 (IdGhcP p -> Located (IdGhcP p)
forall e. e -> Located e
noLoc IdGhcP p
IdP (GhcPass p)
tycon) LHsType (GhcPass p)
ty2) [LHsTypeArg (GhcPass p)]
rest
| Bool
otherwise
= (LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p))
-> LHsType (GhcPass p)
-> [LHsTypeArg (GhcPass p)]
-> LHsType (GhcPass p)
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldl' LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
mk_app (IdP (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass). IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsTyVar IdP (GhcPass p)
tycon) [LHsTypeArg (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 SrcSpan
_ (HsOpTy {})) LHsTypeArg (GhcPass p)
arg = LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
LHsType (GhcPass p)
-> LHsTypeArg (GhcPass p) -> LHsType (GhcPass p)
mk_app (HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (HsType (GhcPass p) -> LHsType (GhcPass p))
-> HsType (GhcPass p) -> LHsType (GhcPass p)
forall a b. (a -> b) -> a -> b
$ XParTy (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass. XParTy pass -> LHsType pass -> HsType pass
HsParTy XParTy (GhcPass p)
NoExtField
noExtField LHsType (GhcPass p)
fun) LHsTypeArg (GhcPass p)
arg
mk_app LHsType (GhcPass p)
fun (HsValArg LHsType (GhcPass p)
ty) = HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (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)
fun (PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType PprPrec
appPrec LHsType (GhcPass p)
ty))
mk_app LHsType (GhcPass p)
fun (HsTypeArg SrcSpan
_ LHsType (GhcPass p)
ki) = HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (XAppKindTy (GhcPass p)
-> LHsType (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass.
XAppKindTy pass -> LHsType pass -> LHsType pass -> HsType pass
HsAppKindTy SrcSpan
XAppKindTy (GhcPass p)
noSrcSpan LHsType (GhcPass p)
fun (PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType PprPrec
appPrec LHsType (GhcPass p)
ki))
mk_app LHsType (GhcPass p)
fun (HsArgPar SrcSpan
_) = HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (XParTy (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass. XParTy pass -> LHsType pass -> HsType pass
HsParTy XParTy (GhcPass p)
NoExtField
noExtField LHsType (GhcPass p)
fun)
nlHsAppKindTy ::
LHsType (GhcPass p) -> LHsKind (GhcPass p) -> LHsType (GhcPass p)
nlHsAppKindTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppKindTy LHsType (GhcPass p)
f LHsType (GhcPass p)
k
= HsType (GhcPass p) -> LHsType (GhcPass p)
forall e. e -> Located e
noLoc (XAppKindTy (GhcPass p)
-> LHsType (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass.
XAppKindTy pass -> LHsType pass -> LHsType pass -> HsType pass
HsAppKindTy SrcSpan
XAppKindTy (GhcPass p)
noSrcSpan LHsType (GhcPass p)
f (PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType PprPrec
appPrec LHsType (GhcPass p)
k))
mkLHsTupleExpr :: [LHsExpr (GhcPass a)] -> LHsExpr (GhcPass a)
mkLHsTupleExpr :: [LHsExpr (GhcPass a)] -> LHsExpr (GhcPass a)
mkLHsTupleExpr [LHsExpr (GhcPass a)
e] = LHsExpr (GhcPass a)
e
mkLHsTupleExpr [LHsExpr (GhcPass a)]
es
= HsExpr (GhcPass a) -> LHsExpr (GhcPass a)
forall e. e -> Located e
noLoc (HsExpr (GhcPass a) -> LHsExpr (GhcPass a))
-> HsExpr (GhcPass a) -> LHsExpr (GhcPass a)
forall a b. (a -> b) -> a -> b
$ XExplicitTuple (GhcPass a)
-> [LHsTupArg (GhcPass a)] -> Boxity -> HsExpr (GhcPass a)
forall p. XExplicitTuple p -> [LHsTupArg p] -> Boxity -> HsExpr p
ExplicitTuple XExplicitTuple (GhcPass a)
NoExtField
noExtField ((LHsExpr (GhcPass a) -> LHsTupArg (GhcPass a))
-> [LHsExpr (GhcPass a)] -> [LHsTupArg (GhcPass a)]
forall a b. (a -> b) -> [a] -> [b]
map (HsTupArg (GhcPass a) -> LHsTupArg (GhcPass a)
forall e. e -> Located e
noLoc (HsTupArg (GhcPass a) -> LHsTupArg (GhcPass a))
-> (LHsExpr (GhcPass a) -> HsTupArg (GhcPass a))
-> LHsExpr (GhcPass a)
-> LHsTupArg (GhcPass a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (XPresent (GhcPass a) -> LHsExpr (GhcPass a) -> HsTupArg (GhcPass a)
forall id. XPresent id -> LHsExpr id -> HsTupArg id
Present XPresent (GhcPass a)
NoExtField
noExtField)) [LHsExpr (GhcPass a)]
es) Boxity
Boxed
mkLHsVarTuple :: [IdP (GhcPass a)] -> LHsExpr (GhcPass a)
mkLHsVarTuple :: [IdP (GhcPass a)] -> LHsExpr (GhcPass a)
mkLHsVarTuple [IdP (GhcPass a)]
ids = [LHsExpr (GhcPass a)] -> LHsExpr (GhcPass a)
forall (a :: Pass). [LHsExpr (GhcPass a)] -> LHsExpr (GhcPass a)
mkLHsTupleExpr ((IdGhcP a -> LHsExpr (GhcPass a))
-> [IdGhcP a] -> [LHsExpr (GhcPass a)]
forall a b. (a -> b) -> [a] -> [b]
map IdGhcP a -> LHsExpr (GhcPass a)
forall (id :: Pass). IdP (GhcPass id) -> LHsExpr (GhcPass id)
nlHsVar [IdGhcP a]
[IdP (GhcPass a)]
ids)
nlTuplePat :: [LPat GhcPs] -> Boxity -> LPat GhcPs
nlTuplePat :: [LPat GhcPs] -> Boxity -> LPat GhcPs
nlTuplePat [LPat GhcPs]
pats Boxity
box = Pat GhcPs -> Located (Pat GhcPs)
forall e. e -> Located e
noLoc (XTuplePat GhcPs -> [LPat GhcPs] -> Boxity -> Pat GhcPs
forall p. XTuplePat p -> [LPat p] -> Boxity -> Pat p
TuplePat XTuplePat GhcPs
NoExtField
noExtField [LPat GhcPs]
pats Boxity
box)
missingTupArg :: HsTupArg GhcPs
missingTupArg :: HsTupArg GhcPs
missingTupArg = XMissing GhcPs -> HsTupArg GhcPs
forall id. XMissing id -> HsTupArg id
Missing XMissing GhcPs
NoExtField
noExtField
mkLHsPatTup :: [LPat GhcRn] -> LPat GhcRn
mkLHsPatTup :: [LPat GhcRn] -> LPat GhcRn
mkLHsPatTup [] = Pat GhcRn -> Located (Pat GhcRn)
forall e. e -> Located e
noLoc (Pat GhcRn -> Located (Pat GhcRn))
-> Pat GhcRn -> Located (Pat GhcRn)
forall a b. (a -> b) -> a -> b
$ XTuplePat GhcRn -> [LPat GhcRn] -> Boxity -> Pat GhcRn
forall p. XTuplePat p -> [LPat p] -> Boxity -> Pat p
TuplePat XTuplePat GhcRn
NoExtField
noExtField [] Boxity
Boxed
mkLHsPatTup [LPat GhcRn
lpat] = LPat GhcRn
lpat
mkLHsPatTup [LPat GhcRn]
lpats = SrcSpan -> Pat GhcRn -> Located (Pat GhcRn)
forall l e. l -> e -> GenLocated l e
L (Located (Pat GhcRn) -> SrcSpan
forall l e. GenLocated l e -> l
getLoc ([Located (Pat GhcRn)] -> Located (Pat GhcRn)
forall a. [a] -> a
head [Located (Pat GhcRn)]
[LPat GhcRn]
lpats)) (Pat GhcRn -> Located (Pat GhcRn))
-> Pat GhcRn -> Located (Pat GhcRn)
forall a b. (a -> b) -> a -> b
$ XTuplePat GhcRn -> [LPat GhcRn] -> Boxity -> Pat GhcRn
forall p. XTuplePat p -> [LPat p] -> Boxity -> Pat p
TuplePat XTuplePat GhcRn
NoExtField
noExtField [LPat GhcRn]
lpats Boxity
Boxed
mkBigLHsVarTup :: [IdP (GhcPass id)] -> LHsExpr (GhcPass id)
mkBigLHsVarTup :: [IdP (GhcPass id)] -> LHsExpr (GhcPass id)
mkBigLHsVarTup [IdP (GhcPass id)]
ids = [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
forall (a :: Pass). [LHsExpr (GhcPass a)] -> LHsExpr (GhcPass a)
mkBigLHsTup ((IdGhcP id -> LHsExpr (GhcPass id))
-> [IdGhcP id] -> [LHsExpr (GhcPass id)]
forall a b. (a -> b) -> [a] -> [b]
map IdGhcP id -> LHsExpr (GhcPass id)
forall (id :: Pass). IdP (GhcPass id) -> LHsExpr (GhcPass id)
nlHsVar [IdGhcP id]
[IdP (GhcPass id)]
ids)
mkBigLHsTup :: [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
mkBigLHsTup :: [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
mkBigLHsTup = ([LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id))
-> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
forall a. ([a] -> a) -> [a] -> a
mkChunkified [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
forall (a :: Pass). [LHsExpr (GhcPass a)] -> LHsExpr (GhcPass a)
mkLHsTupleExpr
mkBigLHsVarPatTup :: [IdP GhcRn] -> LPat GhcRn
mkBigLHsVarPatTup :: [IdP GhcRn] -> LPat GhcRn
mkBigLHsVarPatTup [IdP GhcRn]
bs = [LPat GhcRn] -> LPat GhcRn
mkBigLHsPatTup ((Name -> Located (Pat GhcRn)) -> [Name] -> [Located (Pat GhcRn)]
forall a b. (a -> b) -> [a] -> [b]
map Name -> Located (Pat GhcRn)
forall (id :: Pass). IdP (GhcPass id) -> LPat (GhcPass id)
nlVarPat [Name]
[IdP GhcRn]
bs)
mkBigLHsPatTup :: [LPat GhcRn] -> LPat GhcRn
mkBigLHsPatTup :: [LPat GhcRn] -> LPat GhcRn
mkBigLHsPatTup = ([Located (Pat GhcRn)] -> Located (Pat GhcRn))
-> [Located (Pat GhcRn)] -> Located (Pat GhcRn)
forall a. ([a] -> a) -> [a] -> a
mkChunkified [Located (Pat GhcRn)] -> Located (Pat GhcRn)
[LPat GhcRn] -> LPat GhcRn
mkLHsPatTup
mkChunkified :: ([a] -> a)
-> [a]
-> a
mkChunkified :: ([a] -> a) -> [a] -> a
mkChunkified [a] -> a
small_tuple [a]
as = [[a]] -> a
mk_big_tuple ([a] -> [[a]]
forall a. [a] -> [[a]]
chunkify [a]
as)
where
mk_big_tuple :: [[a]] -> a
mk_big_tuple [[a]
as] = [a] -> a
small_tuple [a]
as
mk_big_tuple [[a]]
as_s = [[a]] -> a
mk_big_tuple ([a] -> [[a]]
forall a. [a] -> [[a]]
chunkify (([a] -> a) -> [[a]] -> [a]
forall a b. (a -> b) -> [a] -> [b]
map [a] -> a
small_tuple [[a]]
as_s))
chunkify :: [a] -> [[a]]
chunkify :: [a] -> [[a]]
chunkify [a]
xs
| Int
n_xs Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
External instance of the constraint type Ord Int
<= Int
mAX_TUPLE_SIZE = [[a]
xs]
| Bool
otherwise = [a] -> [[a]]
forall a. [a] -> [[a]]
split [a]
xs
where
n_xs :: Int
n_xs = [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
External instance of the constraint type Foldable []
length [a]
xs
split :: [a] -> [[a]]
split [] = []
split [a]
xs = Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
take Int
mAX_TUPLE_SIZE [a]
xs [a] -> [[a]] -> [[a]]
forall a. a -> [a] -> [a]
: [a] -> [[a]]
split (Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
drop Int
mAX_TUPLE_SIZE [a]
xs)
mkLHsSigType :: LHsType GhcPs -> LHsSigType GhcPs
mkLHsSigType :: LHsType GhcPs -> LHsSigType GhcPs
mkLHsSigType LHsType GhcPs
ty = LHsType GhcPs -> LHsSigType GhcPs
forall thing. thing -> HsImplicitBndrs GhcPs thing
mkHsImplicitBndrs LHsType GhcPs
ty
mkLHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs
mkLHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs
mkLHsSigWcType LHsType GhcPs
ty = LHsSigType GhcPs -> LHsSigWcType GhcPs
forall thing. thing -> HsWildCardBndrs GhcPs thing
mkHsWildCardBndrs (LHsType GhcPs -> LHsSigType GhcPs
forall thing. thing -> HsImplicitBndrs GhcPs thing
mkHsImplicitBndrs LHsType GhcPs
ty)
mkHsSigEnv :: forall a. (LSig GhcRn -> Maybe ([Located Name], a))
-> [LSig GhcRn]
-> NameEnv a
mkHsSigEnv :: (LSig GhcRn -> Maybe ([Located Name], a))
-> [LSig GhcRn] -> NameEnv a
mkHsSigEnv LSig GhcRn -> Maybe ([Located Name], a)
get_info [LSig GhcRn]
sigs
= [(Name, a)] -> NameEnv a
forall a. [(Name, a)] -> NameEnv a
mkNameEnv ([LSig GhcRn] -> [(Name, a)]
mk_pairs [LSig GhcRn]
ordinary_sigs)
NameEnv a -> [(Name, a)] -> NameEnv a
forall a. NameEnv a -> [(Name, a)] -> NameEnv a
`extendNameEnvList` ([LSig GhcRn] -> [(Name, a)]
mk_pairs [LSig GhcRn]
gen_dm_sigs)
where
([LSig GhcRn]
gen_dm_sigs, [LSig GhcRn]
ordinary_sigs) = (LSig GhcRn -> Bool)
-> [LSig GhcRn] -> ([LSig GhcRn], [LSig GhcRn])
forall a. (a -> Bool) -> [a] -> ([a], [a])
partition LSig GhcRn -> Bool
forall {l} {pass}. GenLocated l (Sig pass) -> Bool
is_gen_dm_sig [LSig GhcRn]
sigs
is_gen_dm_sig :: GenLocated l (Sig pass) -> Bool
is_gen_dm_sig (L l
_ (ClassOpSig XClassOpSig pass
_ Bool
True [Located (IdP pass)]
_ LHsSigType pass
_)) = Bool
True
is_gen_dm_sig GenLocated l (Sig pass)
_ = Bool
False
mk_pairs :: [LSig GhcRn] -> [(Name, a)]
mk_pairs :: [LSig GhcRn] -> [(Name, a)]
mk_pairs [LSig GhcRn]
sigs = [ (Name
n,a
a) | Just ([Located Name]
ns,a
a) <- (LSig GhcRn -> Maybe ([Located Name], a))
-> [LSig GhcRn] -> [Maybe ([Located Name], a)]
forall a b. (a -> b) -> [a] -> [b]
map LSig GhcRn -> Maybe ([Located Name], a)
get_info [LSig GhcRn]
sigs
, L SrcSpan
_ Name
n <- [Located Name]
ns ]
mkClassOpSigs :: [LSig GhcPs] -> [LSig GhcPs]
mkClassOpSigs :: [LSig GhcPs] -> [LSig GhcPs]
mkClassOpSigs [LSig GhcPs]
sigs
= (LSig GhcPs -> LSig GhcPs) -> [LSig GhcPs] -> [LSig GhcPs]
forall a b. (a -> b) -> [a] -> [b]
map LSig GhcPs -> LSig GhcPs
forall {pass} {l}.
(XClassOpSig pass ~ NoExtField) =>
GenLocated l (Sig pass) -> GenLocated l (Sig pass)
fiddle [LSig GhcPs]
sigs
where
fiddle :: GenLocated l (Sig pass) -> GenLocated l (Sig pass)
fiddle (L l
loc (TypeSig XTypeSig pass
_ [Located (IdP 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 -> [Located (IdP pass)] -> LHsSigType pass -> Sig pass
forall pass.
XClassOpSig pass
-> Bool -> [Located (IdP pass)] -> LHsSigType pass -> Sig pass
ClassOpSig XClassOpSig pass
NoExtField
noExtField Bool
False [Located (IdP 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
typeToLHsType :: Type -> LHsType GhcPs
typeToLHsType :: Type -> LHsType GhcPs
typeToLHsType Type
ty
= Type -> LHsType GhcPs
go Type
ty
where
go :: Type -> LHsType GhcPs
go :: Type -> LHsType GhcPs
go ty :: Type
ty@(FunTy { ft_af :: Type -> AnonArgFlag
ft_af = AnonArgFlag
af, ft_arg :: Type -> Type
ft_arg = Type
arg, ft_res :: Type -> Type
ft_res = Type
res })
= case AnonArgFlag
af of
AnonArgFlag
VisArg -> LHsType GhcPs -> LHsType GhcPs -> LHsType GhcPs
forall (p :: Pass).
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsFunTy (Type -> LHsType GhcPs
go Type
arg) (Type -> LHsType GhcPs
go Type
res)
AnonArgFlag
InvisArg | ([Type]
theta, Type
tau) <- Type -> ([Type], Type)
tcSplitPhiTy Type
ty
-> HsType GhcPs -> LHsType GhcPs
forall e. e -> Located e
noLoc (HsQualTy :: forall pass.
XQualTy pass -> LHsContext pass -> LHsType pass -> HsType pass
HsQualTy { hst_ctxt :: LHsContext GhcPs
hst_ctxt = [LHsType GhcPs] -> LHsContext GhcPs
forall e. e -> Located e
noLoc ((Type -> LHsType GhcPs) -> [Type] -> [LHsType GhcPs]
forall a b. (a -> b) -> [a] -> [b]
map Type -> LHsType GhcPs
go [Type]
theta)
, hst_xqual :: XQualTy GhcPs
hst_xqual = XQualTy GhcPs
NoExtField
noExtField
, hst_body :: LHsType GhcPs
hst_body = Type -> LHsType GhcPs
go Type
tau })
go ty :: Type
ty@(ForAllTy (Bndr TyVar
_ ArgFlag
argf) Type
_)
| ([VarBndr TyVar ArgFlag]
tvs, Type
tau) <- ArgFlag -> Type -> ([VarBndr TyVar ArgFlag], Type)
tcSplitForAllTysSameVis ArgFlag
argf Type
ty
= HsType GhcPs -> LHsType GhcPs
forall e. e -> Located e
noLoc (HsForAllTy :: forall pass.
XForAllTy pass
-> ForallVisFlag
-> [LHsTyVarBndr Specificity pass]
-> LHsType pass
-> HsType pass
HsForAllTy { hst_fvf :: ForallVisFlag
hst_fvf = ArgFlag -> ForallVisFlag
argToForallVisFlag ArgFlag
argf
, hst_bndrs :: [LHsTyVarBndr Specificity GhcPs]
hst_bndrs = (VarBndr TyVar ArgFlag -> LHsTyVarBndr Specificity GhcPs)
-> [VarBndr TyVar ArgFlag] -> [LHsTyVarBndr Specificity GhcPs]
forall a b. (a -> b) -> [a] -> [b]
map VarBndr TyVar ArgFlag -> LHsTyVarBndr Specificity GhcPs
go_tv [VarBndr TyVar ArgFlag]
tvs
, hst_xforall :: XForAllTy GhcPs
hst_xforall = XForAllTy GhcPs
NoExtField
noExtField
, hst_body :: LHsType GhcPs
hst_body = Type -> LHsType GhcPs
go Type
tau })
go (TyVarTy TyVar
tv) = IdP GhcPs -> LHsType GhcPs
forall (p :: Pass). IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsTyVar (TyVar -> RdrName
forall thing. NamedThing thing => thing -> RdrName
External instance of the constraint type NamedThing TyVar
getRdrName TyVar
tv)
go (LitTy (NumTyLit Integer
n))
= HsType GhcPs -> LHsType GhcPs
forall e. e -> Located e
noLoc (HsType GhcPs -> LHsType GhcPs) -> HsType GhcPs -> LHsType GhcPs
forall a b. (a -> b) -> a -> b
$ XTyLit GhcPs -> HsTyLit -> HsType GhcPs
forall pass. XTyLit pass -> HsTyLit -> HsType pass
HsTyLit XTyLit GhcPs
NoExtField
noExtField (SourceText -> Integer -> HsTyLit
HsNumTy SourceText
NoSourceText Integer
n)
go (LitTy (StrTyLit FastString
s))
= HsType GhcPs -> LHsType GhcPs
forall e. e -> Located e
noLoc (HsType GhcPs -> LHsType GhcPs) -> HsType GhcPs -> LHsType GhcPs
forall a b. (a -> b) -> a -> b
$ XTyLit GhcPs -> HsTyLit -> HsType GhcPs
forall pass. XTyLit pass -> HsTyLit -> HsType pass
HsTyLit XTyLit GhcPs
NoExtField
noExtField (SourceText -> FastString -> HsTyLit
HsStrTy SourceText
NoSourceText FastString
s)
go ty :: Type
ty@(TyConApp TyCon
tc [Type]
args)
| Bool -> TyCon -> Int -> Bool
tyConAppNeedsKindSig Bool
True TyCon
tc ([Type] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
External instance of the constraint type Foldable []
length [Type]
args)
= LHsType GhcPs -> LHsType GhcPs
forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsParTy (LHsType GhcPs -> LHsType GhcPs) -> LHsType GhcPs -> LHsType GhcPs
forall a b. (a -> b) -> a -> b
$ HsType GhcPs -> LHsType GhcPs
forall e. e -> Located e
noLoc (HsType GhcPs -> LHsType GhcPs) -> HsType GhcPs -> LHsType GhcPs
forall a b. (a -> b) -> a -> b
$ XKindSig GhcPs -> LHsType GhcPs -> LHsType GhcPs -> HsType GhcPs
forall pass.
XKindSig pass -> LHsType pass -> LHsType pass -> HsType pass
HsKindSig XKindSig GhcPs
NoExtField
noExtField LHsType GhcPs
ty' (Type -> LHsType GhcPs
go (HasDebugCallStack => Type -> Type
Type -> Type
External instance of the constraint type HasDebugCallStack
tcTypeKind Type
ty))
| Bool
otherwise = LHsType GhcPs
ty'
where
ty' :: LHsType GhcPs
ty' :: LHsType GhcPs
ty' = LHsType GhcPs -> [Type] -> [ArgFlag] -> LHsType GhcPs
go_app (HsType GhcPs -> LHsType GhcPs
forall e. e -> Located e
noLoc (HsType GhcPs -> LHsType GhcPs) -> HsType GhcPs -> LHsType GhcPs
forall a b. (a -> b) -> a -> b
$ XTyVar GhcPs
-> PromotionFlag -> Located (IdP GhcPs) -> HsType GhcPs
forall pass.
XTyVar pass -> PromotionFlag -> Located (IdP pass) -> HsType pass
HsTyVar XTyVar GhcPs
NoExtField
noExtField PromotionFlag
prom (Located (IdP GhcPs) -> HsType GhcPs)
-> Located (IdP GhcPs) -> HsType GhcPs
forall a b. (a -> b) -> a -> b
$ RdrName -> Located RdrName
forall e. e -> Located e
noLoc (RdrName -> Located RdrName) -> RdrName -> Located RdrName
forall a b. (a -> b) -> a -> b
$ TyCon -> RdrName
forall thing. NamedThing thing => thing -> RdrName
External instance of the constraint type NamedThing TyCon
getRdrName TyCon
tc)
[Type]
args (TyCon -> [Type] -> [ArgFlag]
tyConArgFlags TyCon
tc [Type]
args)
prom :: PromotionFlag
prom :: PromotionFlag
prom = if TyCon -> Bool
isPromotedDataCon TyCon
tc then PromotionFlag
IsPromoted else PromotionFlag
NotPromoted
go ty :: Type
ty@(AppTy {}) = LHsType GhcPs -> [Type] -> [ArgFlag] -> LHsType GhcPs
go_app (Type -> LHsType GhcPs
go Type
head) [Type]
args (Type -> [Type] -> [ArgFlag]
appTyArgFlags Type
head [Type]
args)
where
head :: Type
args :: [Type]
(Type
head, [Type]
args) = Type -> (Type, [Type])
splitAppTys Type
ty
go (CastTy Type
ty Coercion
_) = Type -> LHsType GhcPs
go Type
ty
go (CoercionTy Coercion
co) = String -> SDoc -> LHsType GhcPs
forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"toLHsSigWcType" (Coercion -> SDoc
forall a. Outputable a => a -> SDoc
External instance of the constraint type Outputable Coercion
ppr Coercion
co)
go_app :: LHsType GhcPs
-> [Type]
-> [ArgFlag]
-> LHsType GhcPs
go_app :: LHsType GhcPs -> [Type] -> [ArgFlag] -> LHsType GhcPs
go_app LHsType GhcPs
head [Type]
args [ArgFlag]
arg_flags =
(LHsType GhcPs -> (Type, ArgFlag) -> LHsType GhcPs)
-> LHsType GhcPs -> [(Type, ArgFlag)] -> LHsType GhcPs
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldl' (\LHsType GhcPs
f (Type
arg, ArgFlag
flag) ->
let arg' :: LHsType GhcPs
arg' = Type -> LHsType GhcPs
go Type
arg in
case ArgFlag
flag of
Invisible Specificity
spec -> case Specificity
spec of
Specificity
InferredSpec -> LHsType GhcPs
f
Specificity
SpecifiedSpec -> LHsType GhcPs
f LHsType GhcPs -> LHsType GhcPs -> LHsType GhcPs
forall (p :: Pass).
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
`nlHsAppKindTy` LHsType GhcPs
arg'
ArgFlag
Required -> LHsType GhcPs
f LHsType GhcPs -> LHsType GhcPs -> LHsType GhcPs
forall (p :: Pass).
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
`nlHsAppTy` LHsType GhcPs
arg')
LHsType GhcPs
head ([Type] -> [ArgFlag] -> [(Type, ArgFlag)]
forall a b. [a] -> [b] -> [(a, b)]
zip [Type]
args [ArgFlag]
arg_flags)
argf_to_spec :: ArgFlag -> Specificity
argf_to_spec :: ArgFlag -> Specificity
argf_to_spec ArgFlag
Required = Specificity
SpecifiedSpec
argf_to_spec (Invisible Specificity
s) = Specificity
s
go_tv :: TyVarBinder -> LHsTyVarBndr Specificity GhcPs
go_tv :: VarBndr TyVar ArgFlag -> LHsTyVarBndr Specificity GhcPs
go_tv (Bndr TyVar
tv ArgFlag
argf) = HsTyVarBndr Specificity GhcPs -> LHsTyVarBndr Specificity GhcPs
forall e. e -> Located e
noLoc (HsTyVarBndr Specificity GhcPs -> LHsTyVarBndr Specificity GhcPs)
-> HsTyVarBndr Specificity GhcPs -> LHsTyVarBndr Specificity GhcPs
forall a b. (a -> b) -> a -> b
$ XKindedTyVar GhcPs
-> Specificity
-> Located (IdP GhcPs)
-> LHsType GhcPs
-> HsTyVarBndr Specificity GhcPs
forall flag pass.
XKindedTyVar pass
-> flag
-> Located (IdP pass)
-> LHsKind pass
-> HsTyVarBndr flag pass
KindedTyVar XKindedTyVar GhcPs
NoExtField
noExtField
(ArgFlag -> Specificity
argf_to_spec ArgFlag
argf)
(RdrName -> Located RdrName
forall e. e -> Located e
noLoc (TyVar -> RdrName
forall thing. NamedThing thing => thing -> RdrName
External instance of the constraint type NamedThing TyVar
getRdrName TyVar
tv))
(Type -> LHsType GhcPs
go (TyVar -> Type
tyVarKind TyVar
tv))
mkLHsWrap :: HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap :: HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap HsWrapper
co_fn (L SrcSpan
loc HsExpr GhcTc
e) = SrcSpan -> HsExpr GhcTc -> LHsExpr GhcTc
forall l e. l -> e -> GenLocated l e
L SrcSpan
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 (XExpr (HsWrap HsWrapper
co_fn' HsExpr GhcTc
e)) = HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap (HsWrapper
co_fn HsWrapper -> HsWrapper -> HsWrapper
<.> HsWrapper
co_fn') HsExpr GhcTc
e
mkHsWrap HsWrapper
co_fn (HsPar XPar GhcTc
x (L SrcSpan
l HsExpr GhcTc
e)) = XPar GhcTc -> LHsExpr GhcTc -> HsExpr GhcTc
forall p. XPar p -> LHsExpr p -> HsExpr p
HsPar XPar GhcTc
x (SrcSpan -> HsExpr GhcTc -> LHsExpr GhcTc
forall l e. l -> e -> GenLocated l e
L SrcSpan
l (HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap 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 -> HsWrap HsExpr
forall (hs_syn :: * -> *).
HsWrapper -> hs_syn GhcTc -> HsWrap hs_syn
HsWrap HsWrapper
co_fn HsExpr GhcTc
e)
mkHsWrapCo :: TcCoercionN
-> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCo :: Coercion -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCo Coercion
co HsExpr GhcTc
e = HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap (Coercion -> HsWrapper
mkWpCastN Coercion
co) HsExpr GhcTc
e
mkHsWrapCoR :: TcCoercionR
-> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCoR :: Coercion -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCoR Coercion
co HsExpr GhcTc
e = HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrap (Coercion -> HsWrapper
mkWpCastR Coercion
co) HsExpr GhcTc
e
mkLHsWrapCo :: TcCoercionN -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrapCo :: Coercion -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrapCo Coercion
co (L SrcSpan
loc HsExpr GhcTc
e) = SrcSpan -> HsExpr GhcTc -> LHsExpr GhcTc
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc (Coercion -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCo Coercion
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 SrcSpan
loc HsCmd GhcTc
c) = SrcSpan -> HsCmd GhcTc -> LHsCmd GhcTc
forall l e. l -> e -> GenLocated l e
L SrcSpan
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 -> CoPat
CoPat HsWrapper
co_fn Pat GhcTc
p Type
ty
mkHsWrapPatCo :: TcCoercionN -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapPatCo :: Coercion -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapPatCo Coercion
co Pat GhcTc
pat Type
ty | Coercion -> Bool
isTcReflCo Coercion
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 -> CoPat
CoPat (Coercion -> HsWrapper
mkWpCastN Coercion
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 -> Located RdrName -> [LMatch GhcPs (LHsExpr GhcPs)]
-> HsBind GhcPs
mkFunBind :: Origin
-> Located RdrName
-> [LMatch GhcPs (Located (HsExpr GhcPs))]
-> HsBind GhcPs
mkFunBind Origin
origin Located RdrName
fn [LMatch GhcPs (Located (HsExpr GhcPs))]
ms
= FunBind :: forall idL idR.
XFunBind idL idR
-> Located (IdP idL)
-> MatchGroup idR (LHsExpr idR)
-> [Tickish TyVar]
-> HsBindLR idL idR
FunBind { fun_id :: Located (IdP GhcPs)
fun_id = Located RdrName
Located (IdP GhcPs)
fn
, fun_matches :: MatchGroup GhcPs (Located (HsExpr GhcPs))
fun_matches = Origin
-> [LMatch GhcPs (Located (HsExpr GhcPs))]
-> MatchGroup GhcPs (Located (HsExpr GhcPs))
forall name (body :: * -> *).
(XMG name (Located (body name)) ~ NoExtField) =>
Origin
-> [LMatch name (Located (body name))]
-> MatchGroup name (Located (body name))
mkMatchGroup Origin
origin [LMatch GhcPs (Located (HsExpr GhcPs))]
ms
, fun_ext :: XFunBind GhcPs GhcPs
fun_ext = XFunBind GhcPs GhcPs
NoExtField
noExtField
, fun_tick :: [Tickish TyVar]
fun_tick = [] }
mkTopFunBind :: Origin -> Located Name -> [LMatch GhcRn (LHsExpr GhcRn)]
-> HsBind GhcRn
mkTopFunBind :: Origin
-> Located Name
-> [LMatch GhcRn (Located (HsExpr GhcRn))]
-> HsBind GhcRn
mkTopFunBind Origin
origin Located Name
fn [LMatch GhcRn (Located (HsExpr GhcRn))]
ms = FunBind :: forall idL idR.
XFunBind idL idR
-> Located (IdP idL)
-> MatchGroup idR (LHsExpr idR)
-> [Tickish TyVar]
-> HsBindLR idL idR
FunBind { fun_id :: Located (IdP GhcRn)
fun_id = Located Name
Located (IdP GhcRn)
fn
, fun_matches :: MatchGroup GhcRn (Located (HsExpr GhcRn))
fun_matches = Origin
-> [LMatch GhcRn (Located (HsExpr GhcRn))]
-> MatchGroup GhcRn (Located (HsExpr GhcRn))
forall name (body :: * -> *).
(XMG name (Located (body name)) ~ NoExtField) =>
Origin
-> [LMatch name (Located (body name))]
-> MatchGroup name (Located (body name))
mkMatchGroup Origin
origin [LMatch GhcRn (Located (HsExpr GhcRn))]
ms
, fun_ext :: XFunBind GhcRn GhcRn
fun_ext = NameSet
XFunBind GhcRn GhcRn
emptyNameSet
, fun_tick :: [Tickish TyVar]
fun_tick = [] }
mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr GhcPs -> LHsBind GhcPs
mkHsVarBind :: SrcSpan -> RdrName -> Located (HsExpr GhcPs) -> LHsBind GhcPs
mkHsVarBind SrcSpan
loc RdrName
var Located (HsExpr GhcPs)
rhs = SrcSpan
-> RdrName
-> [LPat GhcPs]
-> Located (HsExpr GhcPs)
-> LHsBind GhcPs
mkSimpleGeneratedFunBind SrcSpan
loc RdrName
var [] Located (HsExpr GhcPs)
rhs
mkVarBind :: IdP (GhcPass p) -> LHsExpr (GhcPass p) -> LHsBind (GhcPass p)
mkVarBind :: IdP (GhcPass p) -> LHsExpr (GhcPass p) -> LHsBind (GhcPass p)
mkVarBind IdP (GhcPass p)
var LHsExpr (GhcPass p)
rhs = SrcSpan -> HsBindLR (GhcPass p) (GhcPass p) -> LHsBind (GhcPass p)
forall l e. l -> e -> GenLocated l e
L (LHsExpr (GhcPass p) -> SrcSpan
forall l e. GenLocated l e -> l
getLoc LHsExpr (GhcPass p)
rhs) (HsBindLR (GhcPass p) (GhcPass p) -> LHsBind (GhcPass p))
-> HsBindLR (GhcPass p) (GhcPass p) -> LHsBind (GhcPass p)
forall a b. (a -> b) -> a -> b
$
VarBind :: forall idL idR.
XVarBind idL idR -> IdP idL -> LHsExpr idR -> HsBindLR idL idR
VarBind { var_ext :: XVarBind (GhcPass p) (GhcPass p)
var_ext = XVarBind (GhcPass p) (GhcPass p)
NoExtField
noExtField,
var_id :: IdP (GhcPass p)
var_id = IdP (GhcPass p)
var, var_rhs :: LHsExpr (GhcPass p)
var_rhs = LHsExpr (GhcPass p)
rhs }
mkPatSynBind :: Located RdrName -> HsPatSynDetails (Located RdrName)
-> LPat GhcPs -> HsPatSynDir GhcPs -> HsBind GhcPs
mkPatSynBind :: Located RdrName
-> HsPatSynDetails (Located RdrName)
-> LPat GhcPs
-> HsPatSynDir GhcPs
-> HsBind GhcPs
mkPatSynBind Located RdrName
name HsPatSynDetails (Located RdrName)
details LPat GhcPs
lpat HsPatSynDir GhcPs
dir = 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 :: forall idL idR.
XPSB idL idR
-> Located (IdP idL)
-> HsPatSynDetails (Located (IdP idR))
-> LPat idR
-> HsPatSynDir idR
-> PatSynBind idL idR
PSB{ psb_ext :: XPSB GhcPs GhcPs
psb_ext = XPSB GhcPs GhcPs
NoExtField
noExtField
, psb_id :: Located (IdP GhcPs)
psb_id = Located RdrName
Located (IdP GhcPs)
name
, psb_args :: HsPatSynDetails (Located (IdP GhcPs))
psb_args = HsPatSynDetails (Located RdrName)
HsPatSynDetails (Located (IdP GhcPs))
details
, psb_def :: LPat GhcPs
psb_def = LPat GhcPs
lpat
, psb_dir :: HsPatSynDir GhcPs
psb_dir = HsPatSynDir GhcPs
dir }
isInfixFunBind :: HsBindLR id1 id2 -> Bool
isInfixFunBind :: 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)
_ Located [LMatch id2 (LHsExpr id2)]
matches Origin
_ })
= (LMatch id2 (LHsExpr id2) -> Bool)
-> [LMatch id2 (LHsExpr id2)] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
External instance of the constraint type Foldable []
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
. LMatch id2 (LHsExpr id2) -> Match id2 (LHsExpr id2)
forall l e. GenLocated l e -> e
unLoc) (Located [LMatch id2 (LHsExpr id2)] -> [LMatch id2 (LHsExpr id2)]
forall l e. GenLocated l e -> e
unLoc Located [LMatch id2 (LHsExpr id2)]
matches)
isInfixFunBind HsBindLR id1 id2
_ = Bool
False
mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> [LPat GhcPs]
-> LHsExpr GhcPs -> LHsBind GhcPs
mkSimpleGeneratedFunBind :: SrcSpan
-> RdrName
-> [LPat GhcPs]
-> Located (HsExpr GhcPs)
-> LHsBind GhcPs
mkSimpleGeneratedFunBind SrcSpan
loc RdrName
fun [LPat GhcPs]
pats Located (HsExpr GhcPs)
expr
= SrcSpan -> HsBind GhcPs -> LHsBind GhcPs
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc (HsBind GhcPs -> LHsBind GhcPs) -> HsBind GhcPs -> LHsBind GhcPs
forall a b. (a -> b) -> a -> b
$ Origin
-> Located RdrName
-> [LMatch GhcPs (Located (HsExpr GhcPs))]
-> HsBind GhcPs
mkFunBind Origin
Generated (SrcSpan -> RdrName -> Located RdrName
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc RdrName
fun)
[HsMatchContext (NoGhcTc GhcPs)
-> [LPat GhcPs]
-> Located (HsExpr GhcPs)
-> Located (HsLocalBinds GhcPs)
-> LMatch GhcPs (Located (HsExpr GhcPs))
forall (p :: Pass).
IsPass p =>
HsMatchContext (NoGhcTc (GhcPass p))
-> [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> Located (HsLocalBinds (GhcPass p))
-> LMatch (GhcPass p) (LHsExpr (GhcPass p))
External instance of the constraint type IsPass 'Parsed
mkMatch (Located (IdP GhcPs) -> HsMatchContext GhcPs
forall p. LIdP p -> HsMatchContext p
mkPrefixFunRhs (SrcSpan -> RdrName -> Located RdrName
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc RdrName
fun)) [LPat GhcPs]
pats Located (HsExpr GhcPs)
expr
(HsLocalBinds GhcPs -> Located (HsLocalBinds GhcPs)
forall e. e -> Located e
noLoc HsLocalBinds GhcPs
forall (a :: Pass) (b :: Pass).
HsLocalBindsLR (GhcPass a) (GhcPass b)
emptyLocalBinds)]
mkPrefixFunRhs :: LIdP p -> HsMatchContext p
mkPrefixFunRhs :: LIdP p -> HsMatchContext p
mkPrefixFunRhs LIdP p
n = FunRhs :: forall p.
LIdP p -> LexicalFixity -> SrcStrictness -> HsMatchContext p
FunRhs { mc_fun :: LIdP p
mc_fun = LIdP p
n
, mc_fixity :: LexicalFixity
mc_fixity = LexicalFixity
Prefix
, mc_strictness :: SrcStrictness
mc_strictness = SrcStrictness
NoSrcStrict }
mkMatch :: forall p. IsPass p
=> HsMatchContext (NoGhcTc (GhcPass p))
-> [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> Located (HsLocalBinds (GhcPass p))
-> LMatch (GhcPass p) (LHsExpr (GhcPass p))
mkMatch :: HsMatchContext (NoGhcTc (GhcPass p))
-> [LPat (GhcPass p)]
-> LHsExpr (GhcPass p)
-> Located (HsLocalBinds (GhcPass p))
-> LMatch (GhcPass p) (LHsExpr (GhcPass p))
mkMatch HsMatchContext (NoGhcTc (GhcPass p))
ctxt [LPat (GhcPass p)]
pats LHsExpr (GhcPass p)
expr Located (HsLocalBinds (GhcPass p))
lbinds
= Match (GhcPass p) (LHsExpr (GhcPass p))
-> LMatch (GhcPass p) (LHsExpr (GhcPass p))
forall e. e -> Located e
noLoc (Match :: forall p body.
XCMatch p body
-> HsMatchContext (NoGhcTc p)
-> [LPat p]
-> GRHSs p body
-> Match p body
Match { m_ext :: XCMatch (GhcPass p) (LHsExpr (GhcPass p))
m_ext = XCMatch (GhcPass p) (LHsExpr (GhcPass p))
NoExtField
noExtField
, m_ctxt :: HsMatchContext (NoGhcTc (GhcPass p))
m_ctxt = HsMatchContext (NoGhcTc (GhcPass p))
ctxt
, m_pats :: [LPat (GhcPass p)]
m_pats = (Located (Pat (GhcPass p)) -> Located (Pat (GhcPass p)))
-> [Located (Pat (GhcPass p))] -> [Located (Pat (GhcPass p))]
forall a b. (a -> b) -> [a] -> [b]
map Located (Pat (GhcPass p)) -> Located (Pat (GhcPass p))
paren [Located (Pat (GhcPass p))]
[LPat (GhcPass p)]
pats
, m_grhss :: GRHSs (GhcPass p) (LHsExpr (GhcPass p))
m_grhss = XCGRHSs (GhcPass p) (LHsExpr (GhcPass p))
-> [LGRHS (GhcPass p) (LHsExpr (GhcPass p))]
-> Located (HsLocalBinds (GhcPass p))
-> GRHSs (GhcPass p) (LHsExpr (GhcPass p))
forall p body.
XCGRHSs p body -> [LGRHS p body] -> LHsLocalBinds p -> GRHSs p body
GRHSs XCGRHSs (GhcPass p) (LHsExpr (GhcPass p))
NoExtField
noExtField (SrcSpan
-> LHsExpr (GhcPass p) -> [LGRHS (GhcPass p) (LHsExpr (GhcPass p))]
forall (body :: * -> *) (p :: Pass).
SrcSpan
-> Located (body (GhcPass p))
-> [LGRHS (GhcPass p) (Located (body (GhcPass p)))]
unguardedRHS SrcSpan
noSrcSpan LHsExpr (GhcPass p)
expr) Located (HsLocalBinds (GhcPass p))
lbinds })
where
paren :: Located (Pat (GhcPass p)) -> Located (Pat (GhcPass p))
paren :: Located (Pat (GhcPass p)) -> Located (Pat (GhcPass p))
paren lp :: Located (Pat (GhcPass p))
lp@(L SrcSpan
l Pat (GhcPass p)
p)
| PprPrec -> Pat (GhcPass p) -> Bool
forall (p :: Pass). IsPass p => PprPrec -> Pat (GhcPass p) -> Bool
Evidence bound by a type signature of the constraint type IsPass p
patNeedsParens PprPrec
appPrec Pat (GhcPass p)
p = SrcSpan -> Pat (GhcPass p) -> Located (Pat (GhcPass p))
forall l e. l -> e -> GenLocated l e
L SrcSpan
l (XParPat (GhcPass p) -> LPat (GhcPass p) -> Pat (GhcPass p)
forall p. XParPat p -> LPat p -> Pat p
ParPat XParPat (GhcPass p)
NoExtField
noExtField Located (Pat (GhcPass p))
LPat (GhcPass p)
lp)
| Bool
otherwise = Located (Pat (GhcPass p))
lp
isUnliftedHsBind :: HsBind GhcTc -> Bool
isUnliftedHsBind :: HsBind GhcTc -> Bool
isUnliftedHsBind HsBind GhcTc
bind
| AbsBinds { abs_exports :: forall idL idR. HsBindLR idL idR -> [ABExport idL]
abs_exports = [ABExport GhcTc]
exports, abs_sig :: forall idL idR. HsBindLR idL idR -> Bool
abs_sig = Bool
has_sig } <- HsBind GhcTc
bind
= if Bool
has_sig
then (ABExport GhcTc -> Bool) -> [ABExport GhcTc] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
External instance of the constraint type Foldable []
any (TyVar -> Bool
is_unlifted_id (TyVar -> Bool)
-> (ABExport GhcTc -> TyVar) -> ABExport GhcTc -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ABExport GhcTc -> TyVar
forall p. ABExport p -> IdP p
abe_poly) [ABExport GhcTc]
exports
else (ABExport GhcTc -> Bool) -> [ABExport GhcTc] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
External instance of the constraint type Foldable []
any (TyVar -> Bool
is_unlifted_id (TyVar -> Bool)
-> (ABExport GhcTc -> TyVar) -> ABExport GhcTc -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ABExport GhcTc -> TyVar
forall p. ABExport p -> IdP p
abe_mono) [ABExport GhcTc]
exports
| Bool
otherwise
= (TyVar -> Bool) -> [TyVar] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
External instance of the constraint type Foldable []
any TyVar -> Bool
is_unlifted_id (HsBind GhcTc -> [IdP GhcTc]
forall p idR. CollectPass p => HsBindLR p idR -> [IdP p]
Instance of class: CollectPass of the constraint type CollectPass GhcTc
collectHsBindBinders HsBind GhcTc
bind)
where
is_unlifted_id :: TyVar -> Bool
is_unlifted_id TyVar
id = HasDebugCallStack => Type -> Bool
Type -> Bool
External instance of the constraint type HasDebugCallStack
isUnliftedType (TyVar -> Type
idType TyVar
id)
isBangedHsBind :: HsBind GhcTc -> Bool
isBangedHsBind :: HsBind GhcTc -> Bool
isBangedHsBind (AbsBinds { abs_binds :: forall idL idR. HsBindLR idL idR -> LHsBinds idL
abs_binds = LHsBinds GhcTc
binds })
= (GenLocated SrcSpan (HsBind GhcTc) -> Bool)
-> LHsBinds GhcTc -> Bool
forall a. (a -> Bool) -> Bag a -> Bool
anyBag (HsBind GhcTc -> Bool
isBangedHsBind (HsBind GhcTc -> Bool)
-> (GenLocated SrcSpan (HsBind GhcTc) -> HsBind GhcTc)
-> GenLocated SrcSpan (HsBind GhcTc)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpan (HsBind GhcTc) -> HsBind GhcTc
forall l e. GenLocated l e -> e
unLoc) LHsBinds GhcTc
binds
isBangedHsBind (FunBind {fun_matches :: forall idL idR. HsBindLR idL idR -> MatchGroup idR (LHsExpr idR)
fun_matches = MatchGroup GhcTc (LHsExpr GhcTc)
matches})
| [L SrcSpan
_ Match GhcTc (LHsExpr GhcTc)
match] <- GenLocated SrcSpan [LMatch GhcTc (LHsExpr GhcTc)]
-> [LMatch GhcTc (LHsExpr GhcTc)]
forall l e. GenLocated l e -> e
unLoc (GenLocated SrcSpan [LMatch GhcTc (LHsExpr GhcTc)]
-> [LMatch GhcTc (LHsExpr GhcTc)])
-> GenLocated SrcSpan [LMatch GhcTc (LHsExpr GhcTc)]
-> [LMatch GhcTc (LHsExpr GhcTc)]
forall a b. (a -> b) -> a -> b
$ MatchGroup GhcTc (LHsExpr GhcTc)
-> GenLocated SrcSpan [LMatch GhcTc (LHsExpr GhcTc)]
forall p body. MatchGroup p body -> Located [LMatch p body]
mg_alts MatchGroup GhcTc (LHsExpr GhcTc)
matches
, FunRhs{mc_strictness :: forall p. HsMatchContext p -> SrcStrictness
mc_strictness = SrcStrictness
SrcStrict} <- Match GhcTc (LHsExpr GhcTc) -> HsMatchContext (NoGhcTc GhcTc)
forall p body. Match p body -> HsMatchContext (NoGhcTc p)
m_ctxt Match GhcTc (LHsExpr 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 HsBind GhcTc
_
= Bool
False
collectLocalBinders :: CollectPass (GhcPass idL)
=> HsLocalBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
collectLocalBinders :: HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
collectLocalBinders (HsValBinds XHsValBinds (GhcPass idL) (GhcPass idR)
_ HsValBindsLR (GhcPass idL) (GhcPass idR)
binds) = HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass).
CollectPass (GhcPass idL) =>
HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectHsIdBinders HsValBindsLR (GhcPass idL) (GhcPass idR)
binds
collectLocalBinders (HsIPBinds {}) = []
collectLocalBinders (EmptyLocalBinds XEmptyLocalBinds (GhcPass idL) (GhcPass idR)
_) = []
collectHsIdBinders :: CollectPass (GhcPass idL)
=> HsValBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
collectHsIdBinders :: HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
collectHsIdBinders = Bool
-> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass).
CollectPass (GhcPass idL) =>
Bool
-> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collect_hs_val_binders Bool
True
collectHsValBinders :: CollectPass (GhcPass idL)
=> HsValBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
collectHsValBinders :: HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
collectHsValBinders = Bool
-> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass).
CollectPass (GhcPass idL) =>
Bool
-> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collect_hs_val_binders Bool
False
collectHsBindBinders :: CollectPass p
=> HsBindLR p idR
-> [IdP p]
collectHsBindBinders :: HsBindLR p idR -> [IdP p]
collectHsBindBinders HsBindLR p idR
b = Bool -> HsBindLR p idR -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> HsBindLR p idR -> [IdP p] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass p
collect_bind Bool
False HsBindLR p idR
b []
collectHsBindsBinders :: CollectPass p
=> LHsBindsLR p idR
-> [IdP p]
collectHsBindsBinders :: LHsBindsLR p idR -> [IdP p]
collectHsBindsBinders LHsBindsLR p idR
binds = Bool -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass p
collect_binds Bool
False LHsBindsLR p idR
binds []
collectHsBindListBinders :: CollectPass p
=> [LHsBindLR p idR]
-> [IdP p]
collectHsBindListBinders :: [LHsBindLR p idR] -> [IdP p]
collectHsBindListBinders = (LHsBindLR p idR -> [IdP p] -> [IdP p])
-> [IdP p] -> [LHsBindLR p idR] -> [IdP p]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldr (Bool -> HsBindLR p idR -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> HsBindLR p idR -> [IdP p] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass p
collect_bind Bool
False (HsBindLR p idR -> [IdP p] -> [IdP p])
-> (LHsBindLR p idR -> HsBindLR p idR)
-> LHsBindLR p idR
-> [IdP p]
-> [IdP p]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LHsBindLR p idR -> HsBindLR p idR
forall l e. GenLocated l e -> e
unLoc) []
collect_hs_val_binders :: CollectPass (GhcPass idL)
=> Bool
-> HsValBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
collect_hs_val_binders :: Bool
-> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
collect_hs_val_binders Bool
ps (ValBinds XValBinds (GhcPass idL) (GhcPass idR)
_ LHsBindsLR (GhcPass idL) (GhcPass idR)
binds [LSig (GhcPass idR)]
_) = Bool
-> LHsBindsLR (GhcPass idL) (GhcPass idR)
-> [IdP (GhcPass idL)]
-> [IdP (GhcPass idL)]
forall p idR.
CollectPass p =>
Bool -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collect_binds Bool
ps LHsBindsLR (GhcPass idL) (GhcPass idR)
binds []
collect_hs_val_binders Bool
ps (XValBindsLR (NValBinds [(RecFlag, LHsBinds (GhcPass idL))]
binds [LSig GhcRn]
_))
= Bool -> [(RecFlag, LHsBinds (GhcPass idL))] -> [IdP (GhcPass idL)]
forall p.
CollectPass p =>
Bool -> [(RecFlag, LHsBinds p)] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collect_out_binds Bool
ps [(RecFlag, LHsBinds (GhcPass idL))]
binds
collect_out_binds :: CollectPass p
=> Bool
-> [(RecFlag, LHsBinds p)]
-> [IdP p]
collect_out_binds :: Bool -> [(RecFlag, LHsBinds p)] -> [IdP p]
collect_out_binds Bool
ps = ((RecFlag, LHsBinds p) -> [IdP p] -> [IdP p])
-> [IdP p] -> [(RecFlag, LHsBinds p)] -> [IdP p]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldr (Bool -> LHsBinds p -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass p
collect_binds Bool
ps (LHsBinds p -> [IdP p] -> [IdP p])
-> ((RecFlag, LHsBinds p) -> LHsBinds p)
-> (RecFlag, LHsBinds p)
-> [IdP p]
-> [IdP p]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RecFlag, LHsBinds p) -> LHsBinds p
forall a b. (a, b) -> b
snd) []
collect_binds :: CollectPass p
=> Bool
-> LHsBindsLR p idR
-> [IdP p]
-> [IdP p]
collect_binds :: Bool -> LHsBindsLR p idR -> [IdP p] -> [IdP p]
collect_binds Bool
ps LHsBindsLR p idR
binds [IdP p]
acc = (GenLocated SrcSpan (HsBindLR p idR) -> [IdP p] -> [IdP p])
-> [IdP p] -> LHsBindsLR p idR -> [IdP p]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable Bag
foldr (Bool -> HsBindLR p idR -> [IdP p] -> [IdP p]
forall p idR.
CollectPass p =>
Bool -> HsBindLR p idR -> [IdP p] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass p
collect_bind Bool
ps (HsBindLR p idR -> [IdP p] -> [IdP p])
-> (GenLocated SrcSpan (HsBindLR p idR) -> HsBindLR p idR)
-> GenLocated SrcSpan (HsBindLR p idR)
-> [IdP p]
-> [IdP p]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpan (HsBindLR p idR) -> HsBindLR p idR
forall l e. GenLocated l e -> e
unLoc) [IdP p]
acc LHsBindsLR p idR
binds
collect_bind :: CollectPass p
=> Bool
-> HsBindLR p idR
-> [IdP p]
-> [IdP p]
collect_bind :: Bool -> HsBindLR p idR -> [IdP p] -> [IdP p]
collect_bind Bool
_ (PatBind { pat_lhs :: forall idL idR. HsBindLR idL idR -> LPat idL
pat_lhs = XRec p Pat
p }) [IdP p]
acc = XRec p Pat -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat XRec p Pat
p [IdP p]
acc
collect_bind Bool
_ (FunBind { fun_id :: forall idL idR. HsBindLR idL idR -> Located (IdP idL)
fun_id = L SrcSpan
_ 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
_ (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
_ (AbsBinds { abs_exports :: forall idL idR. HsBindLR idL idR -> [ABExport idL]
abs_exports = [ABExport p]
dbinds }) [IdP p]
acc = (ABExport p -> IdP p) -> [ABExport p] -> [IdP p]
forall a b. (a -> b) -> [a] -> [b]
map ABExport p -> IdP p
forall p. ABExport p -> IdP p
abe_poly [ABExport p]
dbinds [IdP p] -> [IdP p] -> [IdP p]
forall a. [a] -> [a] -> [a]
++ [IdP p]
acc
collect_bind Bool
omitPatSyn (PatSynBind XPatSynBind p idR
_ (PSB { psb_id :: forall idL idR. PatSynBind idL idR -> Located (IdP idL)
psb_id = L SrcSpan
_ IdP p
ps })) [IdP p]
acc
| Bool
omitPatSyn = [IdP p]
acc
| Bool
otherwise = IdP p
ps IdP p -> [IdP p] -> [IdP p]
forall a. a -> [a] -> [a]
: [IdP p]
acc
collect_bind Bool
_ (PatSynBind XPatSynBind p idR
_ (XPatSynBind XXPatSynBind p idR
_)) [IdP p]
acc = [IdP p]
acc
collect_bind Bool
_ (XHsBindsLR XXHsBindsLR p idR
_) [IdP p]
acc = [IdP p]
acc
collectMethodBinders :: LHsBindsLR idL idR -> [Located (IdP idL)]
collectMethodBinders :: LHsBindsLR idL idR -> [Located (IdP idL)]
collectMethodBinders LHsBindsLR idL idR
binds = (GenLocated SrcSpan (HsBindLR idL idR)
-> [Located (IdP idL)] -> [Located (IdP idL)])
-> [Located (IdP idL)] -> LHsBindsLR idL idR -> [Located (IdP idL)]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable Bag
foldr (HsBindLR idL idR -> [Located (IdP idL)] -> [Located (IdP idL)]
forall {idL} {idR}.
HsBindLR idL idR -> [Located (IdP idL)] -> [Located (IdP idL)]
get (HsBindLR idL idR -> [Located (IdP idL)] -> [Located (IdP idL)])
-> (GenLocated SrcSpan (HsBindLR idL idR) -> HsBindLR idL idR)
-> GenLocated SrcSpan (HsBindLR idL idR)
-> [Located (IdP idL)]
-> [Located (IdP idL)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpan (HsBindLR idL idR) -> HsBindLR idL idR
forall l e. GenLocated l e -> e
unLoc) [] LHsBindsLR idL idR
binds
where
get :: HsBindLR idL idR -> [Located (IdP idL)] -> [Located (IdP idL)]
get (FunBind { fun_id :: forall idL idR. HsBindLR idL idR -> Located (IdP idL)
fun_id = Located (IdP idL)
f }) [Located (IdP idL)]
fs = Located (IdP idL)
f Located (IdP idL) -> [Located (IdP idL)] -> [Located (IdP idL)]
forall a. a -> [a] -> [a]
: [Located (IdP idL)]
fs
get HsBindLR idL idR
_ [Located (IdP idL)]
fs = [Located (IdP idL)]
fs
collectLStmtsBinders :: (CollectPass (GhcPass idL))
=> [LStmtLR (GhcPass idL) (GhcPass idR) body]
-> [IdP (GhcPass idL)]
collectLStmtsBinders :: [LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
collectLStmtsBinders = (LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdGhcP idL])
-> [LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdGhcP idL]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
External instance of the constraint type Foldable []
concatMap LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdGhcP idL]
forall (idL :: Pass) (idR :: Pass) body.
CollectPass (GhcPass idL) =>
LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectLStmtBinders
collectStmtsBinders :: (CollectPass (GhcPass idL))
=> [StmtLR (GhcPass idL) (GhcPass idR) body]
-> [IdP (GhcPass idL)]
collectStmtsBinders :: [StmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
collectStmtsBinders = (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]
External instance of the constraint type Foldable []
concatMap StmtLR (GhcPass idL) (GhcPass idR) body -> [IdGhcP idL]
forall (idL :: Pass) (idR :: Pass) body.
CollectPass (GhcPass idL) =>
StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectStmtBinders
collectLStmtBinders :: (CollectPass (GhcPass idL))
=> LStmtLR (GhcPass idL) (GhcPass idR) body
-> [IdP (GhcPass idL)]
collectLStmtBinders :: LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
collectLStmtBinders = StmtLR (GhcPass idL) (GhcPass idR) body -> [IdGhcP idL]
forall (idL :: Pass) (idR :: Pass) body.
CollectPass (GhcPass idL) =>
StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectStmtBinders (StmtLR (GhcPass idL) (GhcPass idR) body -> [IdGhcP idL])
-> (LStmtLR (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body)
-> LStmtLR (GhcPass idL) (GhcPass idR) body
-> [IdGhcP idL]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LStmtLR (GhcPass idL) (GhcPass idR) body
-> StmtLR (GhcPass idL) (GhcPass idR) body
forall l e. GenLocated l e -> e
unLoc
collectStmtBinders :: (CollectPass (GhcPass idL))
=> StmtLR (GhcPass idL) (GhcPass idR) body
-> [IdP (GhcPass idL)]
collectStmtBinders :: StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
collectStmtBinders (BindStmt XBindStmt (GhcPass idL) (GhcPass idR) body
_ LPat (GhcPass idL)
pat body
_) = LPat (GhcPass idL) -> [IdP (GhcPass idL)]
forall p. CollectPass p => LPat p -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectPatBinders LPat (GhcPass idL)
pat
collectStmtBinders (LetStmt XLetStmt (GhcPass idL) (GhcPass idR) body
_ LHsLocalBindsLR (GhcPass idL) (GhcPass idR)
binds) = HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass).
CollectPass (GhcPass idL) =>
HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectLocalBinders (LHsLocalBindsLR (GhcPass idL) (GhcPass idR)
-> HsLocalBindsLR (GhcPass idL) (GhcPass idR)
forall l e. GenLocated l e -> e
unLoc LHsLocalBindsLR (GhcPass idL) (GhcPass idR)
binds)
collectStmtBinders (BodyStmt {}) = []
collectStmtBinders (LastStmt {}) = []
collectStmtBinders (ParStmt XParStmt (GhcPass idL) (GhcPass idR) body
_ [ParStmtBlock (GhcPass idL) (GhcPass idR)]
xs HsExpr (GhcPass idR)
_ SyntaxExpr (GhcPass idR)
_) = [LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))]
-> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass) body.
CollectPass (GhcPass idL) =>
[LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectLStmtsBinders
([LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))]
-> [IdP (GhcPass idL)])
-> [LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))]
-> [IdP (GhcPass idL)]
forall a b. (a -> b) -> a -> b
$ [LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))
s | ParStmtBlock XParStmtBlock (GhcPass idL) (GhcPass idR)
_ [LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))]
ss [IdP (GhcPass idR)]
_ SyntaxExpr (GhcPass idR)
_ <- [ParStmtBlock (GhcPass idL) (GhcPass idR)]
xs, LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))
s <- [LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))]
ss]
collectStmtBinders (TransStmt { trS_stmts :: forall idL idR body. StmtLR idL idR body -> [ExprLStmt idL]
trS_stmts = [LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))]
stmts }) = [LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))]
-> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass) body.
CollectPass (GhcPass idL) =>
[LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectLStmtsBinders [LStmtLR (GhcPass idL) (GhcPass idL) (LHsExpr (GhcPass idL))]
stmts
collectStmtBinders (RecStmt { recS_stmts :: forall idL idR body. StmtLR idL idR body -> [LStmtLR idL idR body]
recS_stmts = [LStmtLR (GhcPass idL) (GhcPass idR) body]
ss }) = [LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
forall (idL :: Pass) (idR :: Pass) body.
CollectPass (GhcPass idL) =>
[LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectLStmtsBinders [LStmtLR (GhcPass idL) (GhcPass idR) body]
ss
collectStmtBinders (ApplicativeStmt XApplicativeStmt (GhcPass idL) (GhcPass idR) body
_ [(SyntaxExpr (GhcPass idR), ApplicativeArg (GhcPass idL))]
args Maybe (SyntaxExpr (GhcPass idR))
_) = ((SyntaxExprGhc idR, ApplicativeArg (GhcPass idL)) -> [IdGhcP idL])
-> [(SyntaxExprGhc idR, ApplicativeArg (GhcPass idL))]
-> [IdGhcP idL]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
External instance of the constraint type Foldable []
concatMap (SyntaxExprGhc idR, ApplicativeArg (GhcPass idL)) -> [IdGhcP idL]
forall {p} {a}. CollectPass p => (a, ApplicativeArg p) -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass (GhcPass idL)
collectArgBinders [(SyntaxExpr (GhcPass idR), ApplicativeArg (GhcPass idL))]
[(SyntaxExprGhc idR, ApplicativeArg (GhcPass idL))]
args
where
collectArgBinders :: (a, ApplicativeArg p) -> [IdP p]
collectArgBinders (a
_, ApplicativeArgOne { app_arg_pattern :: forall idL. ApplicativeArg idL -> LPat idL
app_arg_pattern = LPat p
pat }) = LPat p -> [IdP p]
forall p. CollectPass p => LPat p -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass p
collectPatBinders LPat p
pat
collectArgBinders (a
_, ApplicativeArgMany { bv_pattern :: forall idL. ApplicativeArg idL -> LPat idL
bv_pattern = LPat p
pat }) = LPat p -> [IdP p]
forall p. CollectPass p => LPat p -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass p
collectPatBinders LPat p
pat
collectArgBinders (a
_, XApplicativeArg {}) = []
collectPatBinders :: CollectPass p => LPat p -> [IdP p]
collectPatBinders :: LPat p -> [IdP p]
collectPatBinders LPat p
pat = LPat p -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat LPat p
pat []
collectPatsBinders :: CollectPass p => [LPat p] -> [IdP p]
collectPatsBinders :: [LPat p] -> [IdP p]
collectPatsBinders [LPat p]
pats = (Located (Pat p) -> [IdP p] -> [IdP p])
-> [IdP p] -> [Located (Pat p)] -> [IdP p]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldr Located (Pat p) -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat [] [Located (Pat p)]
[LPat p]
pats
collect_lpat :: forall pass. (CollectPass pass)
=> LPat pass -> [IdP pass] -> [IdP pass]
collect_lpat :: LPat pass -> [IdP pass] -> [IdP pass]
collect_lpat LPat pass
p [IdP pass]
bndrs = Pat pass -> [IdP pass] -> [IdP pass]
forall p. CollectPass p => Pat p -> [IdP p] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass pass
collect_pat (Located (Pat pass) -> Pat pass
forall l e. GenLocated l e -> e
unLoc Located (Pat pass)
LPat pass
p) [IdP pass]
bndrs
collect_pat :: forall p. CollectPass p
=> Pat p
-> [IdP p]
-> [IdP p]
collect_pat :: Pat p -> [IdP p] -> [IdP p]
collect_pat Pat p
pat [IdP p]
bndrs = case Pat p
pat of
(VarPat XVarPat p
_ Located (IdP p)
var) -> Located (IdP p) -> IdP p
forall l e. GenLocated l e -> e
unLoc Located (IdP 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
_ XRec p Pat
pat) -> XRec p Pat -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat XRec p Pat
pat [IdP p]
bndrs
(BangPat XBangPat p
_ XRec p Pat
pat) -> XRec p Pat -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat XRec p Pat
pat [IdP p]
bndrs
(AsPat XAsPat p
_ Located (IdP p)
a XRec p Pat
pat) -> Located (IdP p) -> IdP p
forall l e. GenLocated l e -> e
unLoc Located (IdP p)
a IdP p -> [IdP p] -> [IdP p]
forall a. a -> [a] -> [a]
: XRec p Pat -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat XRec p Pat
pat [IdP p]
bndrs
(ViewPat XViewPat p
_ LHsExpr p
_ XRec p Pat
pat) -> XRec p Pat -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat XRec p Pat
pat [IdP p]
bndrs
(ParPat XParPat p
_ XRec p Pat
pat) -> XRec p Pat -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat XRec p Pat
pat [IdP p]
bndrs
(ListPat XListPat p
_ [XRec p Pat]
pats) -> (Located (Pat p) -> [IdP p] -> [IdP p])
-> [IdP p] -> [Located (Pat p)] -> [IdP p]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldr Located (Pat p) -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat [IdP p]
bndrs [Located (Pat p)]
[XRec p Pat]
pats
(TuplePat XTuplePat p
_ [XRec p Pat]
pats Boxity
_) -> (Located (Pat p) -> [IdP p] -> [IdP p])
-> [IdP p] -> [Located (Pat p)] -> [IdP p]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldr Located (Pat p) -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat [IdP p]
bndrs [Located (Pat p)]
[XRec p Pat]
pats
(SumPat XSumPat p
_ XRec p Pat
pat Int
_ Int
_) -> XRec p Pat -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat XRec p Pat
pat [IdP p]
bndrs
(ConPat {pat_args :: forall p. Pat p -> HsConPatDetails p
pat_args=HsConPatDetails p
ps}) -> (Located (Pat p) -> [IdP p] -> [IdP p])
-> [IdP p] -> [Located (Pat p)] -> [IdP p]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldr Located (Pat p) -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat [IdP p]
bndrs (HsConPatDetails p -> [XRec p Pat]
forall p. HsConPatDetails p -> [LPat p]
hsConPatArgs HsConPatDetails p
ps)
(LitPat XLitPat p
_ HsLit p
_) -> [IdP p]
bndrs
(NPat {}) -> [IdP p]
bndrs
(NPlusKPat XNPlusKPat p
_ Located (IdP p)
n Located (HsOverLit p)
_ HsOverLit p
_ SyntaxExpr p
_ SyntaxExpr p
_) -> Located (IdP p) -> IdP p
forall l e. GenLocated l e -> e
unLoc Located (IdP p)
n IdP p -> [IdP p] -> [IdP p]
forall a. a -> [a] -> [a]
: [IdP p]
bndrs
(SigPat XSigPat p
_ XRec p Pat
pat HsPatSigType (NoGhcTc p)
_) -> XRec p Pat -> [IdP p] -> [IdP p]
forall pass.
CollectPass pass =>
LPat pass -> [IdP pass] -> [IdP pass]
Evidence bound by a type signature of the constraint type CollectPass p
collect_lpat XRec p Pat
pat [IdP p]
bndrs
(SplicePat XSplicePat p
_ (HsSpliced XSpliced p
_ ThModFinalizers
_ (HsSplicedPat Pat p
pat)))
-> Pat p -> [IdP p] -> [IdP p]
forall p. CollectPass p => Pat p -> [IdP p] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass p
collect_pat Pat p
pat [IdP p]
bndrs
(SplicePat XSplicePat p
_ HsSplice p
_) -> [IdP p]
bndrs
(XPat XXPat p
ext) -> Proxy p -> XXPat p -> [IdP p] -> [IdP p]
forall p. CollectPass p => Proxy p -> XXPat p -> [IdP p] -> [IdP p]
Evidence bound by a type signature of the constraint type CollectPass p
collectXXPat (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @p) XXPat p
ext [IdP p]
bndrs
class (XRec p Pat ~ Located (Pat p)) => CollectPass p where
collectXXPat :: Proxy p -> XXPat p -> [IdP p] -> [IdP p]
instance CollectPass (GhcPass 'Parsed) where
collectXXPat :: Proxy GhcPs -> XXPat GhcPs -> [IdP GhcPs] -> [IdP GhcPs]
collectXXPat Proxy GhcPs
_ XXPat GhcPs
ext = NoExtCon -> [RdrName] -> [RdrName]
forall a. NoExtCon -> a
noExtCon XXPat GhcPs
NoExtCon
ext
instance CollectPass (GhcPass 'Renamed) where
collectXXPat :: Proxy GhcRn -> XXPat GhcRn -> [IdP GhcRn] -> [IdP GhcRn]
collectXXPat Proxy GhcRn
_ XXPat GhcRn
ext = NoExtCon -> [Name] -> [Name]
forall a. NoExtCon -> a
noExtCon XXPat GhcRn
NoExtCon
ext
instance CollectPass (GhcPass 'Typechecked) where
collectXXPat :: Proxy GhcTc -> XXPat GhcTc -> [IdP GhcTc] -> [IdP GhcTc]
collectXXPat Proxy GhcTc
_ (CoPat HsWrapper
_ Pat GhcTc
pat Type
_) = Pat GhcTc -> [IdP GhcTc] -> [IdP GhcTc]
forall p. CollectPass p => Pat p -> [IdP p] -> [IdP p]
Instance of class: CollectPass of the constraint type CollectPass GhcTc
collect_pat Pat GhcTc
pat
hsGroupBinders :: HsGroup GhcRn -> [Name]
hsGroupBinders :: HsGroup GhcRn -> [Name]
hsGroupBinders (HsGroup { hs_valds :: forall p. HsGroup p -> HsValBinds p
hs_valds = HsValBinds GhcRn
val_decls, hs_tyclds :: forall p. HsGroup p -> [TyClGroup p]
hs_tyclds = [TyClGroup GhcRn]
tycl_decls,
hs_fords :: forall p. HsGroup p -> [LForeignDecl p]
hs_fords = [LForeignDecl GhcRn]
foreign_decls })
= HsValBinds GhcRn -> [IdP GhcRn]
forall (idL :: Pass) (idR :: Pass).
CollectPass (GhcPass idL) =>
HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
Instance of class: CollectPass of the constraint type CollectPass GhcRn
collectHsValBinders HsValBinds GhcRn
val_decls
[Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [TyClGroup GhcRn] -> [LForeignDecl GhcRn] -> [Name]
hsTyClForeignBinders [TyClGroup GhcRn]
tycl_decls [LForeignDecl GhcRn]
foreign_decls
hsTyClForeignBinders :: [TyClGroup GhcRn]
-> [LForeignDecl GhcRn]
-> [Name]
hsTyClForeignBinders :: [TyClGroup GhcRn] -> [LForeignDecl GhcRn] -> [Name]
hsTyClForeignBinders [TyClGroup GhcRn]
tycl_decls [LForeignDecl GhcRn]
foreign_decls
= (Located Name -> Name) -> [Located Name] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map Located Name -> Name
forall l e. GenLocated l e -> e
unLoc ([LForeignDecl GhcRn] -> [Located (IdP GhcRn)]
forall pass. [LForeignDecl pass] -> [Located (IdP pass)]
hsForeignDeclsBinders [LForeignDecl GhcRn]
foreign_decls)
[Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Located Name], [LFieldOcc GhcRn]) -> [Name]
getSelectorNames
((TyClGroup GhcRn -> ([Located Name], [LFieldOcc GhcRn]))
-> [TyClGroup GhcRn] -> ([Located Name], [LFieldOcc GhcRn])
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
External instance of the constraint type forall a b. (Monoid a, Monoid b) => Monoid (a, b)
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type Foldable []
foldMap ((Located (TyClDecl GhcRn) -> ([Located Name], [LFieldOcc GhcRn]))
-> [Located (TyClDecl GhcRn)]
-> ([Located Name], [LFieldOcc GhcRn])
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
External instance of the constraint type forall a b. (Monoid a, Monoid b) => Monoid (a, b)
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type Foldable []
foldMap Located (TyClDecl GhcRn) -> ([Located Name], [LFieldOcc GhcRn])
forall (p :: Pass).
Located (TyClDecl (GhcPass p))
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsLTyClDeclBinders ([Located (TyClDecl GhcRn)] -> ([Located Name], [LFieldOcc GhcRn]))
-> (TyClGroup GhcRn -> [Located (TyClDecl GhcRn)])
-> TyClGroup GhcRn
-> ([Located Name], [LFieldOcc GhcRn])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TyClGroup GhcRn -> [Located (TyClDecl GhcRn)]
forall pass. TyClGroup pass -> [LTyClDecl pass]
group_tyclds) [TyClGroup GhcRn]
tycl_decls
([Located Name], [LFieldOcc GhcRn])
-> ([Located Name], [LFieldOcc GhcRn])
-> ([Located Name], [LFieldOcc GhcRn])
forall a. Monoid a => a -> a -> a
External instance of the constraint type forall a b. (Monoid a, Monoid b) => Monoid (a, b)
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type forall a. Monoid [a]
`mappend`
(TyClGroup GhcRn -> ([Located Name], [LFieldOcc GhcRn]))
-> [TyClGroup GhcRn] -> ([Located Name], [LFieldOcc GhcRn])
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
External instance of the constraint type forall a b. (Monoid a, Monoid b) => Monoid (a, b)
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type Foldable []
foldMap ((LInstDecl GhcRn -> ([Located Name], [LFieldOcc GhcRn]))
-> [LInstDecl GhcRn] -> ([Located Name], [LFieldOcc GhcRn])
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
External instance of the constraint type forall a b. (Monoid a, Monoid b) => Monoid (a, b)
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type Foldable []
foldMap LInstDecl GhcRn -> ([Located Name], [LFieldOcc GhcRn])
forall (p :: Pass).
LInstDecl (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsLInstDeclBinders ([LInstDecl GhcRn] -> ([Located Name], [LFieldOcc GhcRn]))
-> (TyClGroup GhcRn -> [LInstDecl GhcRn])
-> TyClGroup GhcRn
-> ([Located Name], [LFieldOcc GhcRn])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TyClGroup GhcRn -> [LInstDecl GhcRn]
forall pass. TyClGroup pass -> [LInstDecl pass]
group_instds) [TyClGroup GhcRn]
tycl_decls)
where
getSelectorNames :: ([Located Name], [LFieldOcc GhcRn]) -> [Name]
getSelectorNames :: ([Located Name], [LFieldOcc GhcRn]) -> [Name]
getSelectorNames ([Located Name]
ns, [LFieldOcc GhcRn]
fs) = (Located Name -> Name) -> [Located Name] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map Located Name -> Name
forall l e. GenLocated l e -> e
unLoc [Located Name]
ns [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ (LFieldOcc GhcRn -> Name) -> [LFieldOcc GhcRn] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map (FieldOcc GhcRn -> Name
forall pass. FieldOcc pass -> XCFieldOcc pass
extFieldOcc (FieldOcc GhcRn -> Name)
-> (LFieldOcc GhcRn -> FieldOcc GhcRn) -> LFieldOcc GhcRn -> Name
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LFieldOcc GhcRn -> FieldOcc GhcRn
forall l e. GenLocated l e -> e
unLoc) [LFieldOcc GhcRn]
fs
hsLTyClDeclBinders :: Located (TyClDecl (GhcPass p))
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsLTyClDeclBinders :: Located (TyClDecl (GhcPass p))
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsLTyClDeclBinders (L SrcSpan
loc (FamDecl { tcdFam :: forall pass. TyClDecl pass -> FamilyDecl pass
tcdFam = FamilyDecl
{ fdLName :: forall pass. FamilyDecl pass -> Located (IdP pass)
fdLName = (L SrcSpan
_ IdP (GhcPass p)
name) } }))
= ([SrcSpan -> IdGhcP p -> GenLocated SrcSpan (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc IdGhcP p
IdP (GhcPass p)
name], [])
hsLTyClDeclBinders (L SrcSpan
loc (SynDecl
{ tcdLName :: forall pass. TyClDecl pass -> Located (IdP pass)
tcdLName = (L SrcSpan
_ IdP (GhcPass p)
name) }))
= ([SrcSpan -> IdGhcP p -> GenLocated SrcSpan (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc IdGhcP p
IdP (GhcPass p)
name], [])
hsLTyClDeclBinders (L SrcSpan
loc (ClassDecl
{ tcdLName :: forall pass. TyClDecl pass -> Located (IdP pass)
tcdLName = (L SrcSpan
_ IdP (GhcPass 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 }))
= (SrcSpan -> IdGhcP p -> GenLocated SrcSpan (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc IdGhcP p
IdP (GhcPass p)
cls_name GenLocated SrcSpan (IdGhcP p)
-> [GenLocated SrcSpan (IdGhcP p)]
-> [GenLocated SrcSpan (IdGhcP p)]
forall a. a -> [a] -> [a]
:
[ SrcSpan -> IdGhcP p -> GenLocated SrcSpan (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
fam_loc IdGhcP p
IdP (GhcPass p)
fam_name | (L SrcSpan
fam_loc (FamilyDecl
{ fdLName :: forall pass. FamilyDecl pass -> Located (IdP pass)
fdLName = L SrcSpan
_ IdP (GhcPass p)
fam_name })) <- [LFamilyDecl (GhcPass p)]
ats ]
[GenLocated SrcSpan (IdGhcP p)]
-> [GenLocated SrcSpan (IdGhcP p)]
-> [GenLocated SrcSpan (IdGhcP p)]
forall a. [a] -> [a] -> [a]
++
[ SrcSpan -> IdGhcP p -> GenLocated SrcSpan (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
mem_loc IdGhcP p
mem_name | (L SrcSpan
mem_loc (ClassOpSig XClassOpSig (GhcPass p)
_ Bool
False [Located (IdP (GhcPass p))]
ns LHsSigType (GhcPass p)
_)) <- [LSig (GhcPass p)]
sigs
, (L SrcSpan
_ IdGhcP p
mem_name) <- [GenLocated SrcSpan (IdGhcP p)]
[Located (IdP (GhcPass p))]
ns ]
, [])
hsLTyClDeclBinders (L SrcSpan
loc (DataDecl { tcdLName :: forall pass. TyClDecl pass -> Located (IdP pass)
tcdLName = (L SrcSpan
_ IdP (GhcPass p)
name)
, tcdDataDefn :: forall pass. TyClDecl pass -> HsDataDefn pass
tcdDataDefn = HsDataDefn (GhcPass p)
defn }))
= (\ ([GenLocated SrcSpan (IdGhcP p)]
xs, [LFieldOcc (GhcPass p)]
ys) -> (SrcSpan -> IdGhcP p -> GenLocated SrcSpan (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc IdGhcP p
IdP (GhcPass p)
name GenLocated SrcSpan (IdGhcP p)
-> [GenLocated SrcSpan (IdGhcP p)]
-> [GenLocated SrcSpan (IdGhcP p)]
forall a. a -> [a] -> [a]
: [GenLocated SrcSpan (IdGhcP p)]
xs, [LFieldOcc (GhcPass p)]
ys)) (([GenLocated SrcSpan (IdGhcP p)], [LFieldOcc (GhcPass p)])
-> ([GenLocated SrcSpan (IdGhcP p)], [LFieldOcc (GhcPass p)]))
-> ([GenLocated SrcSpan (IdGhcP p)], [LFieldOcc (GhcPass p)])
-> ([GenLocated SrcSpan (IdGhcP p)], [LFieldOcc (GhcPass p)])
forall a b. (a -> b) -> a -> b
$ HsDataDefn (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
forall (p :: Pass).
HsDataDefn (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsDataDefnBinders HsDataDefn (GhcPass p)
defn
hsForeignDeclsBinders :: [LForeignDecl pass] -> [Located (IdP pass)]
hsForeignDeclsBinders :: [LForeignDecl pass] -> [Located (IdP pass)]
hsForeignDeclsBinders [LForeignDecl pass]
foreign_decls
= [ SrcSpan -> IdP pass -> Located (IdP pass)
forall l e. l -> e -> GenLocated l e
L SrcSpan
decl_loc IdP pass
n
| L SrcSpan
decl_loc (ForeignImport { fd_name :: forall pass. ForeignDecl pass -> Located (IdP pass)
fd_name = L SrcSpan
_ IdP pass
n })
<- [LForeignDecl pass]
foreign_decls]
hsPatSynSelectors :: HsValBinds (GhcPass p) -> [IdP (GhcPass p)]
hsPatSynSelectors :: HsValBinds (GhcPass p) -> [IdP (GhcPass p)]
hsPatSynSelectors (ValBinds XValBinds (GhcPass p) (GhcPass p)
_ LHsBindsLR (GhcPass p) (GhcPass p)
_ [LSig (GhcPass p)]
_) = String -> [IdGhcP p]
forall a. String -> a
panic String
"hsPatSynSelectors"
hsPatSynSelectors (XValBindsLR (NValBinds [(RecFlag, LHsBindsLR (GhcPass p) (GhcPass p))]
binds [LSig GhcRn]
_))
= (LHsBind (GhcPass p) -> [IdGhcP p] -> [IdGhcP p])
-> [IdGhcP p] -> LHsBindsLR (GhcPass p) (GhcPass p) -> [IdGhcP p]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable Bag
foldr LHsBind (GhcPass p) -> [IdGhcP p] -> [IdGhcP p]
forall p. LHsBind p -> [IdP p] -> [IdP p]
addPatSynSelector [] (LHsBindsLR (GhcPass p) (GhcPass p) -> [IdGhcP p])
-> ([LHsBindsLR (GhcPass p) (GhcPass p)]
-> LHsBindsLR (GhcPass p) (GhcPass p))
-> [LHsBindsLR (GhcPass p) (GhcPass p)]
-> [IdGhcP p]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [LHsBindsLR (GhcPass p) (GhcPass p)]
-> LHsBindsLR (GhcPass p) (GhcPass p)
forall a. [Bag a] -> Bag a
unionManyBags ([LHsBindsLR (GhcPass p) (GhcPass p)] -> [IdGhcP p])
-> [LHsBindsLR (GhcPass p) (GhcPass p)] -> [IdGhcP p]
forall a b. (a -> b) -> a -> b
$ ((RecFlag, LHsBindsLR (GhcPass p) (GhcPass p))
-> LHsBindsLR (GhcPass p) (GhcPass p))
-> [(RecFlag, LHsBindsLR (GhcPass p) (GhcPass p))]
-> [LHsBindsLR (GhcPass p) (GhcPass p)]
forall a b. (a -> b) -> [a] -> [b]
map (RecFlag, LHsBindsLR (GhcPass p) (GhcPass p))
-> LHsBindsLR (GhcPass p) (GhcPass p)
forall a b. (a, b) -> b
snd [(RecFlag, LHsBindsLR (GhcPass p) (GhcPass p))]
binds
addPatSynSelector:: LHsBind p -> [IdP p] -> [IdP p]
addPatSynSelector :: LHsBind p -> [IdP p] -> [IdP p]
addPatSynSelector LHsBind p
bind [IdP p]
sels
| PatSynBind XPatSynBind p p
_ (PSB { psb_args :: forall idL idR.
PatSynBind idL idR -> HsPatSynDetails (Located (IdP idR))
psb_args = RecCon [RecordPatSynField (Located (IdP p))]
as }) <- LHsBind p -> HsBindLR p p
forall l e. GenLocated l e -> e
unLoc LHsBind p
bind
= (RecordPatSynField (Located (IdP p)) -> IdP p)
-> [RecordPatSynField (Located (IdP p))] -> [IdP p]
forall a b. (a -> b) -> [a] -> [b]
map (Located (IdP p) -> IdP p
forall l e. GenLocated l e -> e
unLoc (Located (IdP p) -> IdP p)
-> (RecordPatSynField (Located (IdP p)) -> Located (IdP p))
-> RecordPatSynField (Located (IdP p))
-> IdP p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RecordPatSynField (Located (IdP p)) -> Located (IdP p)
forall a. RecordPatSynField a -> a
recordPatSynSelectorId) [RecordPatSynField (Located (IdP p))]
as [IdP p] -> [IdP p] -> [IdP p]
forall a. [a] -> [a] -> [a]
++ [IdP p]
sels
| Bool
otherwise = [IdP p]
sels
getPatSynBinds :: [(RecFlag, LHsBinds id)] -> [PatSynBind id id]
getPatSynBinds :: [(RecFlag, LHsBinds id)] -> [PatSynBind id id]
getPatSynBinds [(RecFlag, LHsBinds id)]
binds
= [ PatSynBind id id
psb | (RecFlag
_, LHsBinds id
lbinds) <- [(RecFlag, LHsBinds id)]
binds
, L SrcSpan
_ (PatSynBind XPatSynBind id id
_ PatSynBind id id
psb) <- LHsBinds id -> [GenLocated SrcSpan (HsBindLR id id)]
forall a. Bag a -> [a]
bagToList LHsBinds id
lbinds ]
hsLInstDeclBinders :: LInstDecl (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsLInstDeclBinders :: LInstDecl (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsLInstDeclBinders (L SrcSpan
_ (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 }}))
= (LDataFamInstDecl (GhcPass p)
-> ([Located (IdGhcP p)], [LFieldOcc (GhcPass p)]))
-> [LDataFamInstDecl (GhcPass p)]
-> ([Located (IdGhcP p)], [LFieldOcc (GhcPass p)])
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
External instance of the constraint type forall a b. (Monoid a, Monoid b) => Monoid (a, b)
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type Foldable []
foldMap (DataFamInstDecl (GhcPass p)
-> ([Located (IdGhcP p)], [LFieldOcc (GhcPass p)])
forall (p :: Pass).
DataFamInstDecl (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsDataFamInstBinders (DataFamInstDecl (GhcPass p)
-> ([Located (IdGhcP p)], [LFieldOcc (GhcPass p)]))
-> (LDataFamInstDecl (GhcPass p) -> DataFamInstDecl (GhcPass p))
-> LDataFamInstDecl (GhcPass p)
-> ([Located (IdGhcP p)], [LFieldOcc (GhcPass p)])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LDataFamInstDecl (GhcPass p) -> DataFamInstDecl (GhcPass p)
forall l e. GenLocated l e -> e
unLoc) [LDataFamInstDecl (GhcPass p)]
dfis
hsLInstDeclBinders (L SrcSpan
_ (DataFamInstD { dfid_inst :: forall pass. InstDecl pass -> DataFamInstDecl pass
dfid_inst = DataFamInstDecl (GhcPass p)
fi }))
= DataFamInstDecl (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
forall (p :: Pass).
DataFamInstDecl (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsDataFamInstBinders DataFamInstDecl (GhcPass p)
fi
hsLInstDeclBinders (L SrcSpan
_ (TyFamInstD {})) = ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
forall a. Monoid a => a
External instance of the constraint type forall a b. (Monoid a, Monoid b) => Monoid (a, b)
External instance of the constraint type forall a. Monoid [a]
External instance of the constraint type forall a. Monoid [a]
mempty
hsDataFamInstBinders :: DataFamInstDecl (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsDataFamInstBinders :: DataFamInstDecl (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsDataFamInstBinders (DataFamInstDecl { dfid_eqn :: forall pass.
DataFamInstDecl pass -> FamInstEqn pass (HsDataDefn pass)
dfid_eqn = HsIB { hsib_body :: forall pass thing. HsImplicitBndrs pass thing -> thing
hsib_body =
FamEqn { feqn_rhs :: forall pass rhs. FamEqn pass rhs -> rhs
feqn_rhs = HsDataDefn (GhcPass p)
defn }}})
= HsDataDefn (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
forall (p :: Pass).
HsDataDefn (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsDataDefnBinders HsDataDefn (GhcPass p)
defn
hsDataDefnBinders :: HsDataDefn (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsDataDefnBinders :: HsDataDefn (GhcPass p)
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsDataDefnBinders (HsDataDefn { dd_cons :: forall pass. HsDataDefn pass -> [LConDecl pass]
dd_cons = [LConDecl (GhcPass p)]
cons })
= [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
forall (p :: Pass).
[LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsConDeclsBinders [LConDecl (GhcPass p)]
cons
type Seen p = [LFieldOcc (GhcPass p)] -> [LFieldOcc (GhcPass p)]
hsConDeclsBinders :: [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsConDeclsBinders :: [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
hsConDeclsBinders [LConDecl (GhcPass p)]
cons
= Seen p
-> [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
forall (p :: Pass).
Seen p
-> [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
go Seen p
forall a. a -> a
id [LConDecl (GhcPass p)]
cons
where
go :: Seen p -> [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
go :: Seen p
-> [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
go Seen p
_ [] = ([], [])
go Seen p
remSeen (LConDecl (GhcPass p)
r:[LConDecl (GhcPass p)]
rs)
= let loc :: SrcSpan
loc = LConDecl (GhcPass p) -> SrcSpan
forall l e. GenLocated l e -> l
getLoc LConDecl (GhcPass p)
r
in case LConDecl (GhcPass p) -> ConDecl (GhcPass p)
forall l e. GenLocated l e -> e
unLoc LConDecl (GhcPass p)
r of
ConDeclGADT { con_names :: forall pass. ConDecl pass -> [Located (IdP pass)]
con_names = [Located (IdP (GhcPass p))]
names, con_args :: forall pass. ConDecl pass -> HsConDeclDetails pass
con_args = HsConDeclDetails (GhcPass p)
args }
-> ((GenLocated SrcSpan (IdGhcP p) -> GenLocated SrcSpan (IdGhcP p))
-> [GenLocated SrcSpan (IdGhcP p)]
-> [GenLocated SrcSpan (IdGhcP p)]
forall a b. (a -> b) -> [a] -> [b]
map (SrcSpan -> IdGhcP p -> GenLocated SrcSpan (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc (IdGhcP p -> GenLocated SrcSpan (IdGhcP p))
-> (GenLocated SrcSpan (IdGhcP p) -> IdGhcP p)
-> GenLocated SrcSpan (IdGhcP p)
-> GenLocated SrcSpan (IdGhcP p)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpan (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc) [GenLocated SrcSpan (IdGhcP p)]
[Located (IdP (GhcPass p))]
names [GenLocated SrcSpan (IdGhcP p)]
-> [GenLocated SrcSpan (IdGhcP p)]
-> [GenLocated SrcSpan (IdGhcP p)]
forall a. [a] -> [a] -> [a]
++ [GenLocated SrcSpan (IdGhcP p)]
ns, [LFieldOcc (GhcPass p)]
flds [LFieldOcc (GhcPass p)] -> Seen p
forall a. [a] -> [a] -> [a]
++ [LFieldOcc (GhcPass p)]
fs)
where
(Seen p
remSeen', [LFieldOcc (GhcPass p)]
flds) = Seen p
-> HsConDeclDetails (GhcPass p)
-> (Seen p, [LFieldOcc (GhcPass p)])
forall (p :: Pass).
Seen p
-> HsConDeclDetails (GhcPass p)
-> (Seen p, [LFieldOcc (GhcPass p)])
get_flds Seen p
remSeen HsConDeclDetails (GhcPass p)
args
([GenLocated SrcSpan (IdGhcP p)]
ns, [LFieldOcc (GhcPass p)]
fs) = Seen p
-> [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
forall (p :: Pass).
Seen p
-> [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
go Seen p
remSeen' [LConDecl (GhcPass p)]
rs
ConDeclH98 { con_name :: forall pass. ConDecl pass -> Located (IdP pass)
con_name = Located (IdP (GhcPass p))
name, con_args :: forall pass. ConDecl pass -> HsConDeclDetails pass
con_args = HsConDeclDetails (GhcPass p)
args }
-> ([SrcSpan -> IdGhcP p -> GenLocated SrcSpan (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc (GenLocated SrcSpan (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc GenLocated SrcSpan (IdGhcP p)
Located (IdP (GhcPass p))
name)] [GenLocated SrcSpan (IdGhcP p)]
-> [GenLocated SrcSpan (IdGhcP p)]
-> [GenLocated SrcSpan (IdGhcP p)]
forall a. [a] -> [a] -> [a]
++ [GenLocated SrcSpan (IdGhcP p)]
ns, [LFieldOcc (GhcPass p)]
flds [LFieldOcc (GhcPass p)] -> Seen p
forall a. [a] -> [a] -> [a]
++ [LFieldOcc (GhcPass p)]
fs)
where
(Seen p
remSeen', [LFieldOcc (GhcPass p)]
flds) = Seen p
-> HsConDeclDetails (GhcPass p)
-> (Seen p, [LFieldOcc (GhcPass p)])
forall (p :: Pass).
Seen p
-> HsConDeclDetails (GhcPass p)
-> (Seen p, [LFieldOcc (GhcPass p)])
get_flds Seen p
remSeen HsConDeclDetails (GhcPass p)
args
([GenLocated SrcSpan (IdGhcP p)]
ns, [LFieldOcc (GhcPass p)]
fs) = Seen p
-> [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
forall (p :: Pass).
Seen p
-> [LConDecl (GhcPass p)]
-> ([Located (IdP (GhcPass p))], [LFieldOcc (GhcPass p)])
go Seen p
remSeen' [LConDecl (GhcPass p)]
rs
get_flds :: Seen p -> HsConDeclDetails (GhcPass p)
-> (Seen p, [LFieldOcc (GhcPass p)])
get_flds :: Seen p
-> HsConDeclDetails (GhcPass p)
-> (Seen p, [LFieldOcc (GhcPass p)])
get_flds Seen p
remSeen (RecCon Located [LConDeclField (GhcPass p)]
flds)
= (Seen p
remSeen', [LFieldOcc (GhcPass p)]
fld_names)
where
fld_names :: [LFieldOcc (GhcPass p)]
fld_names = Seen p
remSeen ((LConDeclField (GhcPass p) -> [LFieldOcc (GhcPass p)])
-> [LConDeclField (GhcPass p)] -> [LFieldOcc (GhcPass p)]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
External instance of the constraint type Foldable []
concatMap (ConDeclField (GhcPass p) -> [LFieldOcc (GhcPass p)]
forall pass. ConDeclField pass -> [LFieldOcc pass]
cd_fld_names (ConDeclField (GhcPass p) -> [LFieldOcc (GhcPass p)])
-> (LConDeclField (GhcPass p) -> ConDeclField (GhcPass p))
-> LConDeclField (GhcPass p)
-> [LFieldOcc (GhcPass p)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LConDeclField (GhcPass p) -> ConDeclField (GhcPass p)
forall l e. GenLocated l e -> e
unLoc) (Located [LConDeclField (GhcPass p)] -> [LConDeclField (GhcPass p)]
forall l e. GenLocated l e -> e
unLoc Located [LConDeclField (GhcPass p)]
flds))
remSeen' :: Seen p
remSeen' = (Seen p -> Seen p -> Seen p) -> Seen p -> [Seen p] -> Seen p
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldr Seen p -> Seen p -> Seen p
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) Seen p
remSeen
[(LFieldOcc (GhcPass p) -> LFieldOcc (GhcPass p) -> Bool)
-> LFieldOcc (GhcPass p) -> Seen p
forall a. (a -> a -> Bool) -> a -> [a] -> [a]
deleteBy (RdrName -> RdrName -> Bool
forall a. Eq a => a -> a -> Bool
External instance of the constraint type Eq RdrName
(==) (RdrName -> RdrName -> Bool)
-> (LFieldOcc (GhcPass p) -> RdrName)
-> LFieldOcc (GhcPass p)
-> LFieldOcc (GhcPass p)
-> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Located RdrName -> RdrName
forall l e. GenLocated l e -> e
unLoc (Located RdrName -> RdrName)
-> (LFieldOcc (GhcPass p) -> Located RdrName)
-> LFieldOcc (GhcPass p)
-> RdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FieldOcc (GhcPass p) -> Located RdrName
forall pass. FieldOcc pass -> Located RdrName
rdrNameFieldOcc (FieldOcc (GhcPass p) -> Located RdrName)
-> (LFieldOcc (GhcPass p) -> FieldOcc (GhcPass p))
-> LFieldOcc (GhcPass p)
-> Located RdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LFieldOcc (GhcPass p) -> FieldOcc (GhcPass p)
forall l e. GenLocated l e -> e
unLoc) LFieldOcc (GhcPass p)
v
| LFieldOcc (GhcPass p)
v <- [LFieldOcc (GhcPass p)]
fld_names]
get_flds Seen p
remSeen HsConDeclDetails (GhcPass p)
_
= (Seen p
remSeen, [])
lStmtsImplicits :: [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
lStmtsImplicits :: [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
lStmtsImplicits = [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
forall (idR :: Pass) (body :: * -> *).
[LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
hs_lstmts
where
hs_lstmts :: [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
hs_lstmts :: [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
hs_lstmts = (LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
-> [(SrcSpan, [Name])])
-> [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
External instance of the constraint type Foldable []
concatMap (StmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
-> [(SrcSpan, [Name])]
forall (idR :: Pass) (body :: * -> *).
StmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
-> [(SrcSpan, [Name])]
hs_stmt (StmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
-> [(SrcSpan, [Name])])
-> (LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
-> StmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR))))
-> LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
-> [(SrcSpan, [Name])]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
-> StmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
forall l e. GenLocated l e -> e
unLoc)
hs_stmt :: StmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
-> [(SrcSpan, [Name])]
hs_stmt :: StmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
-> [(SrcSpan, [Name])]
hs_stmt (BindStmt XBindStmt GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
_ LPat GhcRn
pat Located (body (GhcPass idR))
_) = LPat GhcRn -> [(SrcSpan, [Name])]
lPatImplicits LPat GhcRn
pat
hs_stmt (ApplicativeStmt XApplicativeStmt GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
_ [(SyntaxExpr (GhcPass idR), ApplicativeArg GhcRn)]
args Maybe (SyntaxExpr (GhcPass idR))
_) = ((SyntaxExprGhc idR, ApplicativeArg GhcRn) -> [(SrcSpan, [Name])])
-> [(SyntaxExprGhc idR, ApplicativeArg GhcRn)]
-> [(SrcSpan, [Name])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
External instance of the constraint type Foldable []
concatMap (SyntaxExprGhc idR, ApplicativeArg GhcRn) -> [(SrcSpan, [Name])]
forall {a}. (a, ApplicativeArg GhcRn) -> [(SrcSpan, [Name])]
do_arg [(SyntaxExpr (GhcPass idR), ApplicativeArg GhcRn)]
[(SyntaxExprGhc idR, ApplicativeArg GhcRn)]
args
where do_arg :: (a, ApplicativeArg GhcRn) -> [(SrcSpan, [Name])]
do_arg (a
_, ApplicativeArgOne { app_arg_pattern :: forall idL. ApplicativeArg idL -> LPat idL
app_arg_pattern = LPat GhcRn
pat }) = LPat GhcRn -> [(SrcSpan, [Name])]
lPatImplicits LPat GhcRn
pat
do_arg (a
_, ApplicativeArgMany { app_stmts :: forall idL. ApplicativeArg idL -> [ExprLStmt idL]
app_stmts = [ExprLStmt GhcRn]
stmts }) = [ExprLStmt GhcRn] -> [(SrcSpan, [Name])]
forall (idR :: Pass) (body :: * -> *).
[LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
hs_lstmts [ExprLStmt GhcRn]
stmts
hs_stmt (LetStmt XLetStmt GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
_ LHsLocalBindsLR GhcRn (GhcPass idR)
binds) = HsLocalBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])]
forall {idR :: Pass}.
HsLocalBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])]
hs_local_binds (LHsLocalBindsLR GhcRn (GhcPass idR)
-> HsLocalBindsLR GhcRn (GhcPass idR)
forall l e. GenLocated l e -> e
unLoc LHsLocalBindsLR GhcRn (GhcPass idR)
binds)
hs_stmt (BodyStmt {}) = []
hs_stmt (LastStmt {}) = []
hs_stmt (ParStmt XParStmt GhcRn (GhcPass idR) (Located (body (GhcPass idR)))
_ [ParStmtBlock GhcRn (GhcPass idR)]
xs HsExpr (GhcPass idR)
_ SyntaxExpr (GhcPass idR)
_) = [ExprLStmt GhcRn] -> [(SrcSpan, [Name])]
forall (idR :: Pass) (body :: * -> *).
[LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
hs_lstmts [ExprLStmt GhcRn
s | ParStmtBlock XParStmtBlock GhcRn (GhcPass idR)
_ [ExprLStmt GhcRn]
ss [IdP (GhcPass idR)]
_ SyntaxExpr (GhcPass idR)
_ <- [ParStmtBlock GhcRn (GhcPass idR)]
xs
, ExprLStmt GhcRn
s <- [ExprLStmt GhcRn]
ss]
hs_stmt (TransStmt { trS_stmts :: forall idL idR body. StmtLR idL idR body -> [ExprLStmt idL]
trS_stmts = [ExprLStmt GhcRn]
stmts }) = [ExprLStmt GhcRn] -> [(SrcSpan, [Name])]
forall (idR :: Pass) (body :: * -> *).
[LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
hs_lstmts [ExprLStmt GhcRn]
stmts
hs_stmt (RecStmt { recS_stmts :: forall idL idR body. StmtLR idL idR body -> [LStmtLR idL idR body]
recS_stmts = [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
ss }) = [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
forall (idR :: Pass) (body :: * -> *).
[LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
-> [(SrcSpan, [Name])]
hs_lstmts [LStmtLR GhcRn (GhcPass idR) (Located (body (GhcPass idR)))]
ss
hs_local_binds :: HsLocalBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])]
hs_local_binds (HsValBinds XHsValBinds GhcRn (GhcPass idR)
_ HsValBindsLR GhcRn (GhcPass idR)
val_binds) = HsValBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])]
forall (idR :: Pass).
HsValBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])]
hsValBindsImplicits HsValBindsLR GhcRn (GhcPass idR)
val_binds
hs_local_binds (HsIPBinds {}) = []
hs_local_binds (EmptyLocalBinds XEmptyLocalBinds GhcRn (GhcPass idR)
_) = []
hsValBindsImplicits :: HsValBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])]
hsValBindsImplicits :: HsValBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])]
hsValBindsImplicits (XValBindsLR (NValBinds [(RecFlag, LHsBinds GhcRn)]
binds [LSig GhcRn]
_))
= ((RecFlag, LHsBinds GhcRn) -> [(SrcSpan, [Name])])
-> [(RecFlag, LHsBinds GhcRn)] -> [(SrcSpan, [Name])]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
External instance of the constraint type Foldable []
concatMap (LHsBinds GhcRn -> [(SrcSpan, [Name])]
forall idR. LHsBindsLR GhcRn idR -> [(SrcSpan, [Name])]
lhsBindsImplicits (LHsBinds GhcRn -> [(SrcSpan, [Name])])
-> ((RecFlag, LHsBinds GhcRn) -> LHsBinds GhcRn)
-> (RecFlag, LHsBinds GhcRn)
-> [(SrcSpan, [Name])]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (RecFlag, LHsBinds GhcRn) -> LHsBinds GhcRn
forall a b. (a, b) -> b
snd) [(RecFlag, LHsBinds GhcRn)]
binds
hsValBindsImplicits (ValBinds XValBinds GhcRn (GhcPass idR)
_ LHsBindsLR GhcRn (GhcPass idR)
binds [LSig (GhcPass idR)]
_)
= LHsBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])]
forall idR. LHsBindsLR GhcRn idR -> [(SrcSpan, [Name])]
lhsBindsImplicits LHsBindsLR GhcRn (GhcPass idR)
binds
lhsBindsImplicits :: LHsBindsLR GhcRn idR -> [(SrcSpan, [Name])]
lhsBindsImplicits :: LHsBindsLR GhcRn idR -> [(SrcSpan, [Name])]
lhsBindsImplicits = ([(SrcSpan, [Name])] -> [(SrcSpan, [Name])] -> [(SrcSpan, [Name])])
-> (GenLocated SrcSpan (HsBindLR GhcRn idR) -> [(SrcSpan, [Name])])
-> [(SrcSpan, [Name])]
-> LHsBindsLR GhcRn idR
-> [(SrcSpan, [Name])]
forall r a. (r -> r -> r) -> (a -> r) -> r -> Bag a -> r
foldBag [(SrcSpan, [Name])] -> [(SrcSpan, [Name])] -> [(SrcSpan, [Name])]
forall a. [a] -> [a] -> [a]
(++) (HsBindLR GhcRn idR -> [(SrcSpan, [Name])]
forall {idR}. HsBindLR GhcRn idR -> [(SrcSpan, [Name])]
lhs_bind (HsBindLR GhcRn idR -> [(SrcSpan, [Name])])
-> (GenLocated SrcSpan (HsBindLR GhcRn idR) -> HsBindLR GhcRn idR)
-> GenLocated SrcSpan (HsBindLR GhcRn idR)
-> [(SrcSpan, [Name])]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpan (HsBindLR GhcRn idR) -> HsBindLR GhcRn idR
forall l e. GenLocated l e -> e
unLoc) []
where
lhs_bind :: HsBindLR GhcRn idR -> [(SrcSpan, [Name])]
lhs_bind (PatBind { pat_lhs :: forall idL idR. HsBindLR idL idR -> LPat idL
pat_lhs = LPat GhcRn
lpat }) = LPat GhcRn -> [(SrcSpan, [Name])]
lPatImplicits LPat GhcRn
lpat
lhs_bind HsBindLR GhcRn idR
_ = []
lPatImplicits :: LPat GhcRn -> [(SrcSpan, [Name])]
lPatImplicits :: LPat GhcRn -> [(SrcSpan, [Name])]
lPatImplicits = Located (Pat GhcRn) -> [(SrcSpan, [Name])]
LPat GhcRn -> [(SrcSpan, [Name])]
hs_lpat
where
hs_lpat :: Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
lpat = Pat GhcRn -> [(SrcSpan, [Name])]
hs_pat (Located (Pat GhcRn) -> Pat GhcRn
forall l e. GenLocated l e -> e
unLoc Located (Pat GhcRn)
lpat)
hs_lpats :: [Located (Pat GhcRn)] -> [(SrcSpan, [Name])]
hs_lpats = (Located (Pat GhcRn) -> [(SrcSpan, [Name])] -> [(SrcSpan, [Name])])
-> [(SrcSpan, [Name])]
-> [Located (Pat GhcRn)]
-> [(SrcSpan, [Name])]
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
External instance of the constraint type Foldable []
foldr (\Located (Pat GhcRn)
pat [(SrcSpan, [Name])]
rest -> Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
pat [(SrcSpan, [Name])] -> [(SrcSpan, [Name])] -> [(SrcSpan, [Name])]
forall a. [a] -> [a] -> [a]
++ [(SrcSpan, [Name])]
rest) []
hs_pat :: Pat GhcRn -> [(SrcSpan, [Name])]
hs_pat (LazyPat XLazyPat GhcRn
_ LPat GhcRn
pat) = Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
LPat GhcRn
pat
hs_pat (BangPat XBangPat GhcRn
_ LPat GhcRn
pat) = Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
LPat GhcRn
pat
hs_pat (AsPat XAsPat GhcRn
_ Located (IdP GhcRn)
_ LPat GhcRn
pat) = Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
LPat GhcRn
pat
hs_pat (ViewPat XViewPat GhcRn
_ Located (HsExpr GhcRn)
_ LPat GhcRn
pat) = Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
LPat GhcRn
pat
hs_pat (ParPat XParPat GhcRn
_ LPat GhcRn
pat) = Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
LPat GhcRn
pat
hs_pat (ListPat XListPat GhcRn
_ [LPat GhcRn]
pats) = [Located (Pat GhcRn)] -> [(SrcSpan, [Name])]
hs_lpats [Located (Pat GhcRn)]
[LPat GhcRn]
pats
hs_pat (TuplePat XTuplePat GhcRn
_ [LPat GhcRn]
pats Boxity
_) = [Located (Pat GhcRn)] -> [(SrcSpan, [Name])]
hs_lpats [Located (Pat GhcRn)]
[LPat GhcRn]
pats
hs_pat (SigPat XSigPat GhcRn
_ LPat GhcRn
pat HsPatSigType (NoGhcTc GhcRn)
_) = Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
LPat GhcRn
pat
hs_pat (ConPat {pat_con :: forall p. Pat p -> Located (ConLikeP p)
pat_con=Located (ConLikeP GhcRn)
con, pat_args :: forall p. Pat p -> HsConPatDetails p
pat_args=HsConPatDetails GhcRn
ps}) = Located Name -> HsConPatDetails GhcRn -> [(SrcSpan, [Name])]
details Located Name
Located (ConLikeP GhcRn)
con HsConPatDetails GhcRn
ps
hs_pat Pat GhcRn
_ = []
details :: Located Name -> HsConPatDetails GhcRn -> [(SrcSpan, [Name])]
details :: Located Name -> HsConPatDetails GhcRn -> [(SrcSpan, [Name])]
details Located Name
_ (PrefixCon [LPat GhcRn]
ps) = [Located (Pat GhcRn)] -> [(SrcSpan, [Name])]
hs_lpats [Located (Pat GhcRn)]
[LPat GhcRn]
ps
details Located Name
n (RecCon HsRecFields GhcRn (LPat GhcRn)
fs) =
[(SrcSpan
err_loc, [LPat GhcRn] -> [IdP GhcRn]
forall p. CollectPass p => [LPat p] -> [IdP p]
Instance of class: CollectPass of the constraint type CollectPass GhcRn
collectPatsBinders [Located (Pat GhcRn)]
[LPat GhcRn]
implicit_pats) | Just{} <- [HsRecFields GhcRn (Located (Pat GhcRn)) -> Maybe (Located Int)
forall p arg. HsRecFields p arg -> Maybe (Located Int)
rec_dotdot HsRecFields GhcRn (Located (Pat GhcRn))
HsRecFields GhcRn (LPat GhcRn)
fs] ]
[(SrcSpan, [Name])] -> [(SrcSpan, [Name])] -> [(SrcSpan, [Name])]
forall a. [a] -> [a] -> [a]
++ [Located (Pat GhcRn)] -> [(SrcSpan, [Name])]
hs_lpats [Located (Pat GhcRn)]
explicit_pats
where implicit_pats :: [Located (Pat GhcRn)]
implicit_pats = (GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> Located (Pat GhcRn))
-> [GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))]
-> [Located (Pat GhcRn)]
forall a b. (a -> b) -> [a] -> [b]
map (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))
-> Located (Pat GhcRn)
forall id arg. HsRecField' id arg -> arg
hsRecFieldArg (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))
-> Located (Pat GhcRn))
-> (GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> Located (Pat GhcRn)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))
forall l e. GenLocated l e -> e
unLoc) [GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))]
implicit
explicit_pats :: [Located (Pat GhcRn)]
explicit_pats = (GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> Located (Pat GhcRn))
-> [GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))]
-> [Located (Pat GhcRn)]
forall a b. (a -> b) -> [a] -> [b]
map (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))
-> Located (Pat GhcRn)
forall id arg. HsRecField' id arg -> arg
hsRecFieldArg (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))
-> Located (Pat GhcRn))
-> (GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> Located (Pat GhcRn)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))
forall l e. GenLocated l e -> e
unLoc) [GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))]
explicit
([GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))]
explicit, [GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))]
implicit) = [Either
(GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))))
(GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))))]
-> ([GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))],
[GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))])
forall a b. [Either a b] -> ([a], [b])
partitionEithers [if Bool
pat_explicit then GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> Either
(GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))))
(GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))))
forall a b. a -> Either a b
Left GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
fld else GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
-> Either
(GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))))
(GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))))
forall a b. b -> Either a b
Right GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
fld
| (Int
i, GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))
fld) <- [Int
0..] [Int]
-> [GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))]
-> [(Int,
GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn))))]
forall a b. [a] -> [b] -> [(a, b)]
`zip` HsRecFields GhcRn (Located (Pat GhcRn))
-> [GenLocated
SrcSpan (HsRecField' (FieldOcc GhcRn) (Located (Pat GhcRn)))]
forall p arg. HsRecFields p arg -> [LHsRecField p arg]
rec_flds HsRecFields GhcRn (Located (Pat GhcRn))
HsRecFields GhcRn (LPat GhcRn)
fs
, let pat_explicit :: Bool
pat_explicit =
Bool -> (Located Int -> Bool) -> Maybe (Located Int) -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
True ((Int
iInt -> Int -> Bool
forall a. Ord a => a -> a -> Bool
External instance of the constraint type Ord Int
<) (Int -> Bool) -> (Located Int -> Int) -> Located Int -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Located Int -> Int
forall l e. GenLocated l e -> e
unLoc)
(HsRecFields GhcRn (Located (Pat GhcRn)) -> Maybe (Located Int)
forall p arg. HsRecFields p arg -> Maybe (Located Int)
rec_dotdot HsRecFields GhcRn (Located (Pat GhcRn))
HsRecFields GhcRn (LPat GhcRn)
fs)]
err_loc :: SrcSpan
err_loc = SrcSpan
-> (Located Int -> SrcSpan) -> Maybe (Located Int) -> SrcSpan
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Located Name -> SrcSpan
forall l e. GenLocated l e -> l
getLoc Located Name
n) Located Int -> SrcSpan
forall l e. GenLocated l e -> l
getLoc (HsRecFields GhcRn (Located (Pat GhcRn)) -> Maybe (Located Int)
forall p arg. HsRecFields p arg -> Maybe (Located Int)
rec_dotdot HsRecFields GhcRn (Located (Pat GhcRn))
HsRecFields GhcRn (LPat GhcRn)
fs)
details Located Name
_ (InfixCon LPat GhcRn
p1 LPat GhcRn
p2) = Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
LPat GhcRn
p1 [(SrcSpan, [Name])] -> [(SrcSpan, [Name])] -> [(SrcSpan, [Name])]
forall a. [a] -> [a] -> [a]
++ Located (Pat GhcRn) -> [(SrcSpan, [Name])]
hs_lpat Located (Pat GhcRn)
LPat GhcRn
p2