{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE LambdaCase #-}
module GHC.Hs.Binds where
import GHC.Prelude
import {-# SOURCE #-} GHC.Hs.Expr ( pprExpr, LHsExpr,
MatchGroup, pprFunBind,
GRHSs, pprPatBind )
import {-# SOURCE #-} GHC.Hs.Pat ( LPat )
import GHC.Hs.Extension
import GHC.Hs.Type
import GHC.Core
import GHC.Tc.Types.Evidence
import GHC.Core.Type
import GHC.Types.Name.Set
import GHC.Types.Basic
import GHC.Utils.Outputable
import GHC.Types.SrcLoc as SrcLoc
import GHC.Types.Var
import GHC.Data.Bag
import GHC.Data.FastString
import GHC.Data.BooleanFormula (LBooleanFormula)
import Data.Data hiding ( Fixity )
import Data.List hiding ( foldr )
import Data.Function
type HsLocalBinds id = HsLocalBindsLR id id
type LHsLocalBinds id = Located (HsLocalBinds id)
data HsLocalBindsLR idL idR
= HsValBinds
(XHsValBinds idL idR)
(HsValBindsLR idL idR)
| HsIPBinds
(XHsIPBinds idL idR)
(HsIPBinds idR)
| EmptyLocalBinds (XEmptyLocalBinds idL idR)
| XHsLocalBindsLR
!(XXHsLocalBindsLR idL idR)
type instance XHsValBinds (GhcPass pL) (GhcPass pR) = NoExtField
type instance XHsIPBinds (GhcPass pL) (GhcPass pR) = NoExtField
type instance XEmptyLocalBinds (GhcPass pL) (GhcPass pR) = NoExtField
type instance XXHsLocalBindsLR (GhcPass pL) (GhcPass pR) = NoExtCon
type LHsLocalBindsLR idL idR = Located (HsLocalBindsLR idL idR)
type HsValBinds id = HsValBindsLR id id
data HsValBindsLR idL idR
=
ValBinds
(XValBinds idL idR)
(LHsBindsLR idL idR) [LSig idR]
| XValBindsLR
!(XXValBindsLR idL idR)
data NHsValBindsLR idL
= NValBinds
[(RecFlag, LHsBinds idL)]
[LSig GhcRn]
type instance XValBinds (GhcPass pL) (GhcPass pR) = NoExtField
type instance XXValBindsLR (GhcPass pL) (GhcPass pR)
= NHsValBindsLR (GhcPass pL)
type LHsBind id = LHsBindLR id id
type LHsBinds id = LHsBindsLR id id
type HsBind id = HsBindLR id id
type LHsBindsLR idL idR = Bag (LHsBindLR idL idR)
type LHsBindLR idL idR = Located (HsBindLR idL idR)
data HsBindLR idL idR
=
FunBind {
forall idL idR. HsBindLR idL idR -> XFunBind idL idR
fun_ext :: XFunBind idL idR,
forall idL idR. HsBindLR idL idR -> Located (IdP idL)
fun_id :: Located (IdP idL),
forall idL idR. HsBindLR idL idR -> MatchGroup idR (LHsExpr idR)
fun_matches :: MatchGroup idR (LHsExpr idR),
forall idL idR. HsBindLR idL idR -> [Tickish Id]
fun_tick :: [Tickish Id]
}
| PatBind {
forall idL idR. HsBindLR idL idR -> XPatBind idL idR
pat_ext :: XPatBind idL idR,
forall idL idR. HsBindLR idL idR -> LPat idL
pat_lhs :: LPat idL,
forall idL idR. HsBindLR idL idR -> GRHSs idR (LHsExpr idR)
pat_rhs :: GRHSs idR (LHsExpr idR),
forall idL idR. HsBindLR idL idR -> ([Tickish Id], [[Tickish Id]])
pat_ticks :: ([Tickish Id], [[Tickish Id]])
}
| VarBind {
forall idL idR. HsBindLR idL idR -> XVarBind idL idR
var_ext :: XVarBind idL idR,
forall idL idR. HsBindLR idL idR -> IdP idL
var_id :: IdP idL,
forall idL idR. HsBindLR idL idR -> LHsExpr idR
var_rhs :: LHsExpr idR
}
| AbsBinds {
forall idL idR. HsBindLR idL idR -> XAbsBinds idL idR
abs_ext :: XAbsBinds idL idR,
forall idL idR. HsBindLR idL idR -> [Id]
abs_tvs :: [TyVar],
forall idL idR. HsBindLR idL idR -> [Id]
abs_ev_vars :: [EvVar],
forall idL idR. HsBindLR idL idR -> [ABExport idL]
abs_exports :: [ABExport idL],
forall idL idR. HsBindLR idL idR -> [TcEvBinds]
abs_ev_binds :: [TcEvBinds],
forall idL idR. HsBindLR idL idR -> LHsBinds idL
abs_binds :: LHsBinds idL,
forall idL idR. HsBindLR idL idR -> Bool
abs_sig :: Bool
}
| PatSynBind
(XPatSynBind idL idR)
(PatSynBind idL idR)
| XHsBindsLR !(XXHsBindsLR idL idR)
data NPatBindTc = NPatBindTc {
NPatBindTc -> NameSet
pat_fvs :: NameSet,
NPatBindTc -> Type
pat_rhs_ty :: Type
} deriving Typeable NPatBindTc
Typeable NPatBindTc
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NPatBindTc -> c NPatBindTc)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NPatBindTc)
-> (NPatBindTc -> Constr)
-> (NPatBindTc -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NPatBindTc))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c NPatBindTc))
-> ((forall b. Data b => b -> b) -> NPatBindTc -> NPatBindTc)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NPatBindTc -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NPatBindTc -> r)
-> (forall u. (forall d. Data d => d -> u) -> NPatBindTc -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> NPatBindTc -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc)
-> Data NPatBindTc
NPatBindTc -> DataType
NPatBindTc -> Constr
(forall b. Data b => b -> b) -> NPatBindTc -> NPatBindTc
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> NPatBindTc -> u
forall u. (forall d. Data d => d -> u) -> NPatBindTc -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NPatBindTc -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NPatBindTc -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NPatBindTc
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NPatBindTc -> c NPatBindTc
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NPatBindTc)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NPatBindTc)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NPatBindTc -> m NPatBindTc
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NPatBindTc -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NPatBindTc -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> NPatBindTc -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NPatBindTc -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NPatBindTc -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NPatBindTc -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NPatBindTc -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NPatBindTc -> r
gmapT :: (forall b. Data b => b -> b) -> NPatBindTc -> NPatBindTc
$cgmapT :: (forall b. Data b => b -> b) -> NPatBindTc -> NPatBindTc
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NPatBindTc)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NPatBindTc)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NPatBindTc)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NPatBindTc)
dataTypeOf :: NPatBindTc -> DataType
$cdataTypeOf :: NPatBindTc -> DataType
toConstr :: NPatBindTc -> Constr
$ctoConstr :: NPatBindTc -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NPatBindTc
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NPatBindTc
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NPatBindTc -> c NPatBindTc
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NPatBindTc -> c NPatBindTc
Data
type instance XFunBind (GhcPass pL) GhcPs = NoExtField
type instance XFunBind (GhcPass pL) GhcRn = NameSet
type instance XFunBind (GhcPass pL) GhcTc = HsWrapper
type instance XPatBind GhcPs (GhcPass pR) = NoExtField
type instance XPatBind GhcRn (GhcPass pR) = NameSet
type instance XPatBind GhcTc (GhcPass pR) = NPatBindTc
type instance XVarBind (GhcPass pL) (GhcPass pR) = NoExtField
type instance XAbsBinds (GhcPass pL) (GhcPass pR) = NoExtField
type instance XPatSynBind (GhcPass pL) (GhcPass pR) = NoExtField
type instance XXHsBindsLR (GhcPass pL) (GhcPass pR) = NoExtCon
data ABExport p
= ABE { forall p. ABExport p -> XABE p
abe_ext :: XABE p
, forall p. ABExport p -> IdP p
abe_poly :: IdP p
, forall p. ABExport p -> IdP p
abe_mono :: IdP p
, forall p. ABExport p -> HsWrapper
abe_wrap :: HsWrapper
, forall p. ABExport p -> TcSpecPrags
abe_prags :: TcSpecPrags
}
| XABExport !(XXABExport p)
type instance XABE (GhcPass p) = NoExtField
type instance XXABExport (GhcPass p) = NoExtCon
data PatSynBind idL idR
= PSB { forall idL idR. PatSynBind idL idR -> XPSB idL idR
psb_ext :: XPSB idL idR,
forall idL idR. PatSynBind idL idR -> Located (IdP idL)
psb_id :: Located (IdP idL),
forall idL idR.
PatSynBind idL idR -> HsPatSynDetails (Located (IdP idR))
psb_args :: HsPatSynDetails (Located (IdP idR)),
forall idL idR. PatSynBind idL idR -> LPat idR
psb_def :: LPat idR,
forall idL idR. PatSynBind idL idR -> HsPatSynDir idR
psb_dir :: HsPatSynDir idR
}
| XPatSynBind !(XXPatSynBind idL idR)
type instance XPSB (GhcPass idL) GhcPs = NoExtField
type instance XPSB (GhcPass idL) GhcRn = NameSet
type instance XPSB (GhcPass idL) GhcTc = NameSet
type instance XXPatSynBind (GhcPass idL) (GhcPass idR) = NoExtCon
instance (OutputableBndrId pl, OutputableBndrId pr)
=> Outputable (HsLocalBindsLR (GhcPass pl) (GhcPass pr)) where
ppr :: HsLocalBindsLR (GhcPass pl) (GhcPass pr) -> SDoc
ppr (HsValBinds XHsValBinds (GhcPass pl) (GhcPass pr)
_ HsValBindsLR (GhcPass pl) (GhcPass pr)
bs) = HsValBindsLR (GhcPass pl) (GhcPass pr) -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsValBindsLR (GhcPass pl) (GhcPass pr)
bs
ppr (HsIPBinds XHsIPBinds (GhcPass pl) (GhcPass pr)
_ HsIPBinds (GhcPass pr)
bs) = HsIPBinds (GhcPass pr) -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsIPBinds (GhcPass pr)
bs
ppr (EmptyLocalBinds XEmptyLocalBinds (GhcPass pl) (GhcPass pr)
_) = SDoc
empty
instance (OutputableBndrId pl, OutputableBndrId pr)
=> Outputable (HsValBindsLR (GhcPass pl) (GhcPass pr)) where
ppr :: HsValBindsLR (GhcPass pl) (GhcPass pr) -> SDoc
ppr (ValBinds XValBinds (GhcPass pl) (GhcPass pr)
_ LHsBindsLR (GhcPass pl) (GhcPass pr)
binds [LSig (GhcPass pr)]
sigs)
= [SDoc] -> SDoc
pprDeclList (LHsBindsLR (GhcPass pl) (GhcPass pr)
-> [LSig (GhcPass pr)] -> [SDoc]
forall (idL :: Pass) (idR :: Pass) (id2 :: Pass).
(OutputableBndrId idL, OutputableBndrId idR,
OutputableBndrId id2) =>
LHsBindsLR (GhcPass idL) (GhcPass idR)
-> [LSig (GhcPass id2)] -> [SDoc]
pprLHsBindsForUser LHsBindsLR (GhcPass pl) (GhcPass pr)
binds [LSig (GhcPass pr)]
sigs)
ppr (XValBindsLR (NValBinds [(RecFlag, LHsBinds (GhcPass pl))]
sccs [LSig GhcRn]
sigs))
= (Bool -> SDoc) -> SDoc
getPprDebug ((Bool -> SDoc) -> SDoc) -> (Bool -> SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ \case
Bool
True -> [SDoc] -> SDoc
vcat ((LSig GhcRn -> SDoc) -> [LSig GhcRn] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map LSig GhcRn -> SDoc
forall a. Outputable a => a -> SDoc
ppr [LSig GhcRn]
sigs) SDoc -> SDoc -> SDoc
$$ [SDoc] -> SDoc
vcat (((RecFlag, LHsBinds (GhcPass pl)) -> SDoc)
-> [(RecFlag, LHsBinds (GhcPass pl))] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (RecFlag, LHsBinds (GhcPass pl)) -> SDoc
forall {idL :: Pass} {idR :: Pass}.
(OutputableBndr (IdGhcP idL),
OutputableBndr (IdGhcP (NoGhcTcPass idL)),
OutputableBndr (IdGhcP idR),
OutputableBndr (IdGhcP (NoGhcTcPass idR)), IsPass idL,
IsPass idR) =>
(RecFlag, LHsBindsLR (GhcPass idL) (GhcPass idR)) -> SDoc
ppr_scc [(RecFlag, LHsBinds (GhcPass pl))]
sccs)
Bool
False -> [SDoc] -> SDoc
pprDeclList (LHsBinds (GhcPass pl) -> [LSig GhcRn] -> [SDoc]
forall (idL :: Pass) (idR :: Pass) (id2 :: Pass).
(OutputableBndrId idL, OutputableBndrId idR,
OutputableBndrId id2) =>
LHsBindsLR (GhcPass idL) (GhcPass idR)
-> [LSig (GhcPass id2)] -> [SDoc]
pprLHsBindsForUser ([LHsBinds (GhcPass pl)] -> LHsBinds (GhcPass pl)
forall a. [Bag a] -> Bag a
unionManyBags (((RecFlag, LHsBinds (GhcPass pl)) -> LHsBinds (GhcPass pl))
-> [(RecFlag, LHsBinds (GhcPass pl))] -> [LHsBinds (GhcPass pl)]
forall a b. (a -> b) -> [a] -> [b]
map (RecFlag, LHsBinds (GhcPass pl)) -> LHsBinds (GhcPass pl)
forall a b. (a, b) -> b
snd [(RecFlag, LHsBinds (GhcPass pl))]
sccs)) [LSig GhcRn]
sigs)
where
ppr_scc :: (RecFlag, LHsBindsLR (GhcPass idL) (GhcPass idR)) -> SDoc
ppr_scc (RecFlag
rec_flag, LHsBindsLR (GhcPass idL) (GhcPass idR)
binds) = RecFlag -> SDoc
pp_rec RecFlag
rec_flag SDoc -> SDoc -> SDoc
<+> LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
forall (idL :: Pass) (idR :: Pass).
(OutputableBndrId idL, OutputableBndrId idR) =>
LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
pprLHsBinds LHsBindsLR (GhcPass idL) (GhcPass idR)
binds
pp_rec :: RecFlag -> SDoc
pp_rec RecFlag
Recursive = String -> SDoc
text String
"rec"
pp_rec RecFlag
NonRecursive = String -> SDoc
text String
"nonrec"
pprLHsBinds :: (OutputableBndrId idL, OutputableBndrId idR)
=> LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
pprLHsBinds :: forall (idL :: Pass) (idR :: Pass).
(OutputableBndrId idL, OutputableBndrId idR) =>
LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
pprLHsBinds LHsBindsLR (GhcPass idL) (GhcPass idR)
binds
| LHsBindsLR (GhcPass idL) (GhcPass idR) -> Bool
forall idL idR. LHsBindsLR idL idR -> Bool
isEmptyLHsBinds LHsBindsLR (GhcPass idL) (GhcPass idR)
binds = SDoc
empty
| Bool
otherwise = [SDoc] -> SDoc
pprDeclList ((LHsBindLR (GhcPass idL) (GhcPass idR) -> SDoc)
-> [LHsBindLR (GhcPass idL) (GhcPass idR)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map LHsBindLR (GhcPass idL) (GhcPass idR) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (LHsBindsLR (GhcPass idL) (GhcPass idR)
-> [LHsBindLR (GhcPass idL) (GhcPass idR)]
forall a. Bag a -> [a]
bagToList LHsBindsLR (GhcPass idL) (GhcPass idR)
binds))
pprLHsBindsForUser :: (OutputableBndrId idL,
OutputableBndrId idR,
OutputableBndrId id2)
=> LHsBindsLR (GhcPass idL) (GhcPass idR) -> [LSig (GhcPass id2)] -> [SDoc]
pprLHsBindsForUser :: forall (idL :: Pass) (idR :: Pass) (id2 :: Pass).
(OutputableBndrId idL, OutputableBndrId idR,
OutputableBndrId id2) =>
LHsBindsLR (GhcPass idL) (GhcPass idR)
-> [LSig (GhcPass id2)] -> [SDoc]
pprLHsBindsForUser LHsBindsLR (GhcPass idL) (GhcPass idR)
binds [LSig (GhcPass id2)]
sigs
= ((SrcSpan, SDoc) -> SDoc) -> [(SrcSpan, SDoc)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (SrcSpan, SDoc) -> SDoc
forall a b. (a, b) -> b
snd ([(SrcSpan, SDoc)] -> [(SrcSpan, SDoc)]
forall {b}. [(SrcSpan, b)] -> [(SrcSpan, b)]
sort_by_loc [(SrcSpan, SDoc)]
decls)
where
decls :: [(SrcSpan, SDoc)]
decls :: [(SrcSpan, SDoc)]
decls = [(SrcSpan
loc, Sig (GhcPass id2) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Sig (GhcPass id2)
sig) | L SrcSpan
loc Sig (GhcPass id2)
sig <- [LSig (GhcPass id2)]
sigs] [(SrcSpan, SDoc)] -> [(SrcSpan, SDoc)] -> [(SrcSpan, SDoc)]
forall a. [a] -> [a] -> [a]
++
[(SrcSpan
loc, HsBindLR (GhcPass idL) (GhcPass idR) -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsBindLR (GhcPass idL) (GhcPass idR)
bind) | L SrcSpan
loc HsBindLR (GhcPass idL) (GhcPass idR)
bind <- LHsBindsLR (GhcPass idL) (GhcPass idR)
-> [GenLocated SrcSpan (HsBindLR (GhcPass idL) (GhcPass idR))]
forall a. Bag a -> [a]
bagToList LHsBindsLR (GhcPass idL) (GhcPass idR)
binds]
sort_by_loc :: [(SrcSpan, b)] -> [(SrcSpan, b)]
sort_by_loc [(SrcSpan, b)]
decls = ((SrcSpan, b) -> (SrcSpan, b) -> Ordering)
-> [(SrcSpan, b)] -> [(SrcSpan, b)]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy (SrcSpan -> SrcSpan -> Ordering
SrcLoc.leftmost_smallest (SrcSpan -> SrcSpan -> Ordering)
-> ((SrcSpan, b) -> SrcSpan)
-> (SrcSpan, b)
-> (SrcSpan, b)
-> Ordering
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` (SrcSpan, b) -> SrcSpan
forall a b. (a, b) -> a
fst) [(SrcSpan, b)]
decls
pprDeclList :: [SDoc] -> SDoc
pprDeclList :: [SDoc] -> SDoc
pprDeclList [SDoc]
ds = ([SDoc] -> SDoc) -> [SDoc] -> SDoc
pprDeeperList [SDoc] -> SDoc
vcat [SDoc]
ds
emptyLocalBinds :: HsLocalBindsLR (GhcPass a) (GhcPass b)
emptyLocalBinds :: forall (a :: Pass) (b :: Pass).
HsLocalBindsLR (GhcPass a) (GhcPass b)
emptyLocalBinds = XEmptyLocalBinds (GhcPass a) (GhcPass b)
-> HsLocalBindsLR (GhcPass a) (GhcPass b)
forall idL idR. XEmptyLocalBinds idL idR -> HsLocalBindsLR idL idR
EmptyLocalBinds NoExtField
XEmptyLocalBinds (GhcPass a) (GhcPass b)
noExtField
eqEmptyLocalBinds :: HsLocalBindsLR a b -> Bool
eqEmptyLocalBinds :: forall a b. HsLocalBindsLR a b -> Bool
eqEmptyLocalBinds (EmptyLocalBinds XEmptyLocalBinds a b
_) = Bool
True
eqEmptyLocalBinds HsLocalBindsLR a b
_ = Bool
False
isEmptyValBinds :: HsValBindsLR (GhcPass a) (GhcPass b) -> Bool
isEmptyValBinds :: forall (a :: Pass) (b :: Pass).
HsValBindsLR (GhcPass a) (GhcPass b) -> Bool
isEmptyValBinds (ValBinds XValBinds (GhcPass a) (GhcPass b)
_ LHsBindsLR (GhcPass a) (GhcPass b)
ds [LSig (GhcPass b)]
sigs) = LHsBindsLR (GhcPass a) (GhcPass b) -> Bool
forall idL idR. LHsBindsLR idL idR -> Bool
isEmptyLHsBinds LHsBindsLR (GhcPass a) (GhcPass b)
ds Bool -> Bool -> Bool
&& [LSig (GhcPass b)] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [LSig (GhcPass b)]
sigs
isEmptyValBinds (XValBindsLR (NValBinds [(RecFlag, LHsBinds (GhcPass a))]
ds [LSig GhcRn]
sigs)) = [(RecFlag, LHsBinds (GhcPass a))] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(RecFlag, LHsBinds (GhcPass a))]
ds Bool -> Bool -> Bool
&& [LSig GhcRn] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [LSig GhcRn]
sigs
emptyValBindsIn, emptyValBindsOut :: HsValBindsLR (GhcPass a) (GhcPass b)
emptyValBindsIn :: forall (a :: Pass) (b :: Pass).
HsValBindsLR (GhcPass a) (GhcPass b)
emptyValBindsIn = XValBinds (GhcPass a) (GhcPass b)
-> LHsBindsLR (GhcPass a) (GhcPass b)
-> [LSig (GhcPass b)]
-> HsValBindsLR (GhcPass a) (GhcPass b)
forall idL idR.
XValBinds idL idR
-> LHsBindsLR idL idR -> [LSig idR] -> HsValBindsLR idL idR
ValBinds NoExtField
XValBinds (GhcPass a) (GhcPass b)
noExtField LHsBindsLR (GhcPass a) (GhcPass b)
forall a. Bag a
emptyBag []
emptyValBindsOut :: forall (a :: Pass) (b :: Pass).
HsValBindsLR (GhcPass a) (GhcPass b)
emptyValBindsOut = XXValBindsLR (GhcPass a) (GhcPass b)
-> HsValBindsLR (GhcPass a) (GhcPass b)
forall idL idR. XXValBindsLR idL idR -> HsValBindsLR idL idR
XValBindsLR ([(RecFlag, LHsBinds (GhcPass a))]
-> [LSig GhcRn] -> NHsValBindsLR (GhcPass a)
forall idL.
[(RecFlag, LHsBinds idL)] -> [LSig GhcRn] -> NHsValBindsLR idL
NValBinds [] [])
emptyLHsBinds :: LHsBindsLR idL idR
emptyLHsBinds :: forall idL idR. LHsBindsLR idL idR
emptyLHsBinds = Bag (LHsBindLR idL idR)
forall a. Bag a
emptyBag
isEmptyLHsBinds :: LHsBindsLR idL idR -> Bool
isEmptyLHsBinds :: forall idL idR. LHsBindsLR idL idR -> Bool
isEmptyLHsBinds = Bag (LHsBindLR idL idR) -> Bool
forall a. Bag a -> Bool
isEmptyBag
plusHsValBinds :: HsValBinds (GhcPass a) -> HsValBinds (GhcPass a)
-> HsValBinds(GhcPass a)
plusHsValBinds :: forall (a :: Pass).
HsValBinds (GhcPass a)
-> HsValBinds (GhcPass a) -> HsValBinds (GhcPass a)
plusHsValBinds (ValBinds XValBinds (GhcPass a) (GhcPass a)
_ LHsBindsLR (GhcPass a) (GhcPass a)
ds1 [LSig (GhcPass a)]
sigs1) (ValBinds XValBinds (GhcPass a) (GhcPass a)
_ LHsBindsLR (GhcPass a) (GhcPass a)
ds2 [LSig (GhcPass a)]
sigs2)
= XValBinds (GhcPass a) (GhcPass a)
-> LHsBindsLR (GhcPass a) (GhcPass a)
-> [LSig (GhcPass a)]
-> HsValBindsLR (GhcPass a) (GhcPass a)
forall idL idR.
XValBinds idL idR
-> LHsBindsLR idL idR -> [LSig idR] -> HsValBindsLR idL idR
ValBinds NoExtField
XValBinds (GhcPass a) (GhcPass a)
noExtField (LHsBindsLR (GhcPass a) (GhcPass a)
ds1 LHsBindsLR (GhcPass a) (GhcPass a)
-> LHsBindsLR (GhcPass a) (GhcPass a)
-> LHsBindsLR (GhcPass a) (GhcPass a)
forall a. Bag a -> Bag a -> Bag a
`unionBags` LHsBindsLR (GhcPass a) (GhcPass a)
ds2) ([LSig (GhcPass a)]
sigs1 [LSig (GhcPass a)] -> [LSig (GhcPass a)] -> [LSig (GhcPass a)]
forall a. [a] -> [a] -> [a]
++ [LSig (GhcPass a)]
sigs2)
plusHsValBinds (XValBindsLR (NValBinds [(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
ds1 [LSig GhcRn]
sigs1))
(XValBindsLR (NValBinds [(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
ds2 [LSig GhcRn]
sigs2))
= XXValBindsLR (GhcPass a) (GhcPass a)
-> HsValBindsLR (GhcPass a) (GhcPass a)
forall idL idR. XXValBindsLR idL idR -> HsValBindsLR idL idR
XValBindsLR ([(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
-> [LSig GhcRn] -> NHsValBindsLR (GhcPass a)
forall idL.
[(RecFlag, LHsBinds idL)] -> [LSig GhcRn] -> NHsValBindsLR idL
NValBinds ([(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
ds1 [(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
-> [(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
-> [(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
forall a. [a] -> [a] -> [a]
++ [(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
ds2) ([LSig GhcRn]
sigs1 [LSig GhcRn] -> [LSig GhcRn] -> [LSig GhcRn]
forall a. [a] -> [a] -> [a]
++ [LSig GhcRn]
sigs2))
plusHsValBinds HsValBindsLR (GhcPass a) (GhcPass a)
_ HsValBindsLR (GhcPass a) (GhcPass a)
_
= String -> HsValBindsLR (GhcPass a) (GhcPass a)
forall a. String -> a
panic String
"HsBinds.plusHsValBinds"
instance (OutputableBndrId pl, OutputableBndrId pr)
=> Outputable (HsBindLR (GhcPass pl) (GhcPass pr)) where
ppr :: HsBindLR (GhcPass pl) (GhcPass pr) -> SDoc
ppr HsBindLR (GhcPass pl) (GhcPass pr)
mbind = HsBindLR (GhcPass pl) (GhcPass pr) -> SDoc
forall (pl :: Pass) (pr :: Pass).
(OutputableBndrId pl, OutputableBndrId pr) =>
HsBindLR (GhcPass pl) (GhcPass pr) -> SDoc
ppr_monobind HsBindLR (GhcPass pl) (GhcPass pr)
mbind
ppr_monobind :: forall idL idR.
(OutputableBndrId idL, OutputableBndrId idR)
=> HsBindLR (GhcPass idL) (GhcPass idR) -> SDoc
ppr_monobind :: forall (pl :: Pass) (pr :: Pass).
(OutputableBndrId pl, OutputableBndrId pr) =>
HsBindLR (GhcPass pl) (GhcPass pr) -> SDoc
ppr_monobind (PatBind { pat_lhs :: forall idL idR. HsBindLR idL idR -> LPat idL
pat_lhs = LPat (GhcPass idL)
pat, pat_rhs :: forall idL idR. HsBindLR idL idR -> GRHSs idR (LHsExpr idR)
pat_rhs = GRHSs (GhcPass idR) (LHsExpr (GhcPass idR))
grhss })
= LPat (GhcPass idL)
-> GRHSs (GhcPass idR) (LHsExpr (GhcPass idR)) -> SDoc
forall (bndr :: Pass) (p :: Pass) body.
(OutputableBndrId bndr, OutputableBndrId p, Outputable body) =>
LPat (GhcPass bndr) -> GRHSs (GhcPass p) body -> SDoc
pprPatBind LPat (GhcPass idL)
pat GRHSs (GhcPass idR) (LHsExpr (GhcPass idR))
grhss
ppr_monobind (VarBind { var_id :: forall idL idR. HsBindLR idL idR -> IdP idL
var_id = IdP (GhcPass idL)
var, var_rhs :: forall idL idR. HsBindLR idL idR -> LHsExpr idR
var_rhs = LHsExpr (GhcPass idR)
rhs })
= [SDoc] -> SDoc
sep [BindingSite -> IdGhcP idL -> SDoc
forall a. OutputableBndr a => BindingSite -> a -> SDoc
pprBndr BindingSite
CasePatBind IdGhcP idL
IdP (GhcPass idL)
var, Int -> SDoc -> SDoc
nest Int
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ SDoc
equals SDoc -> SDoc -> SDoc
<+> HsExpr (GhcPass idR) -> SDoc
forall (p :: Pass).
OutputableBndrId p =>
HsExpr (GhcPass p) -> SDoc
pprExpr (LHsExpr (GhcPass idR) -> HsExpr (GhcPass idR)
forall l e. GenLocated l e -> e
unLoc LHsExpr (GhcPass idR)
rhs)]
ppr_monobind (FunBind { fun_id :: forall idL idR. HsBindLR idL idR -> Located (IdP idL)
fun_id = Located (IdP (GhcPass idL))
fun,
fun_matches :: forall idL idR. HsBindLR idL idR -> MatchGroup idR (LHsExpr idR)
fun_matches = MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR))
matches,
fun_tick :: forall idL idR. HsBindLR idL idR -> [Tickish Id]
fun_tick = [Tickish Id]
ticks,
fun_ext :: forall idL idR. HsBindLR idL idR -> XFunBind idL idR
fun_ext = XFunBind (GhcPass idL) (GhcPass idR)
wrap })
= SDoc -> SDoc -> SDoc
pprTicks SDoc
empty (if [Tickish Id] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Tickish Id]
ticks then SDoc
empty
else String -> SDoc
text String
"-- ticks = " SDoc -> SDoc -> SDoc
<> [Tickish Id] -> SDoc
forall a. Outputable a => a -> SDoc
ppr [Tickish Id]
ticks)
SDoc -> SDoc -> SDoc
$$ SDoc -> SDoc
whenPprDebug (BindingSite -> IdGhcP idL -> SDoc
forall a. OutputableBndr a => BindingSite -> a -> SDoc
pprBndr BindingSite
LetBind (GenLocated SrcSpan (IdGhcP idL) -> IdGhcP idL
forall l e. GenLocated l e -> e
unLoc GenLocated SrcSpan (IdGhcP idL)
Located (IdP (GhcPass idL))
fun))
SDoc -> SDoc -> SDoc
$$ MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR)) -> SDoc
forall (idR :: Pass) body.
(OutputableBndrId idR, Outputable body) =>
MatchGroup (GhcPass idR) body -> SDoc
pprFunBind MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR))
matches
SDoc -> SDoc -> SDoc
$$ SDoc -> SDoc
whenPprDebug (forall (p :: Pass).
IsPass p =>
((p ~ 'Typechecked) => SDoc) -> SDoc
pprIfTc @idR (((idR ~ 'Typechecked) => SDoc) -> SDoc)
-> ((idR ~ 'Typechecked) => SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ HsWrapper -> SDoc
forall a. Outputable a => a -> SDoc
ppr XFunBind (GhcPass idL) (GhcPass idR)
HsWrapper
wrap)
ppr_monobind (PatSynBind XPatSynBind (GhcPass idL) (GhcPass idR)
_ PatSynBind (GhcPass idL) (GhcPass idR)
psb) = PatSynBind (GhcPass idL) (GhcPass idR) -> SDoc
forall a. Outputable a => a -> SDoc
ppr PatSynBind (GhcPass idL) (GhcPass idR)
psb
ppr_monobind (AbsBinds { abs_tvs :: forall idL idR. HsBindLR idL idR -> [Id]
abs_tvs = [Id]
tyvars, abs_ev_vars :: forall idL idR. HsBindLR idL idR -> [Id]
abs_ev_vars = [Id]
dictvars
, abs_exports :: forall idL idR. HsBindLR idL idR -> [ABExport idL]
abs_exports = [ABExport (GhcPass idL)]
exports, abs_binds :: forall idL idR. HsBindLR idL idR -> LHsBinds idL
abs_binds = LHsBinds (GhcPass idL)
val_binds
, abs_ev_binds :: forall idL idR. HsBindLR idL idR -> [TcEvBinds]
abs_ev_binds = [TcEvBinds]
ev_binds })
= (SDocContext -> Bool) -> (Bool -> SDoc) -> SDoc
forall a. (SDocContext -> a) -> (a -> SDoc) -> SDoc
sdocOption SDocContext -> Bool
sdocPrintTypecheckerElaboration ((Bool -> SDoc) -> SDoc) -> (Bool -> SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ \case
Bool
False -> LHsBinds (GhcPass idL) -> SDoc
forall (idL :: Pass) (idR :: Pass).
(OutputableBndrId idL, OutputableBndrId idR) =>
LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
pprLHsBinds LHsBinds (GhcPass idL)
val_binds
Bool
True ->
SDoc -> Int -> SDoc -> SDoc
hang (String -> SDoc
text String
"AbsBinds"
SDoc -> SDoc -> SDoc
<+> [SDoc] -> SDoc
sep [ SDoc -> SDoc
brackets ([Id] -> SDoc
forall a. Outputable a => [a] -> SDoc
interpp'SP [Id]
tyvars)
, SDoc -> SDoc
brackets ([Id] -> SDoc
forall a. Outputable a => [a] -> SDoc
interpp'SP [Id]
dictvars) ])
Int
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> SDoc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
vcat
[ String -> SDoc
text String
"Exports:" SDoc -> SDoc -> SDoc
<+>
SDoc -> SDoc
brackets ([SDoc] -> SDoc
sep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((ABExport (GhcPass idL) -> SDoc)
-> [ABExport (GhcPass idL)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map ABExport (GhcPass idL) -> SDoc
forall a. Outputable a => a -> SDoc
ppr [ABExport (GhcPass idL)]
exports)))
, String -> SDoc
text String
"Exported types:" SDoc -> SDoc -> SDoc
<+>
[SDoc] -> SDoc
vcat [BindingSite -> IdGhcP idL -> SDoc
forall a. OutputableBndr a => BindingSite -> a -> SDoc
pprBndr BindingSite
LetBind (ABExport (GhcPass idL) -> IdP (GhcPass idL)
forall p. ABExport p -> IdP p
abe_poly ABExport (GhcPass idL)
ex) | ABExport (GhcPass idL)
ex <- [ABExport (GhcPass idL)]
exports]
, String -> SDoc
text String
"Binds:" SDoc -> SDoc -> SDoc
<+> LHsBinds (GhcPass idL) -> SDoc
forall (idL :: Pass) (idR :: Pass).
(OutputableBndrId idL, OutputableBndrId idR) =>
LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
pprLHsBinds LHsBinds (GhcPass idL)
val_binds
, forall (p :: Pass).
IsPass p =>
((p ~ 'Typechecked) => SDoc) -> SDoc
pprIfTc @idR (String -> SDoc
text String
"Evidence:" SDoc -> SDoc -> SDoc
<+> [TcEvBinds] -> SDoc
forall a. Outputable a => a -> SDoc
ppr [TcEvBinds]
ev_binds)
]
instance OutputableBndrId p => Outputable (ABExport (GhcPass p)) where
ppr :: ABExport (GhcPass p) -> SDoc
ppr (ABE { abe_wrap :: forall p. ABExport p -> HsWrapper
abe_wrap = HsWrapper
wrap, abe_poly :: forall p. ABExport p -> IdP p
abe_poly = IdP (GhcPass p)
gbl, abe_mono :: forall p. ABExport p -> IdP p
abe_mono = IdP (GhcPass p)
lcl, abe_prags :: forall p. ABExport p -> TcSpecPrags
abe_prags = TcSpecPrags
prags })
= [SDoc] -> SDoc
vcat [ [SDoc] -> SDoc
sep [ IdGhcP p -> SDoc
forall a. Outputable a => a -> SDoc
ppr IdGhcP p
IdP (GhcPass p)
gbl, Int -> SDoc -> SDoc
nest Int
2 (String -> SDoc
text String
"<=" SDoc -> SDoc -> SDoc
<+> IdGhcP p -> SDoc
forall a. Outputable a => a -> SDoc
ppr IdGhcP p
IdP (GhcPass p)
lcl) ]
, Int -> SDoc -> SDoc
nest Int
2 (TcSpecPrags -> SDoc
pprTcSpecPrags TcSpecPrags
prags)
, forall (p :: Pass).
IsPass p =>
((p ~ 'Typechecked) => SDoc) -> SDoc
pprIfTc @p (((p ~ 'Typechecked) => SDoc) -> SDoc)
-> ((p ~ 'Typechecked) => SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ Int -> SDoc -> SDoc
nest Int
2 (String -> SDoc
text String
"wrap:" SDoc -> SDoc -> SDoc
<+> HsWrapper -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsWrapper
wrap) ]
instance (OutputableBndrId l, OutputableBndrId r,
Outputable (XXPatSynBind (GhcPass l) (GhcPass r)))
=> Outputable (PatSynBind (GhcPass l) (GhcPass r)) where
ppr :: PatSynBind (GhcPass l) (GhcPass r) -> SDoc
ppr (PSB{ psb_id :: forall idL idR. PatSynBind idL idR -> Located (IdP idL)
psb_id = (L SrcSpan
_ IdP (GhcPass l)
psyn), psb_args :: forall idL idR.
PatSynBind idL idR -> HsPatSynDetails (Located (IdP idR))
psb_args = HsPatSynDetails (Located (IdP (GhcPass r)))
details, psb_def :: forall idL idR. PatSynBind idL idR -> LPat idR
psb_def = LPat (GhcPass r)
pat,
psb_dir :: forall idL idR. PatSynBind idL idR -> HsPatSynDir idR
psb_dir = HsPatSynDir (GhcPass r)
dir })
= SDoc
ppr_lhs SDoc -> SDoc -> SDoc
<+> SDoc
ppr_rhs
where
ppr_lhs :: SDoc
ppr_lhs = String -> SDoc
text String
"pattern" SDoc -> SDoc -> SDoc
<+> SDoc
ppr_details
ppr_simple :: SDoc -> SDoc
ppr_simple SDoc
syntax = SDoc
syntax SDoc -> SDoc -> SDoc
<+> Located (Pat (GhcPass r)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (Pat (GhcPass r))
LPat (GhcPass r)
pat
ppr_details :: SDoc
ppr_details = case HsPatSynDetails (Located (IdP (GhcPass r)))
details of
InfixCon Located (IdP (GhcPass r))
v1 Located (IdP (GhcPass r))
v2 -> [SDoc] -> SDoc
hsep [Located (IdGhcP r) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (IdGhcP r)
Located (IdP (GhcPass r))
v1, IdGhcP l -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprInfixOcc IdGhcP l
IdP (GhcPass l)
psyn, Located (IdGhcP r) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (IdGhcP r)
Located (IdP (GhcPass r))
v2]
PrefixCon [Located (IdP (GhcPass r))]
vs -> [SDoc] -> SDoc
hsep (IdGhcP l -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc IdGhcP l
IdP (GhcPass l)
psyn SDoc -> [SDoc] -> [SDoc]
forall a. a -> [a] -> [a]
: (Located (IdGhcP r) -> SDoc) -> [Located (IdGhcP r)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map Located (IdGhcP r) -> SDoc
forall a. Outputable a => a -> SDoc
ppr [Located (IdGhcP r)]
[Located (IdP (GhcPass r))]
vs)
RecCon [RecordPatSynField (Located (IdP (GhcPass r)))]
vs -> IdGhcP l -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc IdGhcP l
IdP (GhcPass l)
psyn
SDoc -> SDoc -> SDoc
<> SDoc -> SDoc
braces ([SDoc] -> SDoc
sep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((RecordPatSynField (Located (IdGhcP r)) -> SDoc)
-> [RecordPatSynField (Located (IdGhcP r))] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map RecordPatSynField (Located (IdGhcP r)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr [RecordPatSynField (Located (IdGhcP r))]
[RecordPatSynField (Located (IdP (GhcPass r)))]
vs)))
ppr_rhs :: SDoc
ppr_rhs = case HsPatSynDir (GhcPass r)
dir of
HsPatSynDir (GhcPass r)
Unidirectional -> SDoc -> SDoc
ppr_simple (String -> SDoc
text String
"<-")
HsPatSynDir (GhcPass r)
ImplicitBidirectional -> SDoc -> SDoc
ppr_simple SDoc
equals
ExplicitBidirectional MatchGroup (GhcPass r) (LHsExpr (GhcPass r))
mg -> SDoc -> SDoc
ppr_simple (String -> SDoc
text String
"<-") SDoc -> SDoc -> SDoc
<+> PtrString -> SDoc
ptext (String -> PtrString
sLit String
"where") SDoc -> SDoc -> SDoc
$$
(Int -> SDoc -> SDoc
nest Int
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ MatchGroup (GhcPass r) (LHsExpr (GhcPass r)) -> SDoc
forall (idR :: Pass) body.
(OutputableBndrId idR, Outputable body) =>
MatchGroup (GhcPass idR) body -> SDoc
pprFunBind MatchGroup (GhcPass r) (LHsExpr (GhcPass r))
mg)
pprTicks :: SDoc -> SDoc -> SDoc
pprTicks :: SDoc -> SDoc -> SDoc
pprTicks SDoc
pp_no_debug SDoc
pp_when_debug
= (PprStyle -> SDoc) -> SDoc
getPprStyle ((PprStyle -> SDoc) -> SDoc) -> (PprStyle -> SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ \PprStyle
sty ->
(Bool -> SDoc) -> SDoc
getPprDebug ((Bool -> SDoc) -> SDoc) -> (Bool -> SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ \Bool
debug ->
if Bool
debug Bool -> Bool -> Bool
|| PprStyle -> Bool
dumpStyle PprStyle
sty
then SDoc
pp_when_debug
else SDoc
pp_no_debug
data HsIPBinds id
= IPBinds
(XIPBinds id)
[LIPBind id]
| XHsIPBinds !(XXHsIPBinds id)
type instance XIPBinds GhcPs = NoExtField
type instance XIPBinds GhcRn = NoExtField
type instance XIPBinds GhcTc = TcEvBinds
type instance XXHsIPBinds (GhcPass p) = NoExtCon
isEmptyIPBindsPR :: HsIPBinds (GhcPass p) -> Bool
isEmptyIPBindsPR :: forall (p :: Pass). HsIPBinds (GhcPass p) -> Bool
isEmptyIPBindsPR (IPBinds XIPBinds (GhcPass p)
_ [LIPBind (GhcPass p)]
is) = [LIPBind (GhcPass p)] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [LIPBind (GhcPass p)]
is
isEmptyIPBindsTc :: HsIPBinds GhcTc -> Bool
isEmptyIPBindsTc :: HsIPBinds GhcTc -> Bool
isEmptyIPBindsTc (IPBinds XIPBinds GhcTc
ds [LIPBind GhcTc]
is) = [LIPBind GhcTc] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [LIPBind GhcTc]
is Bool -> Bool -> Bool
&& TcEvBinds -> Bool
isEmptyTcEvBinds XIPBinds GhcTc
TcEvBinds
ds
type LIPBind id = Located (IPBind id)
data IPBind id
= IPBind
(XCIPBind id)
(Either (Located HsIPName) (IdP id))
(LHsExpr id)
| XIPBind !(XXIPBind id)
type instance XCIPBind (GhcPass p) = NoExtField
type instance XXIPBind (GhcPass p) = NoExtCon
instance OutputableBndrId p
=> Outputable (HsIPBinds (GhcPass p)) where
ppr :: HsIPBinds (GhcPass p) -> SDoc
ppr (IPBinds XIPBinds (GhcPass p)
ds [LIPBind (GhcPass p)]
bs) = ([SDoc] -> SDoc) -> [SDoc] -> SDoc
pprDeeperList [SDoc] -> SDoc
vcat ((LIPBind (GhcPass p) -> SDoc) -> [LIPBind (GhcPass p)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map LIPBind (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr [LIPBind (GhcPass p)]
bs)
SDoc -> SDoc -> SDoc
$$ SDoc -> SDoc
whenPprDebug (forall (p :: Pass).
IsPass p =>
((p ~ 'Typechecked) => SDoc) -> SDoc
pprIfTc @p (((p ~ 'Typechecked) => SDoc) -> SDoc)
-> ((p ~ 'Typechecked) => SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ TcEvBinds -> SDoc
forall a. Outputable a => a -> SDoc
ppr XIPBinds (GhcPass p)
TcEvBinds
ds)
instance OutputableBndrId p => Outputable (IPBind (GhcPass p)) where
ppr :: IPBind (GhcPass p) -> SDoc
ppr (IPBind XCIPBind (GhcPass p)
_ Either (Located HsIPName) (IdP (GhcPass p))
lr LHsExpr (GhcPass p)
rhs) = SDoc
name SDoc -> SDoc -> SDoc
<+> SDoc
equals SDoc -> SDoc -> SDoc
<+> HsExpr (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId p =>
HsExpr (GhcPass p) -> SDoc
pprExpr (LHsExpr (GhcPass p) -> HsExpr (GhcPass p)
forall l e. GenLocated l e -> e
unLoc LHsExpr (GhcPass p)
rhs)
where name :: SDoc
name = case Either (Located HsIPName) (IdP (GhcPass p))
lr of
Left (L SrcSpan
_ HsIPName
ip) -> BindingSite -> HsIPName -> SDoc
forall a. OutputableBndr a => BindingSite -> a -> SDoc
pprBndr BindingSite
LetBind HsIPName
ip
Right IdP (GhcPass p)
id -> BindingSite -> IdGhcP p -> SDoc
forall a. OutputableBndr a => BindingSite -> a -> SDoc
pprBndr BindingSite
LetBind IdGhcP p
IdP (GhcPass p)
id
type LSig pass = Located (Sig pass)
data Sig pass
=
TypeSig
(XTypeSig pass)
[Located (IdP pass)]
(LHsSigWcType pass)
| PatSynSig (XPatSynSig pass) [Located (IdP pass)] (LHsSigType pass)
| ClassOpSig (XClassOpSig pass) Bool [Located (IdP pass)] (LHsSigType pass)
| IdSig (XIdSig pass) Id
| FixSig (XFixSig pass) (FixitySig pass)
| InlineSig (XInlineSig pass)
(Located (IdP pass))
InlinePragma
| SpecSig (XSpecSig pass)
(Located (IdP pass))
[LHsSigType pass]
InlinePragma
| SpecInstSig (XSpecInstSig pass) SourceText (LHsSigType pass)
| MinimalSig (XMinimalSig pass)
SourceText (LBooleanFormula (Located (IdP pass)))
| SCCFunSig (XSCCFunSig pass)
SourceText
(Located (IdP pass))
(Maybe (Located StringLiteral))
| CompleteMatchSig (XCompleteMatchSig pass)
SourceText
(Located [Located (IdP pass)])
(Maybe (Located (IdP pass)))
| XSig !(XXSig pass)
type instance XTypeSig (GhcPass p) = NoExtField
type instance XPatSynSig (GhcPass p) = NoExtField
type instance XClassOpSig (GhcPass p) = NoExtField
type instance XIdSig (GhcPass p) = NoExtField
type instance XFixSig (GhcPass p) = NoExtField
type instance XInlineSig (GhcPass p) = NoExtField
type instance XSpecSig (GhcPass p) = NoExtField
type instance XSpecInstSig (GhcPass p) = NoExtField
type instance XMinimalSig (GhcPass p) = NoExtField
type instance XSCCFunSig (GhcPass p) = NoExtField
type instance XCompleteMatchSig (GhcPass p) = NoExtField
type instance XXSig (GhcPass p) = NoExtCon
type LFixitySig pass = Located (FixitySig pass)
data FixitySig pass = FixitySig (XFixitySig pass) [Located (IdP pass)] Fixity
| XFixitySig !(XXFixitySig pass)
type instance XFixitySig (GhcPass p) = NoExtField
type instance XXFixitySig (GhcPass p) = NoExtCon
data TcSpecPrags
= IsDefaultMethod
| SpecPrags [LTcSpecPrag]
deriving Typeable TcSpecPrags
Typeable TcSpecPrags
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TcSpecPrags -> c TcSpecPrags)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TcSpecPrags)
-> (TcSpecPrags -> Constr)
-> (TcSpecPrags -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TcSpecPrags))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TcSpecPrags))
-> ((forall b. Data b => b -> b) -> TcSpecPrags -> TcSpecPrags)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r)
-> (forall u. (forall d. Data d => d -> u) -> TcSpecPrags -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> TcSpecPrags -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags)
-> Data TcSpecPrags
TcSpecPrags -> DataType
TcSpecPrags -> Constr
(forall b. Data b => b -> b) -> TcSpecPrags -> TcSpecPrags
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrags -> u
forall u. (forall d. Data d => d -> u) -> TcSpecPrags -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TcSpecPrags
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TcSpecPrags -> c TcSpecPrags
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TcSpecPrags)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TcSpecPrags)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrags -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrags -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> TcSpecPrags -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TcSpecPrags -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
gmapT :: (forall b. Data b => b -> b) -> TcSpecPrags -> TcSpecPrags
$cgmapT :: (forall b. Data b => b -> b) -> TcSpecPrags -> TcSpecPrags
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TcSpecPrags)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TcSpecPrags)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TcSpecPrags)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TcSpecPrags)
dataTypeOf :: TcSpecPrags -> DataType
$cdataTypeOf :: TcSpecPrags -> DataType
toConstr :: TcSpecPrags -> Constr
$ctoConstr :: TcSpecPrags -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TcSpecPrags
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TcSpecPrags
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TcSpecPrags -> c TcSpecPrags
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TcSpecPrags -> c TcSpecPrags
Data
type LTcSpecPrag = Located TcSpecPrag
data TcSpecPrag
= SpecPrag
Id
HsWrapper
InlinePragma
deriving Typeable TcSpecPrag
Typeable TcSpecPrag
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TcSpecPrag -> c TcSpecPrag)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TcSpecPrag)
-> (TcSpecPrag -> Constr)
-> (TcSpecPrag -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TcSpecPrag))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TcSpecPrag))
-> ((forall b. Data b => b -> b) -> TcSpecPrag -> TcSpecPrag)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r)
-> (forall u. (forall d. Data d => d -> u) -> TcSpecPrag -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> TcSpecPrag -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag)
-> Data TcSpecPrag
TcSpecPrag -> DataType
TcSpecPrag -> Constr
(forall b. Data b => b -> b) -> TcSpecPrag -> TcSpecPrag
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrag -> u
forall u. (forall d. Data d => d -> u) -> TcSpecPrag -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TcSpecPrag
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TcSpecPrag -> c TcSpecPrag
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TcSpecPrag)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TcSpecPrag)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrag -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrag -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> TcSpecPrag -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TcSpecPrag -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
gmapT :: (forall b. Data b => b -> b) -> TcSpecPrag -> TcSpecPrag
$cgmapT :: (forall b. Data b => b -> b) -> TcSpecPrag -> TcSpecPrag
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TcSpecPrag)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TcSpecPrag)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TcSpecPrag)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TcSpecPrag)
dataTypeOf :: TcSpecPrag -> DataType
$cdataTypeOf :: TcSpecPrag -> DataType
toConstr :: TcSpecPrag -> Constr
$ctoConstr :: TcSpecPrag -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TcSpecPrag
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TcSpecPrag
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TcSpecPrag -> c TcSpecPrag
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TcSpecPrag -> c TcSpecPrag
Data
noSpecPrags :: TcSpecPrags
noSpecPrags :: TcSpecPrags
noSpecPrags = [LTcSpecPrag] -> TcSpecPrags
SpecPrags []
hasSpecPrags :: TcSpecPrags -> Bool
hasSpecPrags :: TcSpecPrags -> Bool
hasSpecPrags (SpecPrags [LTcSpecPrag]
ps) = Bool -> Bool
not ([LTcSpecPrag] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [LTcSpecPrag]
ps)
hasSpecPrags TcSpecPrags
IsDefaultMethod = Bool
False
isDefaultMethod :: TcSpecPrags -> Bool
isDefaultMethod :: TcSpecPrags -> Bool
isDefaultMethod TcSpecPrags
IsDefaultMethod = Bool
True
isDefaultMethod (SpecPrags {}) = Bool
False
isFixityLSig :: LSig name -> Bool
isFixityLSig :: forall name. LSig name -> Bool
isFixityLSig (L SrcSpan
_ (FixSig {})) = Bool
True
isFixityLSig GenLocated SrcSpan (Sig name)
_ = Bool
False
isTypeLSig :: LSig name -> Bool
isTypeLSig :: forall name. LSig name -> Bool
isTypeLSig (L SrcSpan
_(TypeSig {})) = Bool
True
isTypeLSig (L SrcSpan
_(ClassOpSig {})) = Bool
True
isTypeLSig (L SrcSpan
_(IdSig {})) = Bool
True
isTypeLSig GenLocated SrcSpan (Sig name)
_ = Bool
False
isSpecLSig :: LSig name -> Bool
isSpecLSig :: forall name. LSig name -> Bool
isSpecLSig (L SrcSpan
_(SpecSig {})) = Bool
True
isSpecLSig GenLocated SrcSpan (Sig name)
_ = Bool
False
isSpecInstLSig :: LSig name -> Bool
isSpecInstLSig :: forall name. LSig name -> Bool
isSpecInstLSig (L SrcSpan
_ (SpecInstSig {})) = Bool
True
isSpecInstLSig GenLocated SrcSpan (Sig name)
_ = Bool
False
isPragLSig :: LSig name -> Bool
isPragLSig :: forall name. LSig name -> Bool
isPragLSig (L SrcSpan
_ (SpecSig {})) = Bool
True
isPragLSig (L SrcSpan
_ (InlineSig {})) = Bool
True
isPragLSig (L SrcSpan
_ (SCCFunSig {})) = Bool
True
isPragLSig (L SrcSpan
_ (CompleteMatchSig {})) = Bool
True
isPragLSig GenLocated SrcSpan (Sig name)
_ = Bool
False
isInlineLSig :: LSig name -> Bool
isInlineLSig :: forall name. LSig name -> Bool
isInlineLSig (L SrcSpan
_ (InlineSig {})) = Bool
True
isInlineLSig GenLocated SrcSpan (Sig name)
_ = Bool
False
isMinimalLSig :: LSig name -> Bool
isMinimalLSig :: forall name. LSig name -> Bool
isMinimalLSig (L SrcSpan
_ (MinimalSig {})) = Bool
True
isMinimalLSig GenLocated SrcSpan (Sig name)
_ = Bool
False
isSCCFunSig :: LSig name -> Bool
isSCCFunSig :: forall name. LSig name -> Bool
isSCCFunSig (L SrcSpan
_ (SCCFunSig {})) = Bool
True
isSCCFunSig GenLocated SrcSpan (Sig name)
_ = Bool
False
isCompleteMatchSig :: LSig name -> Bool
isCompleteMatchSig :: forall name. LSig name -> Bool
isCompleteMatchSig (L SrcSpan
_ (CompleteMatchSig {} )) = Bool
True
isCompleteMatchSig GenLocated SrcSpan (Sig name)
_ = Bool
False
hsSigDoc :: Sig name -> SDoc
hsSigDoc :: forall name. Sig name -> SDoc
hsSigDoc (TypeSig {}) = String -> SDoc
text String
"type signature"
hsSigDoc (PatSynSig {}) = String -> SDoc
text String
"pattern synonym signature"
hsSigDoc (ClassOpSig XClassOpSig name
_ Bool
is_deflt [Located (IdP name)]
_ LHsSigType name
_)
| Bool
is_deflt = String -> SDoc
text String
"default type signature"
| Bool
otherwise = String -> SDoc
text String
"class method signature"
hsSigDoc (IdSig {}) = String -> SDoc
text String
"id signature"
hsSigDoc (SpecSig XSpecSig name
_ Located (IdP name)
_ [LHsSigType name]
_ InlinePragma
inl)
= InlinePragma -> SDoc
forall a. Outputable a => a -> SDoc
ppr InlinePragma
inl SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"pragma"
hsSigDoc (InlineSig XInlineSig name
_ Located (IdP name)
_ InlinePragma
prag) = InlineSpec -> SDoc
forall a. Outputable a => a -> SDoc
ppr (InlinePragma -> InlineSpec
inlinePragmaSpec InlinePragma
prag) SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"pragma"
hsSigDoc (SpecInstSig XSpecInstSig name
_ SourceText
src LHsSigType name
_)
= SourceText -> SDoc -> SDoc
pprWithSourceText SourceText
src SDoc
empty SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"instance pragma"
hsSigDoc (FixSig {}) = String -> SDoc
text String
"fixity declaration"
hsSigDoc (MinimalSig {}) = String -> SDoc
text String
"MINIMAL pragma"
hsSigDoc (SCCFunSig {}) = String -> SDoc
text String
"SCC pragma"
hsSigDoc (CompleteMatchSig {}) = String -> SDoc
text String
"COMPLETE pragma"
hsSigDoc (XSig {}) = String -> SDoc
text String
"XSIG TTG extension"
instance OutputableBndrId p => Outputable (Sig (GhcPass p)) where
ppr :: Sig (GhcPass p) -> SDoc
ppr Sig (GhcPass p)
sig = Sig (GhcPass p) -> SDoc
forall (p :: Pass). OutputableBndrId p => Sig (GhcPass p) -> SDoc
ppr_sig Sig (GhcPass p)
sig
ppr_sig :: (OutputableBndrId p) => Sig (GhcPass p) -> SDoc
ppr_sig :: forall (p :: Pass). OutputableBndrId p => Sig (GhcPass p) -> SDoc
ppr_sig (TypeSig XTypeSig (GhcPass p)
_ [Located (IdP (GhcPass p))]
vars LHsSigWcType (GhcPass p)
ty) = [IdGhcP p] -> SDoc -> SDoc
forall id. OutputableBndr id => [id] -> SDoc -> SDoc
pprVarSig ((Located (IdGhcP p) -> IdGhcP p)
-> [Located (IdGhcP p)] -> [IdGhcP p]
forall a b. (a -> b) -> [a] -> [b]
map Located (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc [Located (IdGhcP p)]
[Located (IdP (GhcPass p))]
vars) (LHsSigWcType (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigWcType (GhcPass p)
ty)
ppr_sig (ClassOpSig XClassOpSig (GhcPass p)
_ Bool
is_deflt [Located (IdP (GhcPass p))]
vars LHsSigType (GhcPass p)
ty)
| Bool
is_deflt = String -> SDoc
text String
"default" SDoc -> SDoc -> SDoc
<+> [IdGhcP p] -> SDoc -> SDoc
forall id. OutputableBndr id => [id] -> SDoc -> SDoc
pprVarSig ((Located (IdGhcP p) -> IdGhcP p)
-> [Located (IdGhcP p)] -> [IdGhcP p]
forall a b. (a -> b) -> [a] -> [b]
map Located (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc [Located (IdGhcP p)]
[Located (IdP (GhcPass p))]
vars) (LHsSigType (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigType (GhcPass p)
ty)
| Bool
otherwise = [IdGhcP p] -> SDoc -> SDoc
forall id. OutputableBndr id => [id] -> SDoc -> SDoc
pprVarSig ((Located (IdGhcP p) -> IdGhcP p)
-> [Located (IdGhcP p)] -> [IdGhcP p]
forall a b. (a -> b) -> [a] -> [b]
map Located (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc [Located (IdGhcP p)]
[Located (IdP (GhcPass p))]
vars) (LHsSigType (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigType (GhcPass p)
ty)
ppr_sig (IdSig XIdSig (GhcPass p)
_ Id
id) = [Id] -> SDoc -> SDoc
forall id. OutputableBndr id => [id] -> SDoc -> SDoc
pprVarSig [Id
id] (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Id -> Type
varType Id
id))
ppr_sig (FixSig XFixSig (GhcPass p)
_ FixitySig (GhcPass p)
fix_sig) = FixitySig (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr FixitySig (GhcPass p)
fix_sig
ppr_sig (SpecSig XSpecSig (GhcPass p)
_ Located (IdP (GhcPass p))
var [LHsSigType (GhcPass p)]
ty inl :: InlinePragma
inl@(InlinePragma { inl_inline :: InlinePragma -> InlineSpec
inl_inline = InlineSpec
spec }))
= SourceText -> String -> SDoc -> SDoc
pragSrcBrackets (InlinePragma -> SourceText
inl_src InlinePragma
inl) String
pragmaSrc (IdGhcP p -> SDoc -> InlinePragma -> SDoc
forall id. OutputableBndr id => id -> SDoc -> InlinePragma -> SDoc
pprSpec (Located (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc Located (IdGhcP p)
Located (IdP (GhcPass p))
var)
([LHsSigType (GhcPass p)] -> SDoc
forall a. Outputable a => [a] -> SDoc
interpp'SP [LHsSigType (GhcPass p)]
ty) InlinePragma
inl)
where
pragmaSrc :: String
pragmaSrc = case InlineSpec
spec of
InlineSpec
NoUserInline -> String
"{-# SPECIALISE"
InlineSpec
_ -> String
"{-# SPECIALISE_INLINE"
ppr_sig (InlineSig XInlineSig (GhcPass p)
_ Located (IdP (GhcPass p))
var InlinePragma
inl)
= SourceText -> String -> SDoc -> SDoc
pragSrcBrackets (InlinePragma -> SourceText
inl_src InlinePragma
inl) String
"{-# INLINE" (InlinePragma -> SDoc
pprInline InlinePragma
inl
SDoc -> SDoc -> SDoc
<+> IdGhcP p -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc (Located (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc Located (IdGhcP p)
Located (IdP (GhcPass p))
var))
ppr_sig (SpecInstSig XSpecInstSig (GhcPass p)
_ SourceText
src LHsSigType (GhcPass p)
ty)
= SourceText -> String -> SDoc -> SDoc
pragSrcBrackets SourceText
src String
"{-# pragma" (String -> SDoc
text String
"instance" SDoc -> SDoc -> SDoc
<+> LHsSigType (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigType (GhcPass p)
ty)
ppr_sig (MinimalSig XMinimalSig (GhcPass p)
_ SourceText
src LBooleanFormula (Located (IdP (GhcPass p)))
bf)
= SourceText -> String -> SDoc -> SDoc
pragSrcBrackets SourceText
src String
"{-# MINIMAL" (LBooleanFormula (Located (IdGhcP p)) -> SDoc
forall name.
OutputableBndr name =>
LBooleanFormula (Located name) -> SDoc
pprMinimalSig LBooleanFormula (Located (IdGhcP p))
LBooleanFormula (Located (IdP (GhcPass p)))
bf)
ppr_sig (PatSynSig XPatSynSig (GhcPass p)
_ [Located (IdP (GhcPass p))]
names LHsSigType (GhcPass p)
sig_ty)
= String -> SDoc
text String
"pattern" SDoc -> SDoc -> SDoc
<+> [IdGhcP p] -> SDoc -> SDoc
forall id. OutputableBndr id => [id] -> SDoc -> SDoc
pprVarSig ((Located (IdGhcP p) -> IdGhcP p)
-> [Located (IdGhcP p)] -> [IdGhcP p]
forall a b. (a -> b) -> [a] -> [b]
map Located (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc [Located (IdGhcP p)]
[Located (IdP (GhcPass p))]
names) (LHsSigType (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigType (GhcPass p)
sig_ty)
ppr_sig (SCCFunSig XSCCFunSig (GhcPass p)
_ SourceText
src Located (IdP (GhcPass p))
fn Maybe (Located StringLiteral)
mlabel)
= SourceText -> String -> SDoc -> SDoc
pragSrcBrackets SourceText
src String
"{-# SCC" (Located (IdGhcP p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (IdGhcP p)
Located (IdP (GhcPass p))
fn SDoc -> SDoc -> SDoc
<+> SDoc
-> (Located StringLiteral -> SDoc)
-> Maybe (Located StringLiteral)
-> SDoc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe SDoc
empty Located StringLiteral -> SDoc
forall a. Outputable a => a -> SDoc
ppr Maybe (Located StringLiteral)
mlabel )
ppr_sig (CompleteMatchSig XCompleteMatchSig (GhcPass p)
_ SourceText
src Located [Located (IdP (GhcPass p))]
cs Maybe (Located (IdP (GhcPass p)))
mty)
= SourceText -> String -> SDoc -> SDoc
pragSrcBrackets SourceText
src String
"{-# COMPLETE"
(([SDoc] -> SDoc
hsep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((Located (IdGhcP p) -> SDoc) -> [Located (IdGhcP p)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map Located (IdGhcP p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (GenLocated SrcSpan [Located (IdGhcP p)] -> [Located (IdGhcP p)]
forall l e. GenLocated l e -> e
unLoc GenLocated SrcSpan [Located (IdGhcP p)]
Located [Located (IdP (GhcPass p))]
cs))))
SDoc -> SDoc -> SDoc
<+> SDoc
opt_sig)
where
opt_sig :: SDoc
opt_sig = SDoc
-> (Located (IdGhcP p) -> SDoc)
-> Maybe (Located (IdGhcP p))
-> SDoc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe SDoc
empty ((\IdGhcP p
t -> SDoc
dcolon SDoc -> SDoc -> SDoc
<+> IdGhcP p -> SDoc
forall a. Outputable a => a -> SDoc
ppr IdGhcP p
t) (IdGhcP p -> SDoc)
-> (Located (IdGhcP p) -> IdGhcP p) -> Located (IdGhcP p) -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Located (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc) Maybe (Located (IdGhcP p))
Maybe (Located (IdP (GhcPass p)))
mty
instance OutputableBndrId p
=> Outputable (FixitySig (GhcPass p)) where
ppr :: FixitySig (GhcPass p) -> SDoc
ppr (FixitySig XFixitySig (GhcPass p)
_ [Located (IdP (GhcPass p))]
names Fixity
fixity) = [SDoc] -> SDoc
sep [Fixity -> SDoc
forall a. Outputable a => a -> SDoc
ppr Fixity
fixity, SDoc
pprops]
where
pprops :: SDoc
pprops = [SDoc] -> SDoc
hsep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((GenLocated SrcSpan (IdGhcP p) -> SDoc)
-> [GenLocated SrcSpan (IdGhcP p)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (IdGhcP p -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprInfixOcc (IdGhcP p -> SDoc)
-> (GenLocated SrcSpan (IdGhcP p) -> IdGhcP p)
-> GenLocated SrcSpan (IdGhcP p)
-> SDoc
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)
pragBrackets :: SDoc -> SDoc
pragBrackets :: SDoc -> SDoc
pragBrackets SDoc
doc = String -> SDoc
text String
"{-#" SDoc -> SDoc -> SDoc
<+> SDoc
doc SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"#-}"
pragSrcBrackets :: SourceText -> String -> SDoc -> SDoc
pragSrcBrackets :: SourceText -> String -> SDoc -> SDoc
pragSrcBrackets (SourceText String
src) String
_ SDoc
doc = String -> SDoc
text String
src SDoc -> SDoc -> SDoc
<+> SDoc
doc SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"#-}"
pragSrcBrackets SourceText
NoSourceText String
alt SDoc
doc = String -> SDoc
text String
alt SDoc -> SDoc -> SDoc
<+> SDoc
doc SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"#-}"
pprVarSig :: (OutputableBndr id) => [id] -> SDoc -> SDoc
pprVarSig :: forall id. OutputableBndr id => [id] -> SDoc -> SDoc
pprVarSig [id]
vars SDoc
pp_ty = [SDoc] -> SDoc
sep [SDoc
pprvars SDoc -> SDoc -> SDoc
<+> SDoc
dcolon, Int -> SDoc -> SDoc
nest Int
2 SDoc
pp_ty]
where
pprvars :: SDoc
pprvars = [SDoc] -> SDoc
hsep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((id -> SDoc) -> [id] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map id -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc [id]
vars)
pprSpec :: (OutputableBndr id) => id -> SDoc -> InlinePragma -> SDoc
pprSpec :: forall id. OutputableBndr id => id -> SDoc -> InlinePragma -> SDoc
pprSpec id
var SDoc
pp_ty InlinePragma
inl = SDoc
pp_inl SDoc -> SDoc -> SDoc
<+> [id] -> SDoc -> SDoc
forall id. OutputableBndr id => [id] -> SDoc -> SDoc
pprVarSig [id
var] SDoc
pp_ty
where
pp_inl :: SDoc
pp_inl | InlinePragma -> Bool
isDefaultInlinePragma InlinePragma
inl = SDoc
empty
| Bool
otherwise = InlinePragma -> SDoc
pprInline InlinePragma
inl
pprTcSpecPrags :: TcSpecPrags -> SDoc
pprTcSpecPrags :: TcSpecPrags -> SDoc
pprTcSpecPrags TcSpecPrags
IsDefaultMethod = String -> SDoc
text String
"<default method>"
pprTcSpecPrags (SpecPrags [LTcSpecPrag]
ps) = [SDoc] -> SDoc
vcat ((LTcSpecPrag -> SDoc) -> [LTcSpecPrag] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (TcSpecPrag -> SDoc
forall a. Outputable a => a -> SDoc
ppr (TcSpecPrag -> SDoc)
-> (LTcSpecPrag -> TcSpecPrag) -> LTcSpecPrag -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LTcSpecPrag -> TcSpecPrag
forall l e. GenLocated l e -> e
unLoc) [LTcSpecPrag]
ps)
instance Outputable TcSpecPrag where
ppr :: TcSpecPrag -> SDoc
ppr (SpecPrag Id
var HsWrapper
_ InlinePragma
inl)
= String -> SDoc
text String
"SPECIALIZE" SDoc -> SDoc -> SDoc
<+> Id -> SDoc -> InlinePragma -> SDoc
forall id. OutputableBndr id => id -> SDoc -> InlinePragma -> SDoc
pprSpec Id
var (String -> SDoc
text String
"<type>") InlinePragma
inl
pprMinimalSig :: (OutputableBndr name)
=> LBooleanFormula (Located name) -> SDoc
pprMinimalSig :: forall name.
OutputableBndr name =>
LBooleanFormula (Located name) -> SDoc
pprMinimalSig (L SrcSpan
_ BooleanFormula (Located name)
bf) = BooleanFormula name -> SDoc
forall a. Outputable a => a -> SDoc
ppr ((Located name -> name)
-> BooleanFormula (Located name) -> BooleanFormula name
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Located name -> name
forall l e. GenLocated l e -> e
unLoc BooleanFormula (Located name)
bf)
type HsPatSynDetails arg = HsConDetails arg [RecordPatSynField arg]
data RecordPatSynField a
= RecordPatSynField {
forall a. RecordPatSynField a -> a
recordPatSynSelectorId :: a
, forall a. RecordPatSynField a -> a
recordPatSynPatVar :: a
} deriving (Typeable (RecordPatSynField a)
Typeable (RecordPatSynField a)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordPatSynField a
-> c (RecordPatSynField a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordPatSynField a))
-> (RecordPatSynField a -> Constr)
-> (RecordPatSynField a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (RecordPatSynField a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RecordPatSynField a)))
-> ((forall b. Data b => b -> b)
-> RecordPatSynField a -> RecordPatSynField a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r)
-> (forall u.
(forall d. Data d => d -> u) -> RecordPatSynField a -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> RecordPatSynField a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a))
-> Data (RecordPatSynField a)
RecordPatSynField a -> DataType
RecordPatSynField a -> Constr
(forall b. Data b => b -> b)
-> RecordPatSynField a -> RecordPatSynField a
forall {a}. Data a => Typeable (RecordPatSynField a)
forall a. Data a => RecordPatSynField a -> DataType
forall a. Data a => RecordPatSynField a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b)
-> RecordPatSynField a -> RecordPatSynField a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> RecordPatSynField a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> RecordPatSynField a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordPatSynField a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordPatSynField a
-> c (RecordPatSynField a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (RecordPatSynField a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RecordPatSynField a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> RecordPatSynField a -> u
forall u.
(forall d. Data d => d -> u) -> RecordPatSynField a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordPatSynField a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordPatSynField a
-> c (RecordPatSynField a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (RecordPatSynField a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RecordPatSynField a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> RecordPatSynField a -> m (RecordPatSynField a)
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> RecordPatSynField a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> RecordPatSynField a -> u
gmapQ :: forall u.
(forall d. Data d => d -> u) -> RecordPatSynField a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> RecordPatSynField a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RecordPatSynField a -> r
gmapT :: (forall b. Data b => b -> b)
-> RecordPatSynField a -> RecordPatSynField a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b)
-> RecordPatSynField a -> RecordPatSynField a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RecordPatSynField a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (RecordPatSynField a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (RecordPatSynField a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (RecordPatSynField a))
dataTypeOf :: RecordPatSynField a -> DataType
$cdataTypeOf :: forall a. Data a => RecordPatSynField a -> DataType
toConstr :: RecordPatSynField a -> Constr
$ctoConstr :: forall a. Data a => RecordPatSynField a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordPatSynField a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (RecordPatSynField a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordPatSynField a
-> c (RecordPatSynField a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> RecordPatSynField a
-> c (RecordPatSynField a)
Data, (forall a b.
(a -> b) -> RecordPatSynField a -> RecordPatSynField b)
-> (forall a b. a -> RecordPatSynField b -> RecordPatSynField a)
-> Functor RecordPatSynField
forall a b. a -> RecordPatSynField b -> RecordPatSynField a
forall a b. (a -> b) -> RecordPatSynField a -> RecordPatSynField b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> RecordPatSynField b -> RecordPatSynField a
$c<$ :: forall a b. a -> RecordPatSynField b -> RecordPatSynField a
fmap :: forall a b. (a -> b) -> RecordPatSynField a -> RecordPatSynField b
$cfmap :: forall a b. (a -> b) -> RecordPatSynField a -> RecordPatSynField b
Functor)
instance Outputable a => Outputable (RecordPatSynField a) where
ppr :: RecordPatSynField a -> SDoc
ppr (RecordPatSynField { recordPatSynSelectorId :: forall a. RecordPatSynField a -> a
recordPatSynSelectorId = a
v }) = a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
v
instance Foldable RecordPatSynField where
foldMap :: forall m a. Monoid m => (a -> m) -> RecordPatSynField a -> m
foldMap a -> m
f (RecordPatSynField { recordPatSynSelectorId :: forall a. RecordPatSynField a -> a
recordPatSynSelectorId = a
visible
, recordPatSynPatVar :: forall a. RecordPatSynField a -> a
recordPatSynPatVar = a
hidden })
= a -> m
f a
visible m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` a -> m
f a
hidden
instance Traversable RecordPatSynField where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> RecordPatSynField a -> f (RecordPatSynField b)
traverse a -> f b
f (RecordPatSynField { recordPatSynSelectorId :: forall a. RecordPatSynField a -> a
recordPatSynSelectorId =a
visible
, recordPatSynPatVar :: forall a. RecordPatSynField a -> a
recordPatSynPatVar = a
hidden })
= (\ b
sel_id b
pat_var -> RecordPatSynField :: forall a. a -> a -> RecordPatSynField a
RecordPatSynField { recordPatSynSelectorId :: b
recordPatSynSelectorId = b
sel_id
, recordPatSynPatVar :: b
recordPatSynPatVar = b
pat_var })
(b -> b -> RecordPatSynField b)
-> f b -> f (b -> RecordPatSynField b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
visible f (b -> RecordPatSynField b) -> f b -> f (RecordPatSynField b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
hidden
data HsPatSynDir id
= Unidirectional
| ImplicitBidirectional
| ExplicitBidirectional (MatchGroup id (LHsExpr id))