{-# LANGUAGE CPP #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}
module Data.Record.Internal.GHC.TemplateHaskellStyle (
nameBase
, mkExpVar
, mkTyVar
, mkTyCon
, pattern ExpVar
, pattern TyVar
, pattern TyCon
, litE
, stringE
, pattern VarE
, pattern ConE
, recConE
, pattern RecUpdE
, appE
, listE
, lamE
, lamE1
, caseE
, appsE
, appTypeE
, tupE
, sigE
, intE
, parensT
, litT
, pattern VarT
, pattern ConT
, appT
, listT
, stringT
, appsT
, funT
, tupT
, varP
, conP
, bangP
, listP
, wildP
, bangType
, equalP
, pattern RecC
, forallRecC
, kindedTV
, tyVarBndrName
, sigD
, valD
, pattern DataD
, pattern DerivClause
, instanceD
, classD
, tySynEqn
, pattern TypeAnnotation
, pattern PragAnnD
, AnnDecl
, DerivStrategy(..)
, GhcPs
, HsLit
, HsTyLit
, LConDecl
, LDerivStrategy
, LHsDecl
, LHsDerivingClause
, LHsExpr
, LHsType
, LHsTyVarBndr
, LPat
, LTyFamInstDecl
, LRdrName
) where
import Data.List (foldl')
import Data.Record.Internal.GHC.Shim hiding (mkTyVar)
import Data.List.NonEmpty (NonEmpty(..))
import qualified Data.List.NonEmpty as NE
isTermVar, isTermCon, isTypeVar, isTypeCon :: LRdrName -> Bool
isTermVar :: LRdrName -> Bool
isTermVar = (OccName -> Bool) -> LRdrName -> Bool
checkNameType OccName -> Bool
isVarOcc
isTermCon :: LRdrName -> Bool
isTermCon = (OccName -> Bool) -> LRdrName -> Bool
checkNameType OccName -> Bool
isDataOcc
isTypeVar :: LRdrName -> Bool
isTypeVar = (OccName -> Bool) -> LRdrName -> Bool
checkNameType OccName -> Bool
isTvOcc
isTypeCon :: LRdrName -> Bool
isTypeCon = (OccName -> Bool) -> LRdrName -> Bool
checkNameType OccName -> Bool
isTcOcc
checkNameType :: (OccName -> Bool) -> LRdrName -> Bool
checkNameType :: (OccName -> Bool) -> LRdrName -> Bool
checkNameType OccName -> Bool
f (L SrcSpan
_ RdrName
n) = OccName -> Bool
f (RdrName -> OccName
rdrNameOcc RdrName
n)
nameBase :: LRdrName -> String
nameBase :: LRdrName -> String
nameBase = OccName -> String
occNameString (OccName -> String) -> (LRdrName -> OccName) -> LRdrName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RdrName -> OccName
rdrNameOcc (RdrName -> OccName)
-> (LRdrName -> RdrName) -> LRdrName -> OccName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LRdrName -> RdrName
forall l e. GenLocated l e -> e
unLoc
mkExpVar :: SrcSpan -> String -> LRdrName
mkExpVar :: SrcSpan -> String -> LRdrName
mkExpVar SrcSpan
l = SrcSpan -> RdrName -> LRdrName
forall l e. l -> e -> GenLocated l e
L SrcSpan
l (RdrName -> LRdrName) -> (String -> RdrName) -> String -> LRdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OccName -> RdrName
mkRdrUnqual (OccName -> RdrName) -> (String -> OccName) -> String -> RdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> OccName
mkVarOcc
mkTyVar :: SrcSpan -> String -> LRdrName
mkTyVar :: SrcSpan -> String -> LRdrName
mkTyVar SrcSpan
l = SrcSpan -> RdrName -> LRdrName
forall l e. l -> e -> GenLocated l e
L SrcSpan
l (RdrName -> LRdrName) -> (String -> RdrName) -> String -> LRdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OccName -> RdrName
mkRdrUnqual (OccName -> RdrName) -> (String -> OccName) -> String -> RdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> OccName
mkTyVarOcc
mkTyCon :: SrcSpan -> String -> LRdrName
mkTyCon :: SrcSpan -> String -> LRdrName
mkTyCon SrcSpan
l = SrcSpan -> RdrName -> LRdrName
forall l e. l -> e -> GenLocated l e
L SrcSpan
l (RdrName -> LRdrName) -> (String -> RdrName) -> String -> LRdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OccName -> RdrName
mkRdrUnqual (OccName -> RdrName) -> (String -> OccName) -> String -> RdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> OccName
mkTcOcc
viewExpVar :: LRdrName -> Maybe String
viewExpVar :: LRdrName -> Maybe String
viewExpVar LRdrName
n | LRdrName -> Bool
isTermVar LRdrName
n = String -> Maybe String
forall a. a -> Maybe a
Just (LRdrName -> String
nameBase LRdrName
n)
viewExpVar LRdrName
_otherwise = Maybe String
forall a. Maybe a
Nothing
viewTyVar :: LRdrName -> Maybe String
viewTyVar :: LRdrName -> Maybe String
viewTyVar LRdrName
n | LRdrName -> Bool
isTypeVar LRdrName
n = String -> Maybe String
forall a. a -> Maybe a
Just (LRdrName -> String
nameBase LRdrName
n)
viewTyVar LRdrName
_otherwise = Maybe String
forall a. Maybe a
Nothing
viewTyCon :: LRdrName -> Maybe String
viewTyCon :: LRdrName -> Maybe String
viewTyCon LRdrName
n | LRdrName -> Bool
isTypeCon LRdrName
n = String -> Maybe String
forall a. a -> Maybe a
Just (LRdrName -> String
nameBase LRdrName
n)
viewTyCon LRdrName
_otherwise = Maybe String
forall a. Maybe a
Nothing
pattern ExpVar :: String -> LRdrName
pattern $mExpVar :: forall {r}. LRdrName -> (String -> r) -> ((# #) -> r) -> r
ExpVar n <- (viewExpVar -> Just n)
pattern TyVar :: String -> LRdrName
pattern $mTyVar :: forall {r}. LRdrName -> (String -> r) -> ((# #) -> r) -> r
TyVar n <- (viewTyVar -> Just n)
pattern TyCon :: String -> LRdrName
pattern $mTyCon :: forall {r}. LRdrName -> (String -> r) -> ((# #) -> r) -> r
TyCon n <- (viewTyCon -> Just n)
varE :: HasCallStack => LRdrName -> LHsExpr GhcPs
varE :: HasCallStack => LRdrName -> LHsExpr GhcPs
varE LRdrName
name
| LRdrName -> Bool
isTermVar LRdrName
name = LRdrName -> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$ XVar GhcPs -> LIdP GhcPs -> HsExpr GhcPs
forall p. XVar p -> LIdP p -> HsExpr p
HsVar XVar GhcPs
forall a. HasDefaultExt a => a
defExt (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name)
| Bool
otherwise = String -> GenLocated SrcSpanAnnA (HsExpr GhcPs)
forall a. HasCallStack => String -> a
error String
"varE: incorrect name type"
viewVarE :: LHsExpr GhcPs -> Maybe LRdrName
viewVarE :: LHsExpr GhcPs -> Maybe LRdrName
viewVarE (L SrcSpanAnnA
_ (HsVar XVar GhcPs
_ (LIdP GhcPs -> LRdrName
LocatedN RdrName -> LRdrName
forall a e. LocatedAn a e -> Located e
reLoc -> LRdrName
name))) | LRdrName -> Bool
isTermVar LRdrName
name = LRdrName -> Maybe LRdrName
forall a. a -> Maybe a
Just LRdrName
name
viewVarE LHsExpr GhcPs
_ = Maybe LRdrName
forall a. Maybe a
Nothing
pattern VarE :: HasCallStack => () => LRdrName -> LHsExpr GhcPs
pattern $mVarE :: forall {r}.
HasCallStack =>
LHsExpr GhcPs -> (LRdrName -> r) -> ((# #) -> r) -> r
$bVarE :: HasCallStack => LRdrName -> LHsExpr GhcPs
VarE name <- (viewVarE -> Just name)
where
VarE = HasCallStack => LRdrName -> LHsExpr GhcPs
LRdrName -> LHsExpr GhcPs
varE
conE :: HasCallStack => LRdrName -> LHsExpr GhcPs
conE :: HasCallStack => LRdrName -> LHsExpr GhcPs
conE LRdrName
name
| LRdrName -> Bool
isTermCon LRdrName
name = LRdrName -> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$ XVar GhcPs -> LIdP GhcPs -> HsExpr GhcPs
forall p. XVar p -> LIdP p -> HsExpr p
HsVar XVar GhcPs
forall a. HasDefaultExt a => a
defExt (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name)
| Bool
otherwise = String -> GenLocated SrcSpanAnnA (HsExpr GhcPs)
forall a. HasCallStack => String -> a
error String
"conE: incorrect name type"
viewConE :: LHsExpr GhcPs -> Maybe LRdrName
viewConE :: LHsExpr GhcPs -> Maybe LRdrName
viewConE (L SrcSpanAnnA
_ (HsVar XVar GhcPs
_ (LIdP GhcPs -> LRdrName
LocatedN RdrName -> LRdrName
forall a e. LocatedAn a e -> Located e
reLoc -> LRdrName
name))) | LRdrName -> Bool
isTermCon LRdrName
name = LRdrName -> Maybe LRdrName
forall a. a -> Maybe a
Just LRdrName
name
viewConE LHsExpr GhcPs
_ = Maybe LRdrName
forall a. Maybe a
Nothing
pattern ConE :: HasCallStack => () => LRdrName -> LHsExpr GhcPs
pattern $mConE :: forall {r}.
HasCallStack =>
LHsExpr GhcPs -> (LRdrName -> r) -> ((# #) -> r) -> r
$bConE :: HasCallStack => LRdrName -> LHsExpr GhcPs
ConE name <- (viewConE -> Just name)
where
ConE = HasCallStack => LRdrName -> LHsExpr GhcPs
LRdrName -> LHsExpr GhcPs
conE
litE :: HsLit GhcPs -> LHsExpr GhcPs
litE :: HsLit GhcPs -> LHsExpr GhcPs
litE = HsExpr GhcPs -> GenLocated SrcSpanAnnA (HsExpr GhcPs)
forall a an. a -> LocatedAn an a
noLocA (HsExpr GhcPs -> GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> (HsLit GhcPs -> HsExpr GhcPs)
-> HsLit GhcPs
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XLitE GhcPs -> HsLit GhcPs -> HsExpr GhcPs
forall p. XLitE p -> HsLit p -> HsExpr p
HsLit XLitE GhcPs
EpAnnCO
forall a. HasDefaultExt a => a
defExt
stringE :: String -> LHsExpr GhcPs
stringE :: String -> LHsExpr GhcPs
stringE = HsLit GhcPs -> LHsExpr GhcPs
HsLit GhcPs -> GenLocated SrcSpanAnnA (HsExpr GhcPs)
litE (HsLit GhcPs -> GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> (String -> HsLit GhcPs)
-> String
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XHsString GhcPs -> FastString -> HsLit GhcPs
forall x. XHsString x -> FastString -> HsLit x
HsString XHsString GhcPs
SourceText
NoSourceText (FastString -> HsLit GhcPs)
-> (String -> FastString) -> String -> HsLit GhcPs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> FastString
fsLit
recConE :: LRdrName -> [(LRdrName, LHsExpr GhcPs)] -> LHsExpr GhcPs
recConE :: LRdrName -> [(LRdrName, LHsExpr GhcPs)] -> LHsExpr GhcPs
recConE = \LRdrName
recName -> LRdrName -> [LHsRecField GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
mkRec LRdrName
recName ([GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
-> GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> ([(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))])
-> [(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))))
-> [(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
forall a b. (a -> b) -> [a] -> [b]
map ((LRdrName
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))))
-> (LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry LRdrName -> LHsExpr GhcPs -> LHsRecField GhcPs (LHsExpr GhcPs)
LRdrName
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))
mkFld)
where
mkRec :: LRdrName -> [LHsRecField GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
mkRec :: LRdrName -> [LHsRecField GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
mkRec LRdrName
name [LHsRecField GhcPs (LHsExpr GhcPs)]
fields = LRdrName -> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$
XRecordCon GhcPs
-> XRec GhcPs (ConLikeP GhcPs)
-> HsRecordBinds GhcPs
-> HsExpr GhcPs
forall p.
XRecordCon p -> XRec p (ConLikeP p) -> HsRecordBinds p -> HsExpr p
RecordCon XRecordCon GhcPs
forall a. HasDefaultExt a => a
defExt (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name) ([LHsRecField GhcPs (LHsExpr GhcPs)]
-> Maybe (XRec GhcPs RecFieldsDotDot) -> HsRecordBinds GhcPs
forall p arg.
[LHsRecField p arg]
-> Maybe (XRec p RecFieldsDotDot) -> HsRecFields p arg
HsRecFields [LHsRecField GhcPs (LHsExpr GhcPs)]
fields Maybe (XRec GhcPs RecFieldsDotDot)
Maybe (GenLocated SrcSpan RecFieldsDotDot)
forall a. Maybe a
Nothing)
mkFld :: LRdrName -> LHsExpr GhcPs -> LHsRecField GhcPs (LHsExpr GhcPs)
mkFld :: LRdrName -> LHsExpr GhcPs -> LHsRecField GhcPs (LHsExpr GhcPs)
mkFld LRdrName
name LHsExpr GhcPs
val = LRdrName
-> HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LHsRecField GhcPs (LHsExpr GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LHsRecField GhcPs (LHsExpr GhcPs))
-> HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LHsRecField GhcPs (LHsExpr GhcPs)
forall a b. (a -> b) -> a -> b
$
#if __GLASGOW_HASKELL__ >= 904
XHsFieldBind (GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
-> GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs)
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> Bool
-> HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall lhs rhs.
XHsFieldBind lhs -> lhs -> rhs -> Bool -> HsFieldBind lhs rhs
HsFieldBind XHsFieldBind (GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs))
EpAnn [AddEpAnn]
forall a. HasDefaultExt a => a
defExt
#elif __GLASGOW_HASKELL__ >= 902
HsRecField defExt
#else
HsRecField
#endif
(LRdrName
-> FieldOcc GhcPs -> GenLocated (SrcAnn NoEpAnns) (FieldOcc GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (LocatedN RdrName -> FieldOcc GhcPs
mkFieldOcc (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name))) LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
val Bool
False
recUpdE :: LHsExpr GhcPs -> [(LRdrName, LHsExpr GhcPs)] -> LHsExpr GhcPs
recUpdE :: LHsExpr GhcPs -> [(LRdrName, LHsExpr GhcPs)] -> LHsExpr GhcPs
recUpdE = \LHsExpr GhcPs
recExpr -> LHsExpr GhcPs -> [LHsRecUpdField GhcPs] -> LHsExpr GhcPs
updRec LHsExpr GhcPs
recExpr ([GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
-> GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> ([(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))])
-> [(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))))
-> [(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
forall a b. (a -> b) -> [a] -> [b]
map ((LRdrName
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))))
-> (LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry LRdrName -> LHsExpr GhcPs -> LHsRecUpdField GhcPs
LRdrName
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))
updFld)
where
updRec :: LHsExpr GhcPs -> [LHsRecUpdField GhcPs] -> LHsExpr GhcPs
updRec :: LHsExpr GhcPs -> [LHsRecUpdField GhcPs] -> LHsExpr GhcPs
updRec LHsExpr GhcPs
expr [LHsRecUpdField GhcPs]
fields = GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
expr (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$
XRecordUpd GhcPs
-> LHsExpr GhcPs
-> Either [LHsRecUpdField GhcPs] [LHsRecUpdProj GhcPs]
-> HsExpr GhcPs
forall p.
XRecordUpd p
-> LHsExpr p
-> Either [LHsRecUpdField p] [LHsRecUpdProj p]
-> HsExpr p
RecordUpd XRecordUpd GhcPs
forall a. HasDefaultExt a => a
defExt LHsExpr GhcPs
expr
#if __GLASGOW_HASKELL__ >= 902
(Either [LHsRecUpdField GhcPs] [LHsRecUpdProj GhcPs]
-> HsExpr GhcPs)
-> Either [LHsRecUpdField GhcPs] [LHsRecUpdProj GhcPs]
-> HsExpr GhcPs
forall a b. (a -> b) -> a -> b
$ [GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
-> Either
[GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
[GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (FieldLabelStrings GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
forall a b. a -> Either a b
Left
#endif
[LHsRecUpdField GhcPs]
[GenLocated
SrcSpanAnnA
(HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
fields
updFld :: LRdrName -> LHsExpr GhcPs -> LHsRecUpdField GhcPs
updFld :: LRdrName -> LHsExpr GhcPs -> LHsRecUpdField GhcPs
updFld LRdrName
name LHsExpr GhcPs
val = LRdrName
-> HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LHsRecUpdField GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LHsRecUpdField GhcPs)
-> HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LHsRecUpdField GhcPs
forall a b. (a -> b) -> a -> b
$
#if __GLASGOW_HASKELL__ >= 904
XHsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
-> GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs)
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> Bool
-> HsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
(GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall lhs rhs.
XHsFieldBind lhs -> lhs -> rhs -> Bool -> HsFieldBind lhs rhs
HsFieldBind
#else
HsRecField
#endif
#if __GLASGOW_HASKELL__ >= 902
XHsFieldBind
(GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs))
EpAnn [AddEpAnn]
forall a. HasDefaultExt a => a
defExt
#endif
(LRdrName
-> AmbiguousFieldOcc GhcPs
-> GenLocated (SrcAnn NoEpAnns) (AmbiguousFieldOcc GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (LocatedN RdrName -> AmbiguousFieldOcc GhcPs
mkAmbiguousFieldOcc (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name))) LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
val Bool
False
viewRecUpdE ::
LHsExpr GhcPs
-> Maybe (LHsExpr GhcPs, [(LRdrName, LHsExpr GhcPs)])
viewRecUpdE :: LHsExpr GhcPs -> Maybe (LHsExpr GhcPs, [(LRdrName, LHsExpr GhcPs)])
viewRecUpdE (L SrcSpanAnnA
_ (RecordUpd XRecordUpd GhcPs
_ LHsExpr GhcPs
recExpr Either [LHsRecUpdField GhcPs] [LHsRecUpdProj GhcPs]
fields)) =
(LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
recExpr,) ([(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> (GenLocated SrcSpanAnnA (HsExpr GhcPs),
[(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]))
-> Maybe [(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> Maybe
(GenLocated SrcSpanAnnA (HsExpr GhcPs),
[(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))])
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> Either [LHsRecUpdField GhcPs] [LHsRecUpdProj GhcPs]
-> Maybe [(LRdrName, LHsExpr GhcPs)]
simpleRecordUpdates Either [LHsRecUpdField GhcPs] [LHsRecUpdProj GhcPs]
fields
viewRecUpdE LHsExpr GhcPs
_otherwise = Maybe (LHsExpr GhcPs, [(LRdrName, LHsExpr GhcPs)])
Maybe
(GenLocated SrcSpanAnnA (HsExpr GhcPs),
[(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))])
forall a. Maybe a
Nothing
pattern RecUpdE :: LHsExpr GhcPs -> [(LRdrName, LHsExpr GhcPs)] -> LHsExpr GhcPs
pattern $mRecUpdE :: forall {r}.
LHsExpr GhcPs
-> (LHsExpr GhcPs -> [(LRdrName, LHsExpr GhcPs)] -> r)
-> ((# #) -> r)
-> r
$bRecUpdE :: LHsExpr GhcPs -> [(LRdrName, LHsExpr GhcPs)] -> LHsExpr GhcPs
RecUpdE recExpr fields <- (viewRecUpdE -> Just (recExpr, fields))
where
RecUpdE = LHsExpr GhcPs -> [(LRdrName, LHsExpr GhcPs)] -> LHsExpr GhcPs
recUpdE
appE :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
appE :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
appE LHsExpr GhcPs
a LHsExpr GhcPs
b = LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
forall (id :: Pass).
LHsExpr (GhcPass id)
-> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkHsApp LHsExpr GhcPs
a LHsExpr GhcPs
b
listE :: [LHsExpr GhcPs] -> LHsExpr GhcPs
listE :: [LHsExpr GhcPs] -> LHsExpr GhcPs
listE [LHsExpr GhcPs]
es = [GenLocated SrcSpanAnnA (HsExpr GhcPs)]
-> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc [LHsExpr GhcPs]
[GenLocated SrcSpanAnnA (HsExpr GhcPs)]
es (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$ XExplicitList GhcPs -> [LHsExpr GhcPs] -> HsExpr GhcPs
forall p. XExplicitList p -> [LHsExpr p] -> HsExpr p
ExplicitList XExplicitList GhcPs
forall a. HasDefaultExt a => a
defExt
#if __GLASGOW_HASKELL__ < 902
Nothing
#endif
[LHsExpr GhcPs]
es
lamE :: NonEmpty (LPat GhcPs) -> LHsExpr GhcPs -> LHsExpr GhcPs
lamE :: NonEmpty (LPat GhcPs) -> LHsExpr GhcPs -> LHsExpr GhcPs
lamE NonEmpty (LPat GhcPs)
pats LHsExpr GhcPs
body = GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
body (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$
XLam GhcPs -> MatchGroup GhcPs (LHsExpr GhcPs) -> HsExpr GhcPs
forall p. XLam p -> MatchGroup p (LHsExpr p) -> HsExpr p
HsLam XLam GhcPs
forall a. HasDefaultExt a => a
defExt (MatchGroup GhcPs (LHsExpr GhcPs) -> HsExpr GhcPs)
-> MatchGroup GhcPs (LHsExpr GhcPs) -> HsExpr GhcPs
forall a b. (a -> b) -> a -> b
$
#if __GLASGOW_HASKELL__ >= 906
XMG GhcPs (LHsExpr GhcPs)
-> XRec GhcPs [LMatch GhcPs (LHsExpr GhcPs)]
-> MatchGroup GhcPs (LHsExpr GhcPs)
forall p body.
XMG p body -> XRec p [LMatch p body] -> MatchGroup p body
MG XMG GhcPs (LHsExpr GhcPs)
forall a. HasDefaultExt a => a
defExt (GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> [GenLocated
SrcSpanAnnA (Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
-> XRec GhcPs [LMatch GhcPs (LHsExpr GhcPs)]
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
body [GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated
SrcSpanAnnA (Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs)))
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
body Match GhcPs (LHsExpr GhcPs)
Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
match])
#else
MG defExt (inheritLoc body [inheritLoc body match]) Generated
#endif
where
match :: Match GhcPs (LHsExpr GhcPs)
match :: Match GhcPs (LHsExpr GhcPs)
match = XCMatch GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> HsMatchContext GhcPs
-> [LPat GhcPs]
-> GRHSs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall p body.
XCMatch p body
-> HsMatchContext p -> [LPat p] -> GRHSs p body -> Match p body
Match XCMatch GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
EpAnn [AddEpAnn]
forall a. HasDefaultExt a => a
defExt HsMatchContext GhcPs
forall p. HsMatchContext p
LambdaExpr (NonEmpty (GenLocated SrcSpanAnnA (Pat GhcPs))
-> [GenLocated SrcSpanAnnA (Pat GhcPs)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (LPat GhcPs)
NonEmpty (GenLocated SrcSpanAnnA (Pat GhcPs))
pats) (LHsExpr GhcPs -> GRHSs GhcPs (LHsExpr GhcPs)
simpleGHRSs LHsExpr GhcPs
body)
lamE1 :: LPat GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
lamE1 :: LPat GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
lamE1 LPat GhcPs
p = NonEmpty (LPat GhcPs) -> LHsExpr GhcPs -> LHsExpr GhcPs
lamE (LPat GhcPs
GenLocated SrcSpanAnnA (Pat GhcPs)
p GenLocated SrcSpanAnnA (Pat GhcPs)
-> [GenLocated SrcSpanAnnA (Pat GhcPs)]
-> NonEmpty (GenLocated SrcSpanAnnA (Pat GhcPs))
forall a. a -> [a] -> NonEmpty a
:| [])
caseE :: LHsExpr GhcPs -> [(LPat GhcPs, LHsExpr GhcPs)] -> LHsExpr GhcPs
caseE :: LHsExpr GhcPs -> [(LPat GhcPs, LHsExpr GhcPs)] -> LHsExpr GhcPs
caseE LHsExpr GhcPs
x [(LPat GhcPs, LHsExpr GhcPs)]
alts = GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
x (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$
#if __GLASGOW_HASKELL__ >= 906
XCase GhcPs
-> LHsExpr GhcPs
-> MatchGroup GhcPs (LHsExpr GhcPs)
-> HsExpr GhcPs
forall p.
XCase p -> LHsExpr p -> MatchGroup p (LHsExpr p) -> HsExpr p
HsCase XCase GhcPs
forall a. HasDefaultExt a => a
defExt LHsExpr GhcPs
x (XMG GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> XRec
GhcPs [LMatch GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> MatchGroup GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall p body.
XMG p body -> XRec p [LMatch p body] -> MatchGroup p body
MG XMG GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
Origin
forall a. HasDefaultExt a => a
defExt (GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> [GenLocated
SrcSpanAnnA (Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
-> GenLocated
SrcSpanAnnL
[GenLocated
SrcSpanAnnA (Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
x (((GenLocated SrcSpanAnnA (Pat GhcPs),
GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated
SrcSpanAnnA (Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))))
-> [(GenLocated SrcSpanAnnA (Pat GhcPs),
GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> [GenLocated
SrcSpanAnnA (Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs)))]
forall a b. (a -> b) -> [a] -> [b]
map (LPat GhcPs, LHsExpr GhcPs) -> LMatch GhcPs (LHsExpr GhcPs)
(GenLocated SrcSpanAnnA (Pat GhcPs),
GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated
SrcSpanAnnA (Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs)))
mkAlt [(LPat GhcPs, LHsExpr GhcPs)]
[(GenLocated SrcSpanAnnA (Pat GhcPs),
GenLocated SrcSpanAnnA (HsExpr GhcPs))]
alts)))
#else
HsCase defExt x (MG defExt (inheritLoc x (map mkAlt alts)) Generated)
#endif
where
mkAlt :: (LPat GhcPs, LHsExpr GhcPs) -> LMatch GhcPs (LHsExpr GhcPs)
mkAlt :: (LPat GhcPs, LHsExpr GhcPs) -> LMatch GhcPs (LHsExpr GhcPs)
mkAlt (LPat GhcPs
pat, LHsExpr GhcPs
body) = GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LMatch GhcPs (LHsExpr GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
x (Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LMatch GhcPs (LHsExpr GhcPs))
-> Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LMatch GhcPs (LHsExpr GhcPs)
forall a b. (a -> b) -> a -> b
$
XCMatch GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> HsMatchContext GhcPs
-> [LPat GhcPs]
-> GRHSs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall p body.
XCMatch p body
-> HsMatchContext p -> [LPat p] -> GRHSs p body -> Match p body
Match XCMatch GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
EpAnn [AddEpAnn]
forall a. HasDefaultExt a => a
defExt HsMatchContext GhcPs
forall p. HsMatchContext p
CaseAlt [LPat GhcPs
pat] (LHsExpr GhcPs -> GRHSs GhcPs (LHsExpr GhcPs)
simpleGHRSs LHsExpr GhcPs
body)
appsE :: LHsExpr GhcPs -> [LHsExpr GhcPs] -> LHsExpr GhcPs
appsE :: LHsExpr GhcPs -> [LHsExpr GhcPs] -> LHsExpr GhcPs
appsE = (GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> [GenLocated SrcSpanAnnA (HsExpr GhcPs)]
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: Type -> Type) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
appE
appTypeE :: LHsExpr GhcPs -> LHsType GhcPs -> LHsExpr GhcPs
appTypeE :: LHsExpr GhcPs -> XRec GhcPs (HsType GhcPs) -> LHsExpr GhcPs
appTypeE LHsExpr GhcPs
expr XRec GhcPs (HsType GhcPs)
typ = GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
expr (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$
#if __GLASGOW_HASKELL__ >= 906
XAppTypeE GhcPs
-> LHsExpr GhcPs
-> LHsToken "@" GhcPs
-> LHsWcType (NoGhcTc GhcPs)
-> HsExpr GhcPs
forall p.
XAppTypeE p
-> LHsExpr p -> LHsToken "@" p -> LHsWcType (NoGhcTc p) -> HsExpr p
HsAppType XAppTypeE GhcPs
NoExtField
noExtField LHsExpr GhcPs
expr LHsToken "@" GhcPs
GenLocated TokenLocation (HsToken "@")
forall (tok :: Symbol). GenLocated TokenLocation (HsToken tok)
noHsTok (XHsWC GhcPs (GenLocated SrcSpanAnnA (HsType GhcPs))
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsType GhcPs))
forall pass thing.
XHsWC pass thing -> thing -> HsWildCardBndrs pass thing
HsWC XHsWC GhcPs (GenLocated SrcSpanAnnA (HsType GhcPs))
NoExtField
forall a. HasDefaultExt a => a
defExt XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
typ)
#else
HsAppType
#if __GLASGOW_HASKELL__ >= 902
(toSrcSpan expr)
#else
defExt
#endif
expr
(HsWC defExt typ)
#endif
tupE :: NonEmpty (LHsExpr GhcPs) -> LHsExpr GhcPs
tupE :: NonEmpty (LHsExpr GhcPs) -> LHsExpr GhcPs
tupE NonEmpty (LHsExpr GhcPs)
xs = NonEmpty (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc NonEmpty (LHsExpr GhcPs)
NonEmpty (GenLocated SrcSpanAnnA (HsExpr GhcPs))
xs (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$
XExplicitTuple GhcPs -> [HsTupArg GhcPs] -> Boxity -> HsExpr GhcPs
forall p. XExplicitTuple p -> [HsTupArg p] -> Boxity -> HsExpr p
ExplicitTuple
XExplicitTuple GhcPs
forall a. HasDefaultExt a => a
defExt
[NonEmpty (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> HsTupArg GhcPs -> HsTupArg GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc NonEmpty (LHsExpr GhcPs)
NonEmpty (GenLocated SrcSpanAnnA (HsExpr GhcPs))
xs (XPresent GhcPs -> LHsExpr GhcPs -> HsTupArg GhcPs
forall id. XPresent id -> LHsExpr id -> HsTupArg id
Present XPresent GhcPs
forall a. HasDefaultExt a => a
defExt LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
x) | GenLocated SrcSpanAnnA (HsExpr GhcPs)
x <- NonEmpty (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> [GenLocated SrcSpanAnnA (HsExpr GhcPs)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (LHsExpr GhcPs)
NonEmpty (GenLocated SrcSpanAnnA (HsExpr GhcPs))
xs]
Boxity
Boxed
sigE :: LHsExpr GhcPs -> LHsType GhcPs -> LHsExpr GhcPs
sigE :: LHsExpr GhcPs -> XRec GhcPs (HsType GhcPs) -> LHsExpr GhcPs
sigE LHsExpr GhcPs
expr XRec GhcPs (HsType GhcPs)
ty = GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> HsExpr GhcPs -> LHsExpr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
expr (HsExpr GhcPs -> LHsExpr GhcPs) -> HsExpr GhcPs -> LHsExpr GhcPs
forall a b. (a -> b) -> a -> b
$
XExprWithTySig GhcPs
-> LHsExpr GhcPs -> LHsSigWcType (NoGhcTc GhcPs) -> HsExpr GhcPs
forall p.
XExprWithTySig p
-> LHsExpr p -> LHsSigWcType (NoGhcTc p) -> HsExpr p
ExprWithTySig XExprWithTySig GhcPs
forall a. HasDefaultExt a => a
defExt LHsExpr GhcPs
expr (XHsWC GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
forall pass thing.
XHsWC pass thing -> thing -> HsWildCardBndrs pass thing
HsWC XHsWC GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
NoExtField
forall a. HasDefaultExt a => a
defExt (XRec GhcPs (HsType GhcPs) -> LHsSigType GhcPs
implicitBndrs XRec GhcPs (HsType GhcPs)
ty))
intE :: Integral a => a -> LHsExpr GhcPs
intE :: forall a. Integral a => a -> LHsExpr GhcPs
intE = HsLit GhcPs -> LHsExpr GhcPs
HsLit GhcPs -> GenLocated SrcSpanAnnA (HsExpr GhcPs)
litE (HsLit GhcPs -> GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> (a -> HsLit GhcPs) -> a -> GenLocated SrcSpanAnnA (HsExpr GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XHsInt GhcPs -> IntegralLit -> HsLit GhcPs
forall x. XHsInt x -> IntegralLit -> HsLit x
HsInt XHsInt GhcPs
NoExtField
forall a. HasDefaultExt a => a
defExt (IntegralLit -> HsLit GhcPs)
-> (a -> IntegralLit) -> a -> HsLit GhcPs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> IntegralLit
forall a. Integral a => a -> IntegralLit
mkIntegralLit
parensT :: LHsType GhcPs -> LHsType GhcPs
parensT :: XRec GhcPs (HsType GhcPs) -> XRec GhcPs (HsType GhcPs)
parensT = HsType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs)
forall a an. a -> LocatedAn an a
noLocA (HsType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs))
-> (GenLocated SrcSpanAnnA (HsType GhcPs) -> HsType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XParTy GhcPs -> XRec GhcPs (HsType GhcPs) -> HsType GhcPs
forall pass. XParTy pass -> LHsType pass -> HsType pass
HsParTy XParTy GhcPs
EpAnn AnnParen
forall a. HasDefaultExt a => a
defExt
#if __GLASGOW_HASKELL__ >= 906
litT :: HsTyLit GhcPs -> LHsType GhcPs
#else
litT :: HsTyLit -> LHsType GhcPs
#endif
litT :: HsTyLit GhcPs -> XRec GhcPs (HsType GhcPs)
litT = HsType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs)
forall a an. a -> LocatedAn an a
noLocA (HsType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs))
-> (HsTyLit GhcPs -> HsType GhcPs)
-> HsTyLit GhcPs
-> GenLocated SrcSpanAnnA (HsType GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XTyLit GhcPs -> HsTyLit GhcPs -> HsType GhcPs
forall pass. XTyLit pass -> HsTyLit pass -> HsType pass
HsTyLit XTyLit GhcPs
NoExtField
forall a. HasDefaultExt a => a
defExt
varT :: HasCallStack => LRdrName -> LHsType GhcPs
varT :: HasCallStack => LRdrName -> XRec GhcPs (HsType GhcPs)
varT LRdrName
name
| LRdrName -> Bool
isTypeVar LRdrName
name = LRdrName -> HsType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (XTyVar GhcPs -> PromotionFlag -> LIdP GhcPs -> HsType GhcPs
forall pass.
XTyVar pass -> PromotionFlag -> LIdP pass -> HsType pass
HsTyVar XTyVar GhcPs
forall a. HasDefaultExt a => a
defExt PromotionFlag
NotPromoted (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name))
| Bool
otherwise = String -> GenLocated SrcSpanAnnA (HsType GhcPs)
forall a. HasCallStack => String -> a
error String
"varT: incorrect name type"
viewVarT :: LHsType GhcPs -> Maybe LRdrName
viewVarT :: XRec GhcPs (HsType GhcPs) -> Maybe LRdrName
viewVarT (L SrcSpanAnnA
_ (HsTyVar XTyVar GhcPs
_ PromotionFlag
_ (LIdP GhcPs -> LRdrName
LocatedN RdrName -> LRdrName
forall a e. LocatedAn a e -> Located e
reLoc -> LRdrName
name))) | LRdrName -> Bool
isTypeVar LRdrName
name = LRdrName -> Maybe LRdrName
forall a. a -> Maybe a
Just LRdrName
name
viewVarT XRec GhcPs (HsType GhcPs)
_otherwise = Maybe LRdrName
forall a. Maybe a
Nothing
pattern VarT :: HasCallStack => () => LRdrName -> LHsType GhcPs
pattern $mVarT :: forall {r}.
HasCallStack =>
XRec GhcPs (HsType GhcPs) -> (LRdrName -> r) -> ((# #) -> r) -> r
$bVarT :: HasCallStack => LRdrName -> XRec GhcPs (HsType GhcPs)
VarT name <- (viewVarT -> Just name)
where
VarT = HasCallStack => LRdrName -> XRec GhcPs (HsType GhcPs)
LRdrName -> XRec GhcPs (HsType GhcPs)
varT
conT :: HasCallStack => LRdrName -> LHsType GhcPs
conT :: HasCallStack => LRdrName -> XRec GhcPs (HsType GhcPs)
conT LRdrName
name
| LRdrName -> Bool
isTypeCon LRdrName
name = LRdrName -> HsType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (XTyVar GhcPs -> PromotionFlag -> LIdP GhcPs -> HsType GhcPs
forall pass.
XTyVar pass -> PromotionFlag -> LIdP pass -> HsType pass
HsTyVar XTyVar GhcPs
forall a. HasDefaultExt a => a
defExt PromotionFlag
NotPromoted (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name))
| Bool
otherwise = String -> GenLocated SrcSpanAnnA (HsType GhcPs)
forall a. HasCallStack => String -> a
error String
"varT: incorrect name type"
viewConT :: LHsType GhcPs -> Maybe LRdrName
viewConT :: XRec GhcPs (HsType GhcPs) -> Maybe LRdrName
viewConT (L SrcSpanAnnA
_ (HsTyVar XTyVar GhcPs
_ PromotionFlag
_ (LIdP GhcPs -> LRdrName
LocatedN RdrName -> LRdrName
forall a e. LocatedAn a e -> Located e
reLoc -> LRdrName
name))) | LRdrName -> Bool
isTypeCon LRdrName
name = LRdrName -> Maybe LRdrName
forall a. a -> Maybe a
Just LRdrName
name
viewConT XRec GhcPs (HsType GhcPs)
_otherwise = Maybe LRdrName
forall a. Maybe a
Nothing
pattern ConT :: HasCallStack => () => LRdrName -> LHsType GhcPs
pattern $mConT :: forall {r}.
HasCallStack =>
XRec GhcPs (HsType GhcPs) -> (LRdrName -> r) -> ((# #) -> r) -> r
$bConT :: HasCallStack => LRdrName -> XRec GhcPs (HsType GhcPs)
ConT name <- (viewConT -> Just name)
where
ConT = HasCallStack => LRdrName -> XRec GhcPs (HsType GhcPs)
LRdrName -> XRec GhcPs (HsType GhcPs)
conT
appT :: LHsType GhcPs -> LHsType GhcPs -> LHsType GhcPs
appT :: XRec GhcPs (HsType GhcPs)
-> XRec GhcPs (HsType GhcPs) -> XRec GhcPs (HsType GhcPs)
appT = XRec GhcPs (HsType GhcPs)
-> XRec GhcPs (HsType GhcPs) -> XRec GhcPs (HsType GhcPs)
forall (p :: Pass).
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
mkHsAppTy
listT :: [LHsType GhcPs] -> LHsType GhcPs
listT :: [XRec GhcPs (HsType GhcPs)] -> XRec GhcPs (HsType GhcPs)
listT [XRec GhcPs (HsType GhcPs)]
ts = [GenLocated SrcSpanAnnA (HsType GhcPs)]
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc [XRec GhcPs (HsType GhcPs)]
[GenLocated SrcSpanAnnA (HsType GhcPs)]
ts (HsType GhcPs -> XRec GhcPs (HsType GhcPs))
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall a b. (a -> b) -> a -> b
$ XExplicitListTy GhcPs
-> PromotionFlag -> [XRec GhcPs (HsType GhcPs)] -> HsType GhcPs
forall pass.
XExplicitListTy pass
-> PromotionFlag -> [LHsType pass] -> HsType pass
HsExplicitListTy XExplicitListTy GhcPs
forall a. HasDefaultExt a => a
defExt PromotionFlag
IsPromoted [XRec GhcPs (HsType GhcPs)]
ts
stringT :: String -> LHsType GhcPs
stringT :: String -> XRec GhcPs (HsType GhcPs)
stringT = HsTyLit GhcPs -> XRec GhcPs (HsType GhcPs)
HsTyLit GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs)
litT (HsTyLit GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs))
-> (String -> HsTyLit GhcPs)
-> String
-> GenLocated SrcSpanAnnA (HsType GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XStrTy GhcPs -> FastString -> HsTyLit GhcPs
forall pass. XStrTy pass -> FastString -> HsTyLit pass
HsStrTy XStrTy GhcPs
SourceText
NoSourceText (FastString -> HsTyLit GhcPs)
-> (String -> FastString) -> String -> HsTyLit GhcPs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> FastString
fsLit
appsT :: LHsType GhcPs -> [LHsType GhcPs] -> LHsType GhcPs
appsT :: XRec GhcPs (HsType GhcPs)
-> [XRec GhcPs (HsType GhcPs)] -> XRec GhcPs (HsType GhcPs)
appsT = (GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs))
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> [GenLocated SrcSpanAnnA (HsType GhcPs)]
-> GenLocated SrcSpanAnnA (HsType GhcPs)
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: Type -> Type) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' XRec GhcPs (HsType GhcPs)
-> XRec GhcPs (HsType GhcPs) -> XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs)
appT
funT :: LHsType GhcPs -> LHsType GhcPs -> LHsType GhcPs
funT :: XRec GhcPs (HsType GhcPs)
-> XRec GhcPs (HsType GhcPs) -> XRec GhcPs (HsType GhcPs)
funT XRec GhcPs (HsType GhcPs)
a XRec GhcPs (HsType GhcPs)
b = GenLocated SrcSpanAnnA (HsType GhcPs)
-> HsType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
a (XFunTy GhcPs
-> XRec GhcPs (HsType GhcPs)
-> XRec GhcPs (HsType GhcPs)
-> HsType GhcPs
hsFunTy XFunTy GhcPs
EpAnnCO
forall a. HasDefaultExt a => a
defExt XRec GhcPs (HsType GhcPs)
a XRec GhcPs (HsType GhcPs)
b)
tupT :: NonEmpty (LHsType GhcPs) -> LHsType GhcPs
tupT :: NonEmpty (XRec GhcPs (HsType GhcPs)) -> XRec GhcPs (HsType GhcPs)
tupT NonEmpty (XRec GhcPs (HsType GhcPs))
ts = NonEmpty (GenLocated SrcSpanAnnA (HsType GhcPs))
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc NonEmpty (XRec GhcPs (HsType GhcPs))
NonEmpty (GenLocated SrcSpanAnnA (HsType GhcPs))
ts (HsType GhcPs -> XRec GhcPs (HsType GhcPs))
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall a b. (a -> b) -> a -> b
$ XExplicitTupleTy GhcPs
-> [XRec GhcPs (HsType GhcPs)] -> HsType GhcPs
forall pass. XExplicitTupleTy pass -> [LHsType pass] -> HsType pass
HsExplicitTupleTy XExplicitTupleTy GhcPs
forall a. HasDefaultExt a => a
defExt (NonEmpty (XRec GhcPs (HsType GhcPs)) -> [XRec GhcPs (HsType GhcPs)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (XRec GhcPs (HsType GhcPs))
ts)
varP :: LRdrName -> LPat GhcPs
varP :: LRdrName -> LPat GhcPs
varP LRdrName
name = LRdrName -> Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (XVarPat GhcPs -> LIdP GhcPs -> Pat GhcPs
forall p. XVarPat p -> LIdP p -> Pat p
VarPat XVarPat GhcPs
forall a. HasDefaultExt a => a
defExt (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name))
conP :: LRdrName -> [LPat GhcPs] -> LPat GhcPs
#if __GLASGOW_HASKELL__ >= 902
conP :: LRdrName -> [LPat GhcPs] -> LPat GhcPs
conP LRdrName
con [LPat GhcPs]
args = LRdrName -> Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
con (LRdrName -> HsConPatDetails GhcPs -> Pat GhcPs
conPat LRdrName
con ([HsConPatTyArg GhcPs]
-> [GenLocated SrcSpanAnnA (Pat GhcPs)]
-> HsConDetails
(HsConPatTyArg GhcPs)
(GenLocated SrcSpanAnnA (Pat GhcPs))
(HsRecFields GhcPs (GenLocated SrcSpanAnnA (Pat GhcPs)))
forall tyarg arg rec.
[tyarg] -> [arg] -> HsConDetails tyarg arg rec
PrefixCon [] [LPat GhcPs]
[GenLocated SrcSpanAnnA (Pat GhcPs)]
args))
#else
conP con args = inheritLoc con (conPat con (PrefixCon args))
#endif
bangP :: LPat GhcPs -> LPat GhcPs
bangP :: LPat GhcPs -> LPat GhcPs
bangP LPat GhcPs
p = GenLocated SrcSpanAnnA (Pat GhcPs) -> Pat GhcPs -> LPat GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LPat GhcPs
GenLocated SrcSpanAnnA (Pat GhcPs)
p (Pat GhcPs -> LPat GhcPs) -> Pat GhcPs -> LPat GhcPs
forall a b. (a -> b) -> a -> b
$ XBangPat GhcPs -> LPat GhcPs -> Pat GhcPs
forall p. XBangPat p -> LPat p -> Pat p
BangPat XBangPat GhcPs
forall a. HasDefaultExt a => a
defExt LPat GhcPs
p
listP :: [LPat GhcPs] -> LPat GhcPs
listP :: [LPat GhcPs] -> LPat GhcPs
listP [LPat GhcPs]
xs = [GenLocated SrcSpanAnnA (Pat GhcPs)] -> Pat GhcPs -> LPat GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc [LPat GhcPs]
[GenLocated SrcSpanAnnA (Pat GhcPs)]
xs (Pat GhcPs -> LPat GhcPs) -> Pat GhcPs -> LPat GhcPs
forall a b. (a -> b) -> a -> b
$ XListPat GhcPs -> [LPat GhcPs] -> Pat GhcPs
forall p. XListPat p -> [LPat p] -> Pat p
ListPat XListPat GhcPs
forall a. HasDefaultExt a => a
defExt [LPat GhcPs]
xs
wildP :: LPat GhcPs
wildP :: LPat GhcPs
wildP = SrcSpan -> Pat GhcPs -> GenLocated SrcSpanAnnA (Pat GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc SrcSpan
noSrcSpan (XWildPat GhcPs -> Pat GhcPs
forall p. XWildPat p -> Pat p
WildPat XWildPat GhcPs
forall a. HasDefaultExt a => a
defExt)
bangType :: LHsType GhcPs -> LHsType GhcPs
bangType :: XRec GhcPs (HsType GhcPs) -> XRec GhcPs (HsType GhcPs)
bangType XRec GhcPs (HsType GhcPs)
t = GenLocated SrcSpanAnnA (HsType GhcPs)
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
t (HsType GhcPs -> XRec GhcPs (HsType GhcPs))
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall a b. (a -> b) -> a -> b
$
XBangTy GhcPs
-> HsSrcBang -> XRec GhcPs (HsType GhcPs) -> HsType GhcPs
forall pass.
XBangTy pass -> HsSrcBang -> LHsType pass -> HsType pass
HsBangTy XBangTy GhcPs
forall a. HasDefaultExt a => a
defExt (SourceText -> SrcUnpackedness -> SrcStrictness -> HsSrcBang
HsSrcBang SourceText
NoSourceText SrcUnpackedness
NoSrcUnpack SrcStrictness
SrcStrict) XRec GhcPs (HsType GhcPs)
t
equalP :: LHsType GhcPs -> LHsType GhcPs -> LHsType GhcPs
equalP :: XRec GhcPs (HsType GhcPs)
-> XRec GhcPs (HsType GhcPs) -> XRec GhcPs (HsType GhcPs)
equalP XRec GhcPs (HsType GhcPs)
x XRec GhcPs (HsType GhcPs)
y = GenLocated SrcSpanAnnA (HsType GhcPs)
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
x (HsType GhcPs -> XRec GhcPs (HsType GhcPs))
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall a b. (a -> b) -> a -> b
$
PromotionFlag
-> XRec GhcPs (HsType GhcPs)
-> LocatedN (IdP GhcPs)
-> XRec GhcPs (HsType GhcPs)
-> HsType GhcPs
forall (p :: Pass).
(Anno (IdGhcP p) ~ SrcSpanAnnN) =>
PromotionFlag
-> LHsType (GhcPass p)
-> LocatedN (IdP (GhcPass p))
-> LHsType (GhcPass p)
-> HsType (GhcPass p)
mkHsOpTy
#if __GLASGOW_HASKELL__ >= 904
PromotionFlag
NotPromoted
#endif
XRec GhcPs (HsType GhcPs)
x
(GenLocated SrcSpanAnnA (HsType GhcPs)
-> RdrName -> LocatedN RdrName
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
x RdrName
eqTyCon_RDR)
XRec GhcPs (HsType GhcPs)
y
recC :: LRdrName -> [(LRdrName, LHsType GhcPs)] -> LConDecl GhcPs
recC :: LRdrName
-> [(LRdrName, XRec GhcPs (HsType GhcPs))] -> LConDecl GhcPs
recC = [LRdrName]
-> [XRec GhcPs (HsType GhcPs)]
-> LRdrName
-> [(LRdrName, XRec GhcPs (HsType GhcPs))]
-> LConDecl GhcPs
forallRecC [] []
viewRecC :: LConDecl GhcPs -> Maybe (LRdrName, [(LRdrName, LHsType GhcPs)])
viewRecC :: LConDecl GhcPs
-> Maybe (LRdrName, [(LRdrName, XRec GhcPs (HsType GhcPs))])
viewRecC
(L SrcSpanAnnA
_
ConDeclH98 {
con_name :: forall pass. ConDecl pass -> LIdP pass
con_name = LIdP GhcPs
conName
#if __GLASGOW_HASKELL__ >= 902
, con_forall :: forall pass. ConDecl pass -> Bool
con_forall = Bool
False
#else
, con_forall = L _ False
#endif
, con_ex_tvs :: forall pass. ConDecl pass -> [LHsTyVarBndr Specificity pass]
con_ex_tvs = []
, con_mb_cxt :: forall pass. ConDecl pass -> Maybe (LHsContext pass)
con_mb_cxt = Maybe (XRec GhcPs [XRec GhcPs (HsType GhcPs)])
Nothing
, con_args :: forall pass. ConDecl pass -> HsConDeclH98Details pass
con_args = RecCon (L SrcSpanAnnL
_ [GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
fields)
}
) = (LocatedN RdrName -> LRdrName
forall a e. LocatedAn a e -> Located e
reLoc LIdP GhcPs
LocatedN RdrName
conName ,) ([(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))]
-> (LRdrName, [(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))]))
-> Maybe [(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))]
-> Maybe
(LRdrName, [(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))])
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> (GenLocated SrcSpanAnnA (ConDeclField GhcPs)
-> Maybe (LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs)))
-> [GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
-> Maybe [(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))]
forall (t :: Type -> Type) (m :: Type -> Type) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: Type -> Type) a b.
Monad m =>
(a -> m b) -> [a] -> m [b]
mapM LConDeclField GhcPs -> Maybe (LRdrName, XRec GhcPs (HsType GhcPs))
GenLocated SrcSpanAnnA (ConDeclField GhcPs)
-> Maybe (LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))
viewRecField [GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
fields
where
viewRecField :: LConDeclField GhcPs -> Maybe (LRdrName, LHsType GhcPs)
viewRecField :: LConDeclField GhcPs -> Maybe (LRdrName, XRec GhcPs (HsType GhcPs))
viewRecField
(L SrcSpanAnnA
_
ConDeclField {
cd_fld_names :: forall pass. ConDeclField pass -> [LFieldOcc pass]
cd_fld_names = [L SrcAnn NoEpAnns
_ FieldOcc GhcPs
fieldName]
, cd_fld_type :: forall pass. ConDeclField pass -> LBangType pass
cd_fld_type = XRec GhcPs (HsType GhcPs)
ty
}
) = (LRdrName, XRec GhcPs (HsType GhcPs))
-> Maybe (LRdrName, XRec GhcPs (HsType GhcPs))
forall a. a -> Maybe a
Just ((LRdrName, XRec GhcPs (HsType GhcPs))
-> Maybe (LRdrName, XRec GhcPs (HsType GhcPs)))
-> (LRdrName, XRec GhcPs (HsType GhcPs))
-> Maybe (LRdrName, XRec GhcPs (HsType GhcPs))
forall a b. (a -> b) -> a -> b
$ (FieldOcc GhcPs -> LRdrName
viewFieldOcc FieldOcc GhcPs
fieldName, XRec GhcPs (HsType GhcPs)
ty)
viewRecField LConDeclField GhcPs
_otherwise = Maybe (LRdrName, XRec GhcPs (HsType GhcPs))
Maybe (LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))
forall a. Maybe a
Nothing
viewFieldOcc :: FieldOcc GhcPs -> LRdrName
viewFieldOcc :: FieldOcc GhcPs -> LRdrName
viewFieldOcc (FieldOcc XCFieldOcc GhcPs
_ (XRec GhcPs RdrName -> LRdrName
LocatedN RdrName -> LRdrName
forall a e. LocatedAn a e -> Located e
reLoc -> LRdrName
name)) = LRdrName
name
#if __GLASGOW_HASKELL__ < 900
viewFieldOcc _ = panic "viewFieldOcc"
#endif
viewRecC LConDecl GhcPs
_otherwise = Maybe (LRdrName, [(LRdrName, XRec GhcPs (HsType GhcPs))])
Maybe
(LRdrName, [(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))])
forall a. Maybe a
Nothing
pattern RecC :: LRdrName -> [(LRdrName, LHsType GhcPs)] -> LConDecl GhcPs
pattern $mRecC :: forall {r}.
LConDecl GhcPs
-> (LRdrName -> [(LRdrName, XRec GhcPs (HsType GhcPs))] -> r)
-> ((# #) -> r)
-> r
$bRecC :: LRdrName
-> [(LRdrName, XRec GhcPs (HsType GhcPs))] -> LConDecl GhcPs
RecC conName args <- (viewRecC -> Just (conName, args))
where
RecC = LRdrName
-> [(LRdrName, XRec GhcPs (HsType GhcPs))] -> LConDecl GhcPs
recC
forallRecC ::
[LRdrName]
-> [LHsType GhcPs]
-> LRdrName
-> [(LRdrName, LHsType GhcPs)]
-> LConDecl GhcPs
forallRecC :: [LRdrName]
-> [XRec GhcPs (HsType GhcPs)]
-> LRdrName
-> [(LRdrName, XRec GhcPs (HsType GhcPs))]
-> LConDecl GhcPs
forallRecC [LRdrName]
vars [XRec GhcPs (HsType GhcPs)]
ctxt LRdrName
conName [(LRdrName, XRec GhcPs (HsType GhcPs))]
args = LRdrName -> ConDecl GhcPs -> LConDecl GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
conName (ConDecl GhcPs -> LConDecl GhcPs)
-> ConDecl GhcPs -> LConDecl GhcPs
forall a b. (a -> b) -> a -> b
$ ConDeclH98 {
con_ext :: XConDeclH98 GhcPs
con_ext = XConDeclH98 GhcPs
forall a. HasDefaultExt a => a
defExt
, con_name :: LIdP GhcPs
con_name = LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
conName
, con_forall :: Bool
con_forall = LRdrName -> Bool -> Bool
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
conName Bool
True
, con_ex_tvs :: [LHsTyVarBndr Specificity GhcPs]
con_ex_tvs = (LRdrName -> LHsTyVarBndr Specificity GhcPs)
-> [LRdrName] -> [LHsTyVarBndr Specificity GhcPs]
forall a b. (a -> b) -> [a] -> [b]
map (LHsTyVarBndr GhcPs -> LHsTyVarBndr Specificity GhcPs
GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)
-> LHsTyVarBndr Specificity GhcPs
setDefaultSpecificity (GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)
-> LHsTyVarBndr Specificity GhcPs)
-> (LRdrName -> GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs))
-> LRdrName
-> LHsTyVarBndr Specificity GhcPs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LRdrName -> LHsTyVarBndr GhcPs
LRdrName -> GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)
mkBndr) [LRdrName]
vars
, con_mb_cxt :: Maybe (XRec GhcPs [XRec GhcPs (HsType GhcPs)])
con_mb_cxt = GenLocated SrcSpanAnnC [GenLocated SrcSpanAnnA (HsType GhcPs)]
-> Maybe
(GenLocated SrcSpanAnnC [GenLocated SrcSpanAnnA (HsType GhcPs)])
forall a. a -> Maybe a
Just (LRdrName
-> [GenLocated SrcSpanAnnA (HsType GhcPs)]
-> GenLocated SrcSpanAnnC [GenLocated SrcSpanAnnA (HsType GhcPs)]
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
conName [XRec GhcPs (HsType GhcPs)]
[GenLocated SrcSpanAnnA (HsType GhcPs)]
ctxt)
, con_args :: HsConDetails
Void
(HsScaled GhcPs (XRec GhcPs (HsType GhcPs)))
(XRec GhcPs [LConDeclField GhcPs])
con_args = GenLocated
SrcSpanAnnL [GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
-> HsConDetails
Void
(HsScaled GhcPs (GenLocated SrcSpanAnnA (HsType GhcPs)))
(GenLocated
SrcSpanAnnL [GenLocated SrcSpanAnnA (ConDeclField GhcPs)])
forall tyarg arg rec. rec -> HsConDetails tyarg arg rec
RecCon (LRdrName
-> [GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
-> GenLocated
SrcSpanAnnL [GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
conName ([GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
-> GenLocated
SrcSpanAnnL [GenLocated SrcSpanAnnA (ConDeclField GhcPs)])
-> [GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
-> GenLocated
SrcSpanAnnL [GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
forall a b. (a -> b) -> a -> b
$ ((LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))
-> GenLocated SrcSpanAnnA (ConDeclField GhcPs))
-> [(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))]
-> [GenLocated SrcSpanAnnA (ConDeclField GhcPs)]
forall a b. (a -> b) -> [a] -> [b]
map ((LRdrName
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (ConDeclField GhcPs))
-> (LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))
-> GenLocated SrcSpanAnnA (ConDeclField GhcPs)
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry LRdrName -> XRec GhcPs (HsType GhcPs) -> LConDeclField GhcPs
LRdrName
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (ConDeclField GhcPs)
mkRecField) [(LRdrName, XRec GhcPs (HsType GhcPs))]
[(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))]
args)
, con_doc :: Maybe (LHsDoc GhcPs)
con_doc = Maybe (LHsDoc GhcPs)
forall a. Maybe a
Nothing
}
where
mkBndr :: LRdrName -> LHsTyVarBndr GhcPs
mkBndr :: LRdrName -> LHsTyVarBndr GhcPs
mkBndr LRdrName
name = LRdrName -> HsTyVarBndr GhcPs -> LHsTyVarBndr GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (HsTyVarBndr GhcPs -> LHsTyVarBndr GhcPs)
-> HsTyVarBndr GhcPs -> LHsTyVarBndr GhcPs
forall a b. (a -> b) -> a -> b
$ XUserTyVar GhcPs -> Located (IdP GhcPs) -> HsTyVarBndr GhcPs
userTyVar XUserTyVar GhcPs
EpAnn [AddEpAnn]
forall a. HasDefaultExt a => a
defExt Located (IdP GhcPs)
LRdrName
name
mkRecField :: LRdrName -> LHsType GhcPs -> LConDeclField GhcPs
mkRecField :: LRdrName -> XRec GhcPs (HsType GhcPs) -> LConDeclField GhcPs
mkRecField LRdrName
name XRec GhcPs (HsType GhcPs)
ty = LRdrName -> ConDeclField GhcPs -> LConDeclField GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (ConDeclField GhcPs -> LConDeclField GhcPs)
-> ConDeclField GhcPs -> LConDeclField GhcPs
forall a b. (a -> b) -> a -> b
$ ConDeclField {
cd_fld_ext :: XConDeclField GhcPs
cd_fld_ext = XConDeclField GhcPs
forall a. HasDefaultExt a => a
defExt
, cd_fld_names :: [LFieldOcc GhcPs]
cd_fld_names = [LRdrName -> FieldOcc GhcPs -> LFieldOcc GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (FieldOcc GhcPs -> LFieldOcc GhcPs)
-> FieldOcc GhcPs -> LFieldOcc GhcPs
forall a b. (a -> b) -> a -> b
$ LocatedN RdrName -> FieldOcc GhcPs
mkFieldOcc (LocatedN RdrName -> FieldOcc GhcPs)
-> LocatedN RdrName -> FieldOcc GhcPs
forall a b. (a -> b) -> a -> b
$ LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name]
, cd_fld_type :: XRec GhcPs (HsType GhcPs)
cd_fld_type = XRec GhcPs (HsType GhcPs)
ty
, cd_fld_doc :: Maybe (LHsDoc GhcPs)
cd_fld_doc = Maybe (LHsDoc GhcPs)
forall a. Maybe a
Nothing
}
kindedTV :: LRdrName -> LHsType GhcPs -> LHsTyVarBndr GhcPs
kindedTV :: LRdrName -> XRec GhcPs (HsType GhcPs) -> LHsTyVarBndr GhcPs
kindedTV LRdrName
name XRec GhcPs (HsType GhcPs)
ty = LRdrName
-> HsTyVarBndr GhcPs -> GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (XKindedTyVar GhcPs
-> Located (IdP GhcPs)
-> XRec GhcPs (HsType GhcPs)
-> HsTyVarBndr GhcPs
kindedTyVar XKindedTyVar GhcPs
EpAnn [AddEpAnn]
forall a. HasDefaultExt a => a
defExt Located (IdP GhcPs)
LRdrName
name XRec GhcPs (HsType GhcPs)
ty)
tyVarBndrName :: LHsTyVarBndr GhcPs -> LRdrName
tyVarBndrName :: LHsTyVarBndr GhcPs -> LRdrName
tyVarBndrName = HsTyVarBndr GhcPs -> LRdrName
hsTyVarLName (HsTyVarBndr GhcPs -> LRdrName)
-> (GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)
-> HsTyVarBndr GhcPs)
-> GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)
-> LRdrName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs) -> HsTyVarBndr GhcPs
forall l e. GenLocated l e -> e
unLoc
sigD :: LRdrName -> LHsType GhcPs -> LHsDecl GhcPs
sigD :: LRdrName -> XRec GhcPs (HsType GhcPs) -> LHsDecl GhcPs
sigD LRdrName
name XRec GhcPs (HsType GhcPs)
ty = LRdrName -> HsDecl GhcPs -> LHsDecl GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (HsDecl GhcPs -> LHsDecl GhcPs) -> HsDecl GhcPs -> LHsDecl GhcPs
forall a b. (a -> b) -> a -> b
$ XSigD GhcPs -> Sig GhcPs -> HsDecl GhcPs
forall p. XSigD p -> Sig p -> HsDecl p
SigD XSigD GhcPs
NoExtField
forall a. HasDefaultExt a => a
defExt Sig GhcPs
sig
where
sig :: Sig GhcPs
sig :: Sig GhcPs
sig = XTypeSig GhcPs
-> [LIdP GhcPs]
-> HsWildCardBndrs GhcPs (LHsSigType GhcPs)
-> Sig GhcPs
forall pass.
XTypeSig pass -> [LIdP pass] -> LHsSigWcType pass -> Sig pass
TypeSig XTypeSig GhcPs
EpAnn AnnSig
forall a. HasDefaultExt a => a
defExt [LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name] (HsWildCardBndrs GhcPs (LHsSigType GhcPs) -> Sig GhcPs)
-> HsWildCardBndrs GhcPs (LHsSigType GhcPs) -> Sig GhcPs
forall a b. (a -> b) -> a -> b
$ XHsWC GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
forall pass thing.
XHsWC pass thing -> thing -> HsWildCardBndrs pass thing
HsWC XHsWC GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
NoExtField
forall a. HasDefaultExt a => a
defExt (XRec GhcPs (HsType GhcPs) -> LHsSigType GhcPs
implicitBndrs XRec GhcPs (HsType GhcPs)
ty)
valD :: LRdrName -> LHsExpr GhcPs -> LHsDecl GhcPs
valD :: LRdrName -> LHsExpr GhcPs -> LHsDecl GhcPs
valD LRdrName
fnName LHsExpr GhcPs
body = LRdrName -> HsDecl GhcPs -> LHsDecl GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
fnName (HsDecl GhcPs -> LHsDecl GhcPs) -> HsDecl GhcPs -> LHsDecl GhcPs
forall a b. (a -> b) -> a -> b
$
XValD GhcPs -> HsBind GhcPs -> HsDecl GhcPs
forall p. XValD p -> HsBind p -> HsDecl p
ValD XValD GhcPs
forall a. HasDefaultExt a => a
defExt (GenLocated SrcSpanAnnA (HsBind GhcPs) -> HsBind GhcPs
forall l e. GenLocated l e -> e
unLoc (LRdrName -> LHsExpr GhcPs -> LHsBind GhcPs
simpleBinding LRdrName
fnName LHsExpr GhcPs
body))
dataD ::
LRdrName
-> [LHsTyVarBndr GhcPs]
-> [LConDecl GhcPs]
-> [LHsDerivingClause GhcPs]
-> LHsDecl GhcPs
dataD :: LRdrName
-> [LHsTyVarBndr GhcPs]
-> [LConDecl GhcPs]
-> [LHsDerivingClause GhcPs]
-> LHsDecl GhcPs
dataD LRdrName
typeName [LHsTyVarBndr GhcPs]
tyVars [LConDecl GhcPs]
cons [LHsDerivingClause GhcPs]
derivs = LRdrName -> HsDecl GhcPs -> LHsDecl GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
typeName (HsDecl GhcPs -> LHsDecl GhcPs) -> HsDecl GhcPs -> LHsDecl GhcPs
forall a b. (a -> b) -> a -> b
$
XTyClD GhcPs -> TyClDecl GhcPs -> HsDecl GhcPs
forall p. XTyClD p -> TyClDecl p -> HsDecl p
TyClD XTyClD GhcPs
NoExtField
forall a. HasDefaultExt a => a
defExt (TyClDecl GhcPs -> HsDecl GhcPs) -> TyClDecl GhcPs -> HsDecl GhcPs
forall a b. (a -> b) -> a -> b
$ DataDecl {
tcdDExt :: XDataDecl GhcPs
tcdDExt = XDataDecl GhcPs
EpAnn [AddEpAnn]
forall a. HasDefaultExt a => a
defExt
, tcdLName :: LIdP GhcPs
tcdLName = LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
typeName
, tcdTyVars :: LHsQTyVars GhcPs
tcdTyVars = [LHsTyVarBndr GhcPs] -> LHsQTyVars GhcPs
mkHsQTvs [LHsTyVarBndr GhcPs]
tyVars
, tcdFixity :: LexicalFixity
tcdFixity = LexicalFixity
Prefix
, tcdDataDefn :: HsDataDefn GhcPs
tcdDataDefn = HsDataDefn {
dd_ext :: XCHsDataDefn GhcPs
dd_ext = XCHsDataDefn GhcPs
NoExtField
forall a. HasDefaultExt a => a
defExt
#if __GLASGOW_HASKELL__ >= 906
#else
, dd_ND = DataType
#endif
#if __GLASGOW_HASKELL__ >= 902
, dd_ctxt :: Maybe (XRec GhcPs [XRec GhcPs (HsType GhcPs)])
dd_ctxt = Maybe (XRec GhcPs [XRec GhcPs (HsType GhcPs)])
Maybe
(GenLocated SrcSpanAnnC [GenLocated SrcSpanAnnA (HsType GhcPs)])
forall a. Maybe a
Nothing
#else
, dd_ctxt = inheritLoc typeName []
#endif
, dd_cType :: Maybe (XRec GhcPs CType)
dd_cType = Maybe (XRec GhcPs CType)
Maybe (GenLocated SrcSpanAnnP CType)
forall a. Maybe a
Nothing
, dd_kindSig :: Maybe (XRec GhcPs (HsType GhcPs))
dd_kindSig = Maybe (XRec GhcPs (HsType GhcPs))
Maybe (GenLocated SrcSpanAnnA (HsType GhcPs))
forall a. Maybe a
Nothing
#if __GLASGOW_HASKELL__ >= 906
, dd_cons :: DataDefnCons (LConDecl GhcPs)
dd_cons = Bool
-> [GenLocated SrcSpanAnnA (ConDecl GhcPs)]
-> DataDefnCons (GenLocated SrcSpanAnnA (ConDecl GhcPs))
forall a. Bool -> [a] -> DataDefnCons a
DataTypeCons Bool
False [LConDecl GhcPs]
[GenLocated SrcSpanAnnA (ConDecl GhcPs)]
cons
#else
, dd_cons = cons
#endif
, dd_derivs :: [LHsDerivingClause GhcPs]
dd_derivs = LRdrName
-> [GenLocated (SrcAnn NoEpAnns) (HsDerivingClause GhcPs)]
-> [GenLocated (SrcAnn NoEpAnns) (HsDerivingClause GhcPs)]
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
typeName [LHsDerivingClause GhcPs]
[GenLocated (SrcAnn NoEpAnns) (HsDerivingClause GhcPs)]
derivs
}
}
viewDataD ::
LHsDecl GhcPs
-> Maybe (
LRdrName
, [LHsTyVarBndr GhcPs]
, [LConDecl GhcPs]
, [LHsDerivingClause GhcPs]
)
viewDataD :: LHsDecl GhcPs
-> Maybe
(LRdrName, [LHsTyVarBndr GhcPs], [LConDecl GhcPs],
[LHsDerivingClause GhcPs])
viewDataD
(L SrcSpanAnnA
_
(TyClD
XTyClD GhcPs
_
DataDecl {
tcdLName :: forall pass. TyClDecl pass -> LIdP pass
tcdLName = LIdP GhcPs
typeName
, tcdTyVars :: forall pass. TyClDecl pass -> LHsQTyVars pass
tcdTyVars = HsQTvs {hsq_explicit :: forall pass. LHsQTyVars pass -> [LHsTyVarBndr () pass]
hsq_explicit = [LHsTyVarBndr GhcPs]
tyVars}
, tcdFixity :: forall pass. TyClDecl pass -> LexicalFixity
tcdFixity = LexicalFixity
Prefix
, tcdDataDefn :: forall pass. TyClDecl pass -> HsDataDefn pass
tcdDataDefn = HsDataDefn {
#if __GLASGOW_HASKELL__ >= 902
dd_ctxt :: forall pass. HsDataDefn pass -> Maybe (LHsContext pass)
dd_ctxt = Maybe (XRec GhcPs [XRec GhcPs (HsType GhcPs)])
Nothing
#else
dd_ctxt = L _ []
#endif
#if !__GLASGOW_HASKELL__ >= 906
, dd_ND = DataType
#endif
, dd_cType :: forall pass. HsDataDefn pass -> Maybe (XRec pass CType)
dd_cType = Maybe (XRec GhcPs CType)
Nothing
, dd_kindSig :: forall pass. HsDataDefn pass -> Maybe (LHsKind pass)
dd_kindSig = Maybe (XRec GhcPs (HsType GhcPs))
Nothing
#if __GLASGOW_HASKELL__ >= 906
, dd_cons :: forall pass. HsDataDefn pass -> DataDefnCons (LConDecl pass)
dd_cons = DataTypeCons Bool
False [LConDecl GhcPs]
cons
#else
, dd_cons = cons
#endif
#if __GLASGOW_HASKELL__ >= 902
, dd_derivs :: forall pass. HsDataDefn pass -> HsDeriving pass
dd_derivs = [LHsDerivingClause GhcPs]
derivs
#else
, dd_derivs = L _ derivs
#endif
}
}
)
) = (LRdrName, [GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)],
[GenLocated SrcSpanAnnA (ConDecl GhcPs)],
[GenLocated (SrcAnn NoEpAnns) (HsDerivingClause GhcPs)])
-> Maybe
(LRdrName, [GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)],
[GenLocated SrcSpanAnnA (ConDecl GhcPs)],
[GenLocated (SrcAnn NoEpAnns) (HsDerivingClause GhcPs)])
forall a. a -> Maybe a
Just (LocatedN RdrName -> LRdrName
forall a e. LocatedAn a e -> Located e
reLoc LIdP GhcPs
LocatedN RdrName
typeName, [LHsTyVarBndr GhcPs]
[GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)]
tyVars, [LConDecl GhcPs]
[GenLocated SrcSpanAnnA (ConDecl GhcPs)]
cons, [LHsDerivingClause GhcPs]
[GenLocated (SrcAnn NoEpAnns) (HsDerivingClause GhcPs)]
derivs)
viewDataD LHsDecl GhcPs
_otherwise = Maybe
(LRdrName, [LHsTyVarBndr GhcPs], [LConDecl GhcPs],
[LHsDerivingClause GhcPs])
Maybe
(LRdrName, [GenLocated SrcSpanAnnA (HsTyVarBndr GhcPs)],
[GenLocated SrcSpanAnnA (ConDecl GhcPs)],
[GenLocated (SrcAnn NoEpAnns) (HsDerivingClause GhcPs)])
forall a. Maybe a
Nothing
pattern DataD ::
LRdrName
-> [LHsTyVarBndr GhcPs]
-> [LConDecl GhcPs]
-> [LHsDerivingClause GhcPs]
-> LHsDecl GhcPs
pattern $mDataD :: forall {r}.
LHsDecl GhcPs
-> (LRdrName
-> [LHsTyVarBndr GhcPs]
-> [LConDecl GhcPs]
-> [LHsDerivingClause GhcPs]
-> r)
-> ((# #) -> r)
-> r
$bDataD :: LRdrName
-> [LHsTyVarBndr GhcPs]
-> [LConDecl GhcPs]
-> [LHsDerivingClause GhcPs]
-> LHsDecl GhcPs
DataD typeName tyVars cons derivs <-
(viewDataD -> Just (typeName, tyVars, cons, derivs))
where
DataD = LRdrName
-> [LHsTyVarBndr GhcPs]
-> [LConDecl GhcPs]
-> [LHsDerivingClause GhcPs]
-> LHsDecl GhcPs
dataD
derivClause ::
Maybe (LDerivStrategy GhcPs)
-> NonEmpty (LHsType GhcPs)
-> LHsDerivingClause GhcPs
derivClause :: Maybe (LDerivStrategy GhcPs)
-> NonEmpty (XRec GhcPs (HsType GhcPs)) -> LHsDerivingClause GhcPs
derivClause Maybe (LDerivStrategy GhcPs)
strat NonEmpty (XRec GhcPs (HsType GhcPs))
tys = NonEmpty (GenLocated SrcSpanAnnA (HsType GhcPs))
-> HsDerivingClause GhcPs -> LHsDerivingClause GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc NonEmpty (XRec GhcPs (HsType GhcPs))
NonEmpty (GenLocated SrcSpanAnnA (HsType GhcPs))
tys (HsDerivingClause GhcPs -> LHsDerivingClause GhcPs)
-> HsDerivingClause GhcPs -> LHsDerivingClause GhcPs
forall a b. (a -> b) -> a -> b
$
XCHsDerivingClause GhcPs
-> Maybe (LDerivStrategy GhcPs)
-> LDerivClauseTys GhcPs
-> HsDerivingClause GhcPs
forall pass.
XCHsDerivingClause pass
-> Maybe (LDerivStrategy pass)
-> LDerivClauseTys pass
-> HsDerivingClause pass
HsDerivingClause XCHsDerivingClause GhcPs
forall a. HasDefaultExt a => a
defExt Maybe (LDerivStrategy GhcPs)
strat (LDerivClauseTys GhcPs -> HsDerivingClause GhcPs)
-> LDerivClauseTys GhcPs -> HsDerivingClause GhcPs
forall a b. (a -> b) -> a -> b
$ NonEmpty (GenLocated SrcSpanAnnA (HsType GhcPs))
-> DerivClauseTys GhcPs -> LDerivClauseTys GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc NonEmpty (XRec GhcPs (HsType GhcPs))
NonEmpty (GenLocated SrcSpanAnnA (HsType GhcPs))
tys (DerivClauseTys GhcPs -> LDerivClauseTys GhcPs)
-> DerivClauseTys GhcPs -> LDerivClauseTys GhcPs
forall a b. (a -> b) -> a -> b
$
#if __GLASGOW_HASKELL__ >= 902
XDctMulti GhcPs -> [LHsSigType GhcPs] -> DerivClauseTys GhcPs
forall pass.
XDctMulti pass -> [LHsSigType pass] -> DerivClauseTys pass
DctMulti XDctMulti GhcPs
forall a. HasDefaultExt a => a
defExt ([LHsSigType GhcPs] -> DerivClauseTys GhcPs)
-> [LHsSigType GhcPs] -> DerivClauseTys GhcPs
forall a b. (a -> b) -> a -> b
$
#endif
(GenLocated SrcSpanAnnA (HsType GhcPs) -> LHsSigType GhcPs)
-> [GenLocated SrcSpanAnnA (HsType GhcPs)] -> [LHsSigType GhcPs]
forall a b. (a -> b) -> [a] -> [b]
map XRec GhcPs (HsType GhcPs) -> LHsSigType GhcPs
GenLocated SrcSpanAnnA (HsType GhcPs) -> LHsSigType GhcPs
implicitBndrs (NonEmpty (GenLocated SrcSpanAnnA (HsType GhcPs))
-> [GenLocated SrcSpanAnnA (HsType GhcPs)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (XRec GhcPs (HsType GhcPs))
NonEmpty (GenLocated SrcSpanAnnA (HsType GhcPs))
tys)
viewDerivClause ::
LHsDerivingClause GhcPs
-> (Maybe (LDerivStrategy GhcPs), [LHsType GhcPs])
#if __GLASGOW_HASKELL__ >= 902
viewDerivClause :: LHsDerivingClause GhcPs
-> (Maybe (LDerivStrategy GhcPs), [XRec GhcPs (HsType GhcPs)])
viewDerivClause (L SrcAnn NoEpAnns
_ (HsDerivingClause XCHsDerivingClause GhcPs
_ Maybe (LDerivStrategy GhcPs)
mStrat (L SrcSpanAnnC
_ (DctMulti XDctMulti GhcPs
_ [LHsSigType GhcPs]
tys)))) =
(Maybe (LDerivStrategy GhcPs)
mStrat, (GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs))
-> [GenLocated SrcSpanAnnA (HsSigType GhcPs)]
-> [GenLocated SrcSpanAnnA (HsType GhcPs)]
forall a b. (a -> b) -> [a] -> [b]
map LHsSigType GhcPs -> XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs)
viewImplicitBndrs [LHsSigType GhcPs]
[GenLocated SrcSpanAnnA (HsSigType GhcPs)]
tys)
viewDerivClause (L SrcAnn NoEpAnns
_ (HsDerivingClause XCHsDerivingClause GhcPs
_ Maybe (LDerivStrategy GhcPs)
mStrat (L SrcSpanAnnC
_ (DctSingle XDctSingle GhcPs
_ LHsSigType GhcPs
ty)))) =
(Maybe (LDerivStrategy GhcPs)
mStrat, (GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs))
-> [GenLocated SrcSpanAnnA (HsSigType GhcPs)]
-> [GenLocated SrcSpanAnnA (HsType GhcPs)]
forall a b. (a -> b) -> [a] -> [b]
map LHsSigType GhcPs -> XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs)
viewImplicitBndrs [LHsSigType GhcPs
GenLocated SrcSpanAnnA (HsSigType GhcPs)
ty])
#else
viewDerivClause (L _ (HsDerivingClause _ mStrat (L _ tys))) =
(mStrat, map viewImplicitBndrs tys)
#endif
#if __GLASGOW_HASKELL__ < 900
viewDerivClause _ = panic "viewDerivClause"
#endif
pattern DerivClause ::
Maybe (LDerivStrategy GhcPs)
-> NonEmpty (LHsType GhcPs)
-> LHsDerivingClause GhcPs
pattern $mDerivClause :: forall {r}.
LHsDerivingClause GhcPs
-> (Maybe (LDerivStrategy GhcPs)
-> NonEmpty (XRec GhcPs (HsType GhcPs)) -> r)
-> ((# #) -> r)
-> r
$bDerivClause :: Maybe (LDerivStrategy GhcPs)
-> NonEmpty (XRec GhcPs (HsType GhcPs)) -> LHsDerivingClause GhcPs
DerivClause strat tys <-
(viewDerivClause -> (strat, NE.nonEmpty -> Just tys))
where
DerivClause = Maybe (LDerivStrategy GhcPs)
-> NonEmpty (XRec GhcPs (HsType GhcPs)) -> LHsDerivingClause GhcPs
derivClause
instanceD ::
[LHsType GhcPs]
-> LHsType GhcPs
-> [(LRdrName, LHsExpr GhcPs)]
-> [LTyFamInstDecl GhcPs]
-> LHsDecl GhcPs
instanceD :: [XRec GhcPs (HsType GhcPs)]
-> XRec GhcPs (HsType GhcPs)
-> [(LRdrName, LHsExpr GhcPs)]
-> [LTyFamInstDecl GhcPs]
-> LHsDecl GhcPs
instanceD [XRec GhcPs (HsType GhcPs)]
ctxt XRec GhcPs (HsType GhcPs)
hd [(LRdrName, LHsExpr GhcPs)]
binds [LTyFamInstDecl GhcPs]
assocTypes = GenLocated SrcSpanAnnA (HsType GhcPs)
-> HsDecl GhcPs -> LHsDecl GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
hd (HsDecl GhcPs -> LHsDecl GhcPs) -> HsDecl GhcPs -> LHsDecl GhcPs
forall a b. (a -> b) -> a -> b
$
XInstD GhcPs -> InstDecl GhcPs -> HsDecl GhcPs
forall p. XInstD p -> InstDecl p -> HsDecl p
InstD XInstD GhcPs
forall a. HasDefaultExt a => a
defExt (InstDecl GhcPs -> HsDecl GhcPs) -> InstDecl GhcPs -> HsDecl GhcPs
forall a b. (a -> b) -> a -> b
$ XClsInstD GhcPs -> ClsInstDecl GhcPs -> InstDecl GhcPs
forall pass. XClsInstD pass -> ClsInstDecl pass -> InstDecl pass
ClsInstD XClsInstD GhcPs
forall a. HasDefaultExt a => a
defExt (ClsInstDecl GhcPs -> InstDecl GhcPs)
-> ClsInstDecl GhcPs -> InstDecl GhcPs
forall a b. (a -> b) -> a -> b
$ ClsInstDecl {
cid_ext :: XCClsInstDecl GhcPs
cid_ext = XCClsInstDecl GhcPs
forall a. HasDefaultExt a => a
defExt
, cid_poly_ty :: LHsSigType GhcPs
cid_poly_ty = XRec GhcPs (HsType GhcPs) -> LHsSigType GhcPs
implicitBndrs ([XRec GhcPs (HsType GhcPs)]
-> XRec GhcPs (HsType GhcPs) -> XRec GhcPs (HsType GhcPs)
qualT [XRec GhcPs (HsType GhcPs)]
ctxt XRec GhcPs (HsType GhcPs)
hd)
, cid_binds :: LHsBinds GhcPs
cid_binds = [LHsBind GhcPs] -> LHsBinds GhcPs
forall a. [a] -> Bag a
listToBag ([LHsBind GhcPs] -> LHsBinds GhcPs)
-> [LHsBind GhcPs] -> LHsBinds GhcPs
forall a b. (a -> b) -> a -> b
$ ((LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated SrcSpanAnnA (HsBind GhcPs))
-> [(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> [GenLocated SrcSpanAnnA (HsBind GhcPs)]
forall a b. (a -> b) -> [a] -> [b]
map ((LRdrName
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated SrcSpanAnnA (HsBind GhcPs))
-> (LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> GenLocated SrcSpanAnnA (HsBind GhcPs)
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry LRdrName -> LHsExpr GhcPs -> LHsBind GhcPs
LRdrName
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GenLocated SrcSpanAnnA (HsBind GhcPs)
simpleBinding) [(LRdrName, LHsExpr GhcPs)]
[(LRdrName, GenLocated SrcSpanAnnA (HsExpr GhcPs))]
binds
, cid_sigs :: [LSig GhcPs]
cid_sigs = []
, cid_tyfam_insts :: [LTyFamInstDecl GhcPs]
cid_tyfam_insts = [LTyFamInstDecl GhcPs]
assocTypes
, cid_datafam_insts :: [LDataFamInstDecl GhcPs]
cid_datafam_insts = []
, cid_overlap_mode :: Maybe (XRec GhcPs OverlapMode)
cid_overlap_mode = Maybe (XRec GhcPs OverlapMode)
Maybe (GenLocated SrcSpanAnnP OverlapMode)
forall a. Maybe a
Nothing
}
where
qualT :: [LHsType GhcPs] -> LHsType GhcPs -> LHsType GhcPs
qualT :: [XRec GhcPs (HsType GhcPs)]
-> XRec GhcPs (HsType GhcPs) -> XRec GhcPs (HsType GhcPs)
qualT [] XRec GhcPs (HsType GhcPs)
a = XRec GhcPs (HsType GhcPs)
a
qualT ctx :: [XRec GhcPs (HsType GhcPs)]
ctx@(XRec GhcPs (HsType GhcPs)
c:[XRec GhcPs (HsType GhcPs)]
_) XRec GhcPs (HsType GhcPs)
a = GenLocated SrcSpanAnnA (HsType GhcPs)
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
c (HsType GhcPs -> XRec GhcPs (HsType GhcPs))
-> HsType GhcPs -> XRec GhcPs (HsType GhcPs)
forall a b. (a -> b) -> a -> b
$
XQualTy GhcPs
-> XRec GhcPs [XRec GhcPs (HsType GhcPs)]
-> XRec GhcPs (HsType GhcPs)
-> HsType GhcPs
forall pass.
XQualTy pass -> LHsContext pass -> LHsType pass -> HsType pass
HsQualTy
XQualTy GhcPs
forall a. HasDefaultExt a => a
defExt
#if __GLASGOW_HASKELL__ >= 902 && __GLASGOW_HASKELL__ < 904
(Just (inheritLoc c ctx))
#else
(GenLocated SrcSpanAnnA (HsType GhcPs)
-> [GenLocated SrcSpanAnnA (HsType GhcPs)]
-> XRec GhcPs [XRec GhcPs (HsType GhcPs)]
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
c [XRec GhcPs (HsType GhcPs)]
[GenLocated SrcSpanAnnA (HsType GhcPs)]
ctx)
#endif
XRec GhcPs (HsType GhcPs)
a
classD ::
[LHsType GhcPs]
-> LRdrName
-> [LHsTyVarBndr GhcPs]
-> [(LRdrName, LHsType GhcPs)]
-> LHsDecl GhcPs
classD :: [XRec GhcPs (HsType GhcPs)]
-> LRdrName
-> [LHsTyVarBndr GhcPs]
-> [(LRdrName, XRec GhcPs (HsType GhcPs))]
-> LHsDecl GhcPs
classD = \[XRec GhcPs (HsType GhcPs)]
ctx LRdrName
name [LHsTyVarBndr GhcPs]
clsVars [(LRdrName, XRec GhcPs (HsType GhcPs))]
sigs -> LRdrName -> HsDecl GhcPs -> LHsDecl GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (HsDecl GhcPs -> LHsDecl GhcPs) -> HsDecl GhcPs -> LHsDecl GhcPs
forall a b. (a -> b) -> a -> b
$
XTyClD GhcPs -> TyClDecl GhcPs -> HsDecl GhcPs
forall p. XTyClD p -> TyClDecl p -> HsDecl p
TyClD XTyClD GhcPs
NoExtField
forall a. HasDefaultExt a => a
defExt (TyClDecl GhcPs -> HsDecl GhcPs) -> TyClDecl GhcPs -> HsDecl GhcPs
forall a b. (a -> b) -> a -> b
$ ClassDecl {
tcdCExt :: XClassDecl GhcPs
tcdCExt = (EpAnn [AddEpAnn], AnnSortKey)
XClassDecl GhcPs
forall a. HasDefaultExt a => a
defExt
#if __GLASGOW_HASKELL__ >= 906
, tcdLayout :: LayoutInfo GhcPs
tcdLayout = LayoutInfo GhcPs
forall pass. LayoutInfo pass
NoLayoutInfo
#endif
#if __GLASGOW_HASKELL__ >= 902
, tcdCtxt :: Maybe (XRec GhcPs [XRec GhcPs (HsType GhcPs)])
tcdCtxt = GenLocated SrcSpanAnnC [GenLocated SrcSpanAnnA (HsType GhcPs)]
-> Maybe
(GenLocated SrcSpanAnnC [GenLocated SrcSpanAnnA (HsType GhcPs)])
forall a. a -> Maybe a
Just (LRdrName
-> [GenLocated SrcSpanAnnA (HsType GhcPs)]
-> GenLocated SrcSpanAnnC [GenLocated SrcSpanAnnA (HsType GhcPs)]
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name [XRec GhcPs (HsType GhcPs)]
[GenLocated SrcSpanAnnA (HsType GhcPs)]
ctx)
#else
, tcdCtxt = inheritLoc name ctx
#endif
, tcdLName :: LIdP GhcPs
tcdLName = LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name
, tcdTyVars :: LHsQTyVars GhcPs
tcdTyVars = [LHsTyVarBndr GhcPs] -> LHsQTyVars GhcPs
mkHsQTvs [LHsTyVarBndr GhcPs]
clsVars
, tcdFixity :: LexicalFixity
tcdFixity = LexicalFixity
Prefix
, tcdFDs :: [LHsFunDep GhcPs]
tcdFDs = []
, tcdSigs :: [LSig GhcPs]
tcdSigs = ((LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))
-> GenLocated SrcSpanAnnA (Sig GhcPs))
-> [(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))]
-> [GenLocated SrcSpanAnnA (Sig GhcPs)]
forall a b. (a -> b) -> [a] -> [b]
map ((LRdrName
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (Sig GhcPs))
-> (LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))
-> GenLocated SrcSpanAnnA (Sig GhcPs)
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry LRdrName -> XRec GhcPs (HsType GhcPs) -> LSig GhcPs
LRdrName
-> GenLocated SrcSpanAnnA (HsType GhcPs)
-> GenLocated SrcSpanAnnA (Sig GhcPs)
classOpSig) [(LRdrName, XRec GhcPs (HsType GhcPs))]
[(LRdrName, GenLocated SrcSpanAnnA (HsType GhcPs))]
sigs
, tcdMeths :: LHsBinds GhcPs
tcdMeths = LHsBinds GhcPs
Bag (GenLocated SrcSpanAnnA (HsBind GhcPs))
forall a. Bag a
emptyBag
, tcdATs :: [LFamilyDecl GhcPs]
tcdATs = []
, tcdATDefs :: [LTyFamInstDecl GhcPs]
tcdATDefs = []
, tcdDocs :: [LDocDecl GhcPs]
tcdDocs = []
}
where
classOpSig :: LRdrName -> LHsType GhcPs -> LSig GhcPs
classOpSig :: LRdrName -> XRec GhcPs (HsType GhcPs) -> LSig GhcPs
classOpSig LRdrName
name XRec GhcPs (HsType GhcPs)
ty = LRdrName -> Sig GhcPs -> LSig GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
name (Sig GhcPs -> LSig GhcPs) -> Sig GhcPs -> LSig GhcPs
forall a b. (a -> b) -> a -> b
$
XClassOpSig GhcPs
-> Bool -> [LIdP GhcPs] -> LHsSigType GhcPs -> Sig GhcPs
forall pass.
XClassOpSig pass
-> Bool -> [LIdP pass] -> LHsSigType pass -> Sig pass
ClassOpSig XClassOpSig GhcPs
forall a. HasDefaultExt a => a
defExt Bool
False [LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name] (XRec GhcPs (HsType GhcPs) -> LHsSigType GhcPs
implicitBndrs XRec GhcPs (HsType GhcPs)
ty)
tySynEqn ::
LRdrName
-> [LHsType GhcPs]
-> LHsType GhcPs
-> LTyFamInstDecl GhcPs
tySynEqn :: LRdrName
-> [XRec GhcPs (HsType GhcPs)]
-> XRec GhcPs (HsType GhcPs)
-> LTyFamInstDecl GhcPs
tySynEqn LRdrName
name [XRec GhcPs (HsType GhcPs)]
pats XRec GhcPs (HsType GhcPs)
val = GenLocated SrcSpanAnnA (HsType GhcPs)
-> TyFamInstDecl GhcPs -> LTyFamInstDecl GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
val (TyFamInstDecl GhcPs -> LTyFamInstDecl GhcPs)
-> TyFamInstDecl GhcPs -> LTyFamInstDecl GhcPs
forall a b. (a -> b) -> a -> b
$
XCTyFamInstDecl GhcPs -> TyFamInstEqn GhcPs -> TyFamInstDecl GhcPs
forall pass.
XCTyFamInstDecl pass -> TyFamInstEqn pass -> TyFamInstDecl pass
TyFamInstDecl
#if __GLASGOW_HASKELL__ >= 902
XCTyFamInstDecl GhcPs
forall a. HasDefaultExt a => a
defExt (TyFamInstEqn GhcPs -> TyFamInstDecl GhcPs)
-> TyFamInstEqn GhcPs -> TyFamInstDecl GhcPs
forall a b. (a -> b) -> a -> b
$
#else
$ implicitBndrs $
#endif
XCFamEqn GhcPs (XRec GhcPs (HsType GhcPs))
-> LIdP GhcPs
-> HsOuterFamEqnTyVarBndrs GhcPs
-> HsTyPats GhcPs
-> LexicalFixity
-> XRec GhcPs (HsType GhcPs)
-> TyFamInstEqn GhcPs
forall pass rhs.
XCFamEqn pass rhs
-> LIdP pass
-> HsOuterFamEqnTyVarBndrs pass
-> HsTyPats pass
-> LexicalFixity
-> rhs
-> FamEqn pass rhs
FamEqn XCFamEqn GhcPs (XRec GhcPs (HsType GhcPs))
forall a. HasDefaultExt a => a
defExt
(LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name)
#if __GLASGOW_HASKELL__ >= 902
(XHsOuterImplicit GhcPs -> HsOuterFamEqnTyVarBndrs GhcPs
forall flag pass.
XHsOuterImplicit pass -> HsOuterTyVarBndrs flag pass
HsOuterImplicit XHsOuterImplicit GhcPs
forall a. HasDefaultExt a => a
defExt)
#else
Nothing
#endif
((XRec GhcPs (HsType GhcPs)
-> HsArg (XRec GhcPs (HsType GhcPs)) (XRec GhcPs (HsType GhcPs)))
-> [XRec GhcPs (HsType GhcPs)] -> HsTyPats GhcPs
forall a b. (a -> b) -> [a] -> [b]
map XRec GhcPs (HsType GhcPs)
-> HsArg (XRec GhcPs (HsType GhcPs)) (XRec GhcPs (HsType GhcPs))
forall tm ty. tm -> HsArg tm ty
HsValArg [XRec GhcPs (HsType GhcPs)]
pats)
LexicalFixity
Prefix
XRec GhcPs (HsType GhcPs)
val
type AnnProvenancePs = AnnProvenance
#if __GLASGOW_HASKELL__ >= 902
GhcPs
#else
RdrName
#endif
typeAnnotation :: LRdrName -> AnnProvenancePs
typeAnnotation :: LRdrName -> AnnProvenancePs
typeAnnotation LRdrName
name = LIdP GhcPs -> AnnProvenancePs
forall pass. LIdP pass -> AnnProvenance pass
TypeAnnProvenance (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
name)
viewTypeAnnotation :: AnnProvenancePs -> Maybe LRdrName
viewTypeAnnotation :: AnnProvenancePs -> Maybe LRdrName
viewTypeAnnotation (TypeAnnProvenance LIdP GhcPs
name) = LRdrName -> Maybe LRdrName
forall a. a -> Maybe a
Just (LocatedN RdrName -> LRdrName
forall a e. LocatedAn a e -> Located e
reLoc LIdP GhcPs
LocatedN RdrName
name)
viewTypeAnnotation AnnProvenancePs
_otherwise = Maybe LRdrName
forall a. Maybe a
Nothing
pattern TypeAnnotation :: LRdrName -> AnnProvenancePs
pattern $mTypeAnnotation :: forall {r}. AnnProvenancePs -> (LRdrName -> r) -> ((# #) -> r) -> r
$bTypeAnnotation :: LRdrName -> AnnProvenancePs
TypeAnnotation name <- (viewTypeAnnotation -> Just name)
where
TypeAnnotation = LRdrName -> AnnProvenancePs
typeAnnotation
pragAnnD :: AnnProvenancePs -> LHsExpr GhcPs -> AnnDecl GhcPs
pragAnnD :: AnnProvenancePs -> LHsExpr GhcPs -> AnnDecl GhcPs
pragAnnD AnnProvenancePs
prov LHsExpr GhcPs
value =
#if __GLASGOW_HASKELL__ >= 906
XHsAnnotation GhcPs
-> AnnProvenancePs -> LHsExpr GhcPs -> AnnDecl GhcPs
forall pass.
XHsAnnotation pass
-> AnnProvenance pass -> XRec pass (HsExpr pass) -> AnnDecl pass
HsAnnotation (EpAnn AnnPragma, SourceText)
XHsAnnotation GhcPs
forall a. HasDefaultExt a => a
defExt AnnProvenancePs
prov LHsExpr GhcPs
value
#else
HsAnnotation
defExt
NoSourceText
prov
value
#endif
viewPragAnnD :: AnnDecl GhcPs -> (AnnProvenancePs, LHsExpr GhcPs)
#if __GLASGOW_HASKELL__ >= 906
viewPragAnnD :: AnnDecl GhcPs -> (AnnProvenancePs, LHsExpr GhcPs)
viewPragAnnD (HsAnnotation XHsAnnotation GhcPs
_ AnnProvenancePs
prov LHsExpr GhcPs
value) = (AnnProvenancePs
prov, LHsExpr GhcPs
value)
#else
viewPragAnnD (HsAnnotation _ _ prov value) = (prov, value)
#endif
#if __GLASGOW_HASKELL__ < 900
viewPragAnnD _ = panic "viewPragAnnD"
#endif
pattern PragAnnD :: AnnProvenancePs -> LHsExpr GhcPs -> AnnDecl GhcPs
pattern $mPragAnnD :: forall {r}.
AnnDecl GhcPs
-> (AnnProvenancePs -> LHsExpr GhcPs -> r) -> ((# #) -> r) -> r
$bPragAnnD :: AnnProvenancePs -> LHsExpr GhcPs -> AnnDecl GhcPs
PragAnnD prov value <- (viewPragAnnD -> (prov, value))
where
PragAnnD = AnnProvenancePs -> LHsExpr GhcPs -> AnnDecl GhcPs
pragAnnD
#if __GLASGOW_HASKELL__ >= 902
implicitBndrs :: LHsType GhcPs -> LHsSigType GhcPs
implicitBndrs :: XRec GhcPs (HsType GhcPs) -> LHsSigType GhcPs
implicitBndrs XRec GhcPs (HsType GhcPs)
t = GenLocated SrcSpanAnnA (HsType GhcPs)
-> HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc XRec GhcPs (HsType GhcPs)
GenLocated SrcSpanAnnA (HsType GhcPs)
t (XHsSig GhcPs
-> HsOuterSigTyVarBndrs GhcPs
-> XRec GhcPs (HsType GhcPs)
-> HsSigType GhcPs
forall pass.
XHsSig pass
-> HsOuterSigTyVarBndrs pass -> LHsType pass -> HsSigType pass
HsSig XHsSig GhcPs
forall a. HasDefaultExt a => a
defExt (XHsOuterImplicit GhcPs -> HsOuterSigTyVarBndrs GhcPs
forall flag pass.
XHsOuterImplicit pass -> HsOuterTyVarBndrs flag pass
HsOuterImplicit XHsOuterImplicit GhcPs
forall a. HasDefaultExt a => a
defExt) XRec GhcPs (HsType GhcPs)
t)
viewImplicitBndrs :: LHsSigType GhcPs -> LHsType GhcPs
viewImplicitBndrs :: LHsSigType GhcPs -> XRec GhcPs (HsType GhcPs)
viewImplicitBndrs (L SrcSpanAnnA
_ (HsSig XHsSig GhcPs
_ HsOuterSigTyVarBndrs GhcPs
_ XRec GhcPs (HsType GhcPs)
ty)) = XRec GhcPs (HsType GhcPs)
ty
#else
implicitBndrs :: a -> HsImplicitBndrs GhcPs a
implicitBndrs a = HsIB defExt a
viewImplicitBndrs :: HsImplicitBndrs GhcPs a -> a
viewImplicitBndrs (HsIB _ a) = a
#if __GLASGOW_HASKELL__ < 900
viewImplicitBndrs _ = panic "viewImplicitBndrs"
#endif
#endif
simpleBinding :: LRdrName -> LHsExpr GhcPs -> LHsBind GhcPs
simpleBinding :: LRdrName -> LHsExpr GhcPs -> LHsBind GhcPs
simpleBinding LRdrName
fnName LHsExpr GhcPs
body = LRdrName -> HsBind GhcPs -> LHsBind GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
fnName (HsBind GhcPs -> LHsBind GhcPs) -> HsBind GhcPs -> LHsBind GhcPs
forall a b. (a -> b) -> a -> b
$
LRdrName -> [LMatch GhcPs (LHsExpr GhcPs)] -> HsBind GhcPs
mkFunBind LRdrName
fnName [LMatch GhcPs (LHsExpr GhcPs)
match]
where
grhs :: GRHSs GhcPs (LHsExpr GhcPs)
grhs :: GRHSs GhcPs (LHsExpr GhcPs)
grhs = LHsExpr GhcPs -> GRHSs GhcPs (LHsExpr GhcPs)
simpleGHRSs LHsExpr GhcPs
body
match :: LMatch GhcPs (LHsExpr GhcPs)
match :: LMatch GhcPs (LHsExpr GhcPs)
match = LRdrName
-> Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LMatch GhcPs (LHsExpr GhcPs)
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LRdrName
fnName (Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LMatch GhcPs (LHsExpr GhcPs))
-> Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LMatch GhcPs (LHsExpr GhcPs)
forall a b. (a -> b) -> a -> b
$
XCMatch GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> HsMatchContext GhcPs
-> [LPat GhcPs]
-> GRHSs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> Match GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall p body.
XCMatch p body
-> HsMatchContext p -> [LPat p] -> GRHSs p body -> Match p body
Match XCMatch GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
EpAnn [AddEpAnn]
forall a. HasDefaultExt a => a
defExt
(LIdP (NoGhcTc GhcPs)
-> LexicalFixity -> SrcStrictness -> HsMatchContext GhcPs
forall p.
LIdP (NoGhcTc p)
-> LexicalFixity -> SrcStrictness -> HsMatchContext p
FunRhs (LRdrName -> LocatedN RdrName
forall e ann. Located e -> LocatedAn ann e
reLocA LRdrName
fnName) LexicalFixity
Prefix SrcStrictness
NoSrcStrict)
[]
GRHSs GhcPs (LHsExpr GhcPs)
GRHSs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
grhs
simpleGHRSs :: LHsExpr GhcPs -> GRHSs GhcPs (LHsExpr GhcPs)
LHsExpr GhcPs
body =
XCGRHSs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> [LGRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))]
-> HsLocalBindsLR GhcPs GhcPs
-> GRHSs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall p body.
XCGRHSs p body -> [LGRHS p body] -> HsLocalBinds p -> GRHSs p body
GRHSs XCGRHSs GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
EpAnnComments
forall a. HasDefaultExt a => a
defExt
[GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LGRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
body (GRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LGRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs)))
-> GRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> LGRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall a b. (a -> b) -> a -> b
$ XCGRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
-> [GuardLStmt GhcPs]
-> GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> GRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall p body.
XCGRHS p body -> [GuardLStmt p] -> body -> GRHS p body
GRHS XCGRHS GhcPs (GenLocated SrcSpanAnnA (HsExpr GhcPs))
forall a. HasDefaultExt a => a
defExt [] LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
body]
(GenLocated SrcSpanAnnA (HsExpr GhcPs)
-> HsLocalBindsLR GhcPs GhcPs -> HsLocalBindsLR GhcPs GhcPs
forall x a b. InheritLoc x a b => x -> a -> b
inheritLoc LHsExpr GhcPs
GenLocated SrcSpanAnnA (HsExpr GhcPs)
body (HsLocalBindsLR GhcPs GhcPs -> HsLocalBindsLR GhcPs GhcPs)
-> HsLocalBindsLR GhcPs GhcPs -> HsLocalBindsLR GhcPs GhcPs
forall a b. (a -> b) -> a -> b
$ XEmptyLocalBinds GhcPs GhcPs -> HsLocalBindsLR GhcPs GhcPs
forall idL idR. XEmptyLocalBinds idL idR -> HsLocalBindsLR idL idR
EmptyLocalBinds XEmptyLocalBinds GhcPs GhcPs
forall a. HasDefaultExt a => a
defExt)