{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE TypeFamilies #-}
module HsTypes (
HsType(..), NewHsTypeX(..), LHsType, HsKind, LHsKind,
HsTyVarBndr(..), LHsTyVarBndr,
LHsQTyVars(..), HsQTvsRn(..),
HsImplicitBndrs(..),
HsWildCardBndrs(..),
LHsSigType, LHsSigWcType, LHsWcType,
HsTupleSort(..),
HsContext, LHsContext, noLHsContext,
HsTyLit(..),
HsIPName(..), hsIPNameFS,
HsArg(..), numVisibleArgs,
LHsTypeArg,
LBangType, BangType,
HsSrcBang(..), HsImplBang(..),
SrcStrictness(..), SrcUnpackedness(..),
getBangType, getBangStrictness,
ConDeclField(..), LConDeclField, pprConDeclFields,
HsConDetails(..),
FieldOcc(..), LFieldOcc, mkFieldOcc,
AmbiguousFieldOcc(..), mkAmbiguousFieldOcc,
rdrNameAmbiguousFieldOcc, selectorAmbiguousFieldOcc,
unambiguousFieldOcc, ambiguousFieldOcc,
mkAnonWildCardTy, pprAnonWildCard,
mkHsImplicitBndrs, mkHsWildCardBndrs, hsImplicitBody,
mkEmptyImplicitBndrs, mkEmptyWildCardBndrs,
mkHsQTvs, hsQTvExplicit, emptyLHsQTvs, isEmptyLHsQTvs,
isHsKindedTyVar, hsTvbAllKinded, isLHsForAllTy,
hsScopedTvs, hsWcScopedTvs, dropWildCards,
hsTyVarName, hsAllLTyVarNames, hsLTyVarLocNames,
hsLTyVarName, hsLTyVarLocName, hsExplicitLTyVarNames,
splitLHsInstDeclTy, getLHsInstDeclHead, getLHsInstDeclClass_maybe,
splitLHsPatSynTy,
splitLHsForAllTy, splitLHsQualTy, splitLHsSigmaTy,
splitHsFunType,
splitHsAppTys, hsTyGetAppHead_maybe,
mkHsOpTy, mkHsAppTy, mkHsAppTys, mkHsAppKindTy,
ignoreParens, hsSigType, hsSigWcType,
hsLTyVarBndrToType, hsLTyVarBndrsToTypes,
pprHsType, pprHsForAll, pprHsForAllExtra, pprHsExplicitForAll,
pprLHsContext,
hsTypeNeedsParens, parenthesizeHsType, parenthesizeHsContext
) where
import GhcPrelude
import {-# SOURCE #-} HsExpr ( HsSplice, pprSplice )
import HsExtension
import HsLit ()
import Id ( Id )
import Name( Name )
import RdrName ( RdrName )
import NameSet ( NameSet, emptyNameSet )
import DataCon( HsSrcBang(..), HsImplBang(..),
SrcStrictness(..), SrcUnpackedness(..) )
import TysPrim( funTyConName )
import Type
import HsDoc
import BasicTypes
import SrcLoc
import Outputable
import FastString
import Maybes( isJust )
import Util ( count )
import Data.Data hiding ( Fixity, Prefix, Infix )
type LBangType pass = Located (BangType pass)
type BangType pass = HsType pass
getBangType :: LHsType a -> LHsType a
getBangType :: LHsType a -> LHsType a
getBangType (L _ (HsBangTy _ _ ty :: LHsType a
ty)) = LHsType a
ty
getBangType ty :: LHsType a
ty = LHsType a
ty
getBangStrictness :: LHsType a -> HsSrcBang
getBangStrictness :: LHsType a -> HsSrcBang
getBangStrictness (L _ (HsBangTy _ s :: HsSrcBang
s _)) = HsSrcBang
s
getBangStrictness _ = (SourceText -> SrcUnpackedness -> SrcStrictness -> HsSrcBang
HsSrcBang SourceText
NoSourceText SrcUnpackedness
NoSrcUnpack SrcStrictness
NoSrcStrict)
type LHsContext pass = Located (HsContext pass)
noLHsContext :: LHsContext pass
noLHsContext :: LHsContext pass
noLHsContext = SrcSpanLess (LHsContext pass) -> LHsContext pass
forall a. HasSrcSpan a => SrcSpanLess a -> a
noLoc []
type HsContext pass = [LHsType pass]
type LHsType pass = Located (HsType pass)
type HsKind pass = HsType pass
type LHsKind pass = Located (HsKind pass)
type LHsTyVarBndr pass = Located (HsTyVarBndr pass)
data LHsQTyVars pass
= HsQTvs { LHsQTyVars pass -> XHsQTvs pass
hsq_ext :: XHsQTvs pass
, LHsQTyVars pass -> [LHsTyVarBndr pass]
hsq_explicit :: [LHsTyVarBndr pass]
}
| XLHsQTyVars (XXLHsQTyVars pass)
data HsQTvsRn
= HsQTvsRn
{ HsQTvsRn -> [Name]
hsq_implicit :: [Name]
, HsQTvsRn -> NameSet
hsq_dependent :: NameSet
} deriving Typeable HsQTvsRn
DataType
Constr
Typeable HsQTvsRn =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsQTvsRn -> c HsQTvsRn)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsQTvsRn)
-> (HsQTvsRn -> Constr)
-> (HsQTvsRn -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsQTvsRn))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsQTvsRn))
-> ((forall b. Data b => b -> b) -> HsQTvsRn -> HsQTvsRn)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsQTvsRn -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsQTvsRn -> r)
-> (forall u. (forall d. Data d => d -> u) -> HsQTvsRn -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> HsQTvsRn -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn)
-> Data HsQTvsRn
HsQTvsRn -> DataType
HsQTvsRn -> Constr
(forall b. Data b => b -> b) -> HsQTvsRn -> HsQTvsRn
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsQTvsRn -> c HsQTvsRn
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsQTvsRn
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) -> HsQTvsRn -> u
forall u. (forall d. Data d => d -> u) -> HsQTvsRn -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsQTvsRn -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsQTvsRn -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsQTvsRn
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsQTvsRn -> c HsQTvsRn
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsQTvsRn)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsQTvsRn)
$cHsQTvsRn :: Constr
$tHsQTvsRn :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn
gmapMp :: (forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn
gmapM :: (forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsQTvsRn -> m HsQTvsRn
gmapQi :: Int -> (forall d. Data d => d -> u) -> HsQTvsRn -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HsQTvsRn -> u
gmapQ :: (forall d. Data d => d -> u) -> HsQTvsRn -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> HsQTvsRn -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsQTvsRn -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsQTvsRn -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsQTvsRn -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsQTvsRn -> r
gmapT :: (forall b. Data b => b -> b) -> HsQTvsRn -> HsQTvsRn
$cgmapT :: (forall b. Data b => b -> b) -> HsQTvsRn -> HsQTvsRn
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsQTvsRn)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsQTvsRn)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c HsQTvsRn)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsQTvsRn)
dataTypeOf :: HsQTvsRn -> DataType
$cdataTypeOf :: HsQTvsRn -> DataType
toConstr :: HsQTvsRn -> Constr
$ctoConstr :: HsQTvsRn -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsQTvsRn
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsQTvsRn
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsQTvsRn -> c HsQTvsRn
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsQTvsRn -> c HsQTvsRn
$cp1Data :: Typeable HsQTvsRn
Data
type instance XHsQTvs GhcPs = NoExt
type instance XHsQTvs GhcRn = HsQTvsRn
type instance XHsQTvs GhcTc = HsQTvsRn
type instance XXLHsQTyVars (GhcPass _) = NoExt
mkHsQTvs :: [LHsTyVarBndr GhcPs] -> LHsQTyVars GhcPs
mkHsQTvs :: [LHsTyVarBndr GhcPs] -> LHsQTyVars GhcPs
mkHsQTvs tvs :: [LHsTyVarBndr GhcPs]
tvs = HsQTvs :: forall pass. XHsQTvs pass -> [LHsTyVarBndr pass] -> LHsQTyVars pass
HsQTvs { hsq_ext :: XHsQTvs GhcPs
hsq_ext = XHsQTvs GhcPs
NoExt
noExt, hsq_explicit :: [LHsTyVarBndr GhcPs]
hsq_explicit = [LHsTyVarBndr GhcPs]
tvs }
hsQTvExplicit :: LHsQTyVars pass -> [LHsTyVarBndr pass]
hsQTvExplicit :: LHsQTyVars pass -> [LHsTyVarBndr pass]
hsQTvExplicit = LHsQTyVars pass -> [LHsTyVarBndr pass]
forall pass. LHsQTyVars pass -> [LHsTyVarBndr pass]
hsq_explicit
emptyLHsQTvs :: LHsQTyVars GhcRn
emptyLHsQTvs :: LHsQTyVars GhcRn
emptyLHsQTvs = XHsQTvs GhcRn -> [LHsTyVarBndr GhcRn] -> LHsQTyVars GhcRn
forall pass. XHsQTvs pass -> [LHsTyVarBndr pass] -> LHsQTyVars pass
HsQTvs ([Name] -> NameSet -> HsQTvsRn
HsQTvsRn [] NameSet
emptyNameSet) []
isEmptyLHsQTvs :: LHsQTyVars GhcRn -> Bool
isEmptyLHsQTvs :: LHsQTyVars GhcRn -> Bool
isEmptyLHsQTvs (HsQTvs (HsQTvsRn [] _) []) = Bool
True
isEmptyLHsQTvs _ = Bool
False
data HsImplicitBndrs pass thing
= HsIB { HsImplicitBndrs pass thing -> XHsIB pass thing
hsib_ext :: XHsIB pass thing
, HsImplicitBndrs pass thing -> thing
hsib_body :: thing
}
| XHsImplicitBndrs (XXHsImplicitBndrs pass thing)
type instance XHsIB GhcPs _ = NoExt
type instance XHsIB GhcRn _ = [Name]
type instance XHsIB GhcTc _ = [Name]
type instance XXHsImplicitBndrs (GhcPass _) _ = NoExt
data HsWildCardBndrs pass thing
= HsWC { HsWildCardBndrs pass thing -> XHsWC pass thing
hswc_ext :: XHsWC pass thing
, HsWildCardBndrs pass thing -> thing
hswc_body :: thing
}
| XHsWildCardBndrs (XXHsWildCardBndrs pass thing)
type instance XHsWC GhcPs b = NoExt
type instance XHsWC GhcRn b = [Name]
type instance XHsWC GhcTc b = [Name]
type instance XXHsWildCardBndrs (GhcPass _) b = NoExt
type LHsSigType pass = HsImplicitBndrs pass (LHsType pass)
type LHsWcType pass = HsWildCardBndrs pass (LHsType pass)
type LHsSigWcType pass = HsWildCardBndrs pass (LHsSigType pass)
hsImplicitBody :: HsImplicitBndrs pass thing -> thing
hsImplicitBody :: HsImplicitBndrs pass thing -> thing
hsImplicitBody (HsIB { hsib_body :: forall pass thing. HsImplicitBndrs pass thing -> thing
hsib_body = thing
body }) = thing
body
hsImplicitBody (XHsImplicitBndrs _) = String -> thing
forall a. String -> a
panic "hsImplicitBody"
hsSigType :: LHsSigType pass -> LHsType pass
hsSigType :: LHsSigType pass -> LHsType pass
hsSigType = LHsSigType pass -> LHsType pass
forall pass thing. HsImplicitBndrs pass thing -> thing
hsImplicitBody
hsSigWcType :: LHsSigWcType pass -> LHsType pass
hsSigWcType :: LHsSigWcType pass -> LHsType pass
hsSigWcType sig_ty :: LHsSigWcType pass
sig_ty = HsImplicitBndrs pass (LHsType pass) -> LHsType pass
forall pass thing. HsImplicitBndrs pass thing -> thing
hsib_body (LHsSigWcType pass -> HsImplicitBndrs pass (LHsType pass)
forall pass thing. HsWildCardBndrs pass thing -> thing
hswc_body LHsSigWcType pass
sig_ty)
dropWildCards :: LHsSigWcType pass -> LHsSigType pass
dropWildCards :: LHsSigWcType pass -> LHsSigType pass
dropWildCards sig_ty :: LHsSigWcType pass
sig_ty = LHsSigWcType pass -> LHsSigType pass
forall pass thing. HsWildCardBndrs pass thing -> thing
hswc_body LHsSigWcType pass
sig_ty
mkHsImplicitBndrs :: thing -> HsImplicitBndrs GhcPs thing
mkHsImplicitBndrs :: thing -> HsImplicitBndrs GhcPs thing
mkHsImplicitBndrs x :: thing
x = HsIB :: forall pass thing.
XHsIB pass thing -> thing -> HsImplicitBndrs pass thing
HsIB { hsib_ext :: XHsIB GhcPs thing
hsib_ext = XHsIB GhcPs thing
NoExt
noExt
, hsib_body :: thing
hsib_body = thing
x }
mkHsWildCardBndrs :: thing -> HsWildCardBndrs GhcPs thing
mkHsWildCardBndrs :: thing -> HsWildCardBndrs GhcPs thing
mkHsWildCardBndrs x :: thing
x = HsWC :: forall pass thing.
XHsWC pass thing -> thing -> HsWildCardBndrs pass thing
HsWC { hswc_body :: thing
hswc_body = thing
x
, hswc_ext :: XHsWC GhcPs thing
hswc_ext = XHsWC GhcPs thing
NoExt
noExt }
mkEmptyImplicitBndrs :: thing -> HsImplicitBndrs GhcRn thing
mkEmptyImplicitBndrs :: thing -> HsImplicitBndrs GhcRn thing
mkEmptyImplicitBndrs x :: thing
x = HsIB :: forall pass thing.
XHsIB pass thing -> thing -> HsImplicitBndrs pass thing
HsIB { hsib_ext :: XHsIB GhcRn thing
hsib_ext = []
, hsib_body :: thing
hsib_body = thing
x }
mkEmptyWildCardBndrs :: thing -> HsWildCardBndrs GhcRn thing
mkEmptyWildCardBndrs :: thing -> HsWildCardBndrs GhcRn thing
mkEmptyWildCardBndrs x :: thing
x = HsWC :: forall pass thing.
XHsWC pass thing -> thing -> HsWildCardBndrs pass thing
HsWC { hswc_body :: thing
hswc_body = thing
x
, hswc_ext :: XHsWC GhcRn thing
hswc_ext = [] }
newtype HsIPName = HsIPName FastString
deriving( HsIPName -> HsIPName -> Bool
(HsIPName -> HsIPName -> Bool)
-> (HsIPName -> HsIPName -> Bool) -> Eq HsIPName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HsIPName -> HsIPName -> Bool
$c/= :: HsIPName -> HsIPName -> Bool
== :: HsIPName -> HsIPName -> Bool
$c== :: HsIPName -> HsIPName -> Bool
Eq, Typeable HsIPName
DataType
Constr
Typeable HsIPName =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsIPName -> c HsIPName)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsIPName)
-> (HsIPName -> Constr)
-> (HsIPName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsIPName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsIPName))
-> ((forall b. Data b => b -> b) -> HsIPName -> HsIPName)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsIPName -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsIPName -> r)
-> (forall u. (forall d. Data d => d -> u) -> HsIPName -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> HsIPName -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsIPName -> m HsIPName)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsIPName -> m HsIPName)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsIPName -> m HsIPName)
-> Data HsIPName
HsIPName -> DataType
HsIPName -> Constr
(forall b. Data b => b -> b) -> HsIPName -> HsIPName
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsIPName -> c HsIPName
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsIPName
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) -> HsIPName -> u
forall u. (forall d. Data d => d -> u) -> HsIPName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsIPName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsIPName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsIPName -> m HsIPName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsIPName -> m HsIPName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsIPName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsIPName -> c HsIPName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsIPName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsIPName)
$cHsIPName :: Constr
$tHsIPName :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> HsIPName -> m HsIPName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsIPName -> m HsIPName
gmapMp :: (forall d. Data d => d -> m d) -> HsIPName -> m HsIPName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsIPName -> m HsIPName
gmapM :: (forall d. Data d => d -> m d) -> HsIPName -> m HsIPName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsIPName -> m HsIPName
gmapQi :: Int -> (forall d. Data d => d -> u) -> HsIPName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HsIPName -> u
gmapQ :: (forall d. Data d => d -> u) -> HsIPName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> HsIPName -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsIPName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsIPName -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsIPName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsIPName -> r
gmapT :: (forall b. Data b => b -> b) -> HsIPName -> HsIPName
$cgmapT :: (forall b. Data b => b -> b) -> HsIPName -> HsIPName
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsIPName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsIPName)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c HsIPName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsIPName)
dataTypeOf :: HsIPName -> DataType
$cdataTypeOf :: HsIPName -> DataType
toConstr :: HsIPName -> Constr
$ctoConstr :: HsIPName -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsIPName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsIPName
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsIPName -> c HsIPName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsIPName -> c HsIPName
$cp1Data :: Typeable HsIPName
Data )
hsIPNameFS :: HsIPName -> FastString
hsIPNameFS :: HsIPName -> FastString
hsIPNameFS (HsIPName n :: FastString
n) = FastString
n
instance Outputable HsIPName where
ppr :: HsIPName -> SDoc
ppr (HsIPName n :: FastString
n) = Char -> SDoc
char '?' SDoc -> SDoc -> SDoc
<> FastString -> SDoc
ftext FastString
n
instance OutputableBndr HsIPName where
pprBndr :: BindingSite -> HsIPName -> SDoc
pprBndr _ n :: HsIPName
n = HsIPName -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsIPName
n
pprInfixOcc :: HsIPName -> SDoc
pprInfixOcc n :: HsIPName
n = HsIPName -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsIPName
n
pprPrefixOcc :: HsIPName -> SDoc
pprPrefixOcc n :: HsIPName
n = HsIPName -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsIPName
n
data HsTyVarBndr pass
= UserTyVar
(XUserTyVar pass)
(Located (IdP pass))
| KindedTyVar
(XKindedTyVar pass)
(Located (IdP pass))
(LHsKind pass)
| XTyVarBndr
(XXTyVarBndr pass)
type instance XUserTyVar (GhcPass _) = NoExt
type instance XKindedTyVar (GhcPass _) = NoExt
type instance XXTyVarBndr (GhcPass _) = NoExt
isHsKindedTyVar :: HsTyVarBndr pass -> Bool
isHsKindedTyVar :: HsTyVarBndr pass -> Bool
isHsKindedTyVar (UserTyVar {}) = Bool
False
isHsKindedTyVar (KindedTyVar {}) = Bool
True
isHsKindedTyVar (XTyVarBndr{}) = String -> Bool
forall a. String -> a
panic "isHsKindedTyVar"
hsTvbAllKinded :: LHsQTyVars pass -> Bool
hsTvbAllKinded :: LHsQTyVars pass -> Bool
hsTvbAllKinded = (LHsTyVarBndr pass -> Bool) -> [LHsTyVarBndr pass] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all (HsTyVarBndr pass -> Bool
forall pass. HsTyVarBndr pass -> Bool
isHsKindedTyVar (HsTyVarBndr pass -> Bool)
-> (LHsTyVarBndr pass -> HsTyVarBndr pass)
-> LHsTyVarBndr pass
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LHsTyVarBndr pass -> HsTyVarBndr pass
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc) ([LHsTyVarBndr pass] -> Bool)
-> (LHsQTyVars pass -> [LHsTyVarBndr pass])
-> LHsQTyVars pass
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LHsQTyVars pass -> [LHsTyVarBndr pass]
forall pass. LHsQTyVars pass -> [LHsTyVarBndr pass]
hsQTvExplicit
data HsType pass
= HsForAllTy
{ HsType pass -> XForAllTy pass
hst_xforall :: XForAllTy pass,
HsType pass -> [LHsTyVarBndr pass]
hst_bndrs :: [LHsTyVarBndr pass]
, HsType pass -> LHsType pass
hst_body :: LHsType pass
}
| HsQualTy
{ HsType pass -> XQualTy pass
hst_xqual :: XQualTy pass
, HsType pass -> LHsContext pass
hst_ctxt :: LHsContext pass
, hst_body :: LHsType pass }
| HsTyVar (XTyVar pass)
PromotionFlag
(Located (IdP pass))
| HsAppTy (XAppTy pass)
(LHsType pass)
(LHsType pass)
| HsAppKindTy (XAppKindTy pass)
(LHsType pass)
(LHsKind pass)
| HsFunTy (XFunTy pass)
(LHsType pass)
(LHsType pass)
| HsListTy (XListTy pass)
(LHsType pass)
| HsTupleTy (XTupleTy pass)
HsTupleSort
[LHsType pass]
| HsSumTy (XSumTy pass)
[LHsType pass]
| HsOpTy (XOpTy pass)
(LHsType pass) (Located (IdP pass)) (LHsType pass)
| HsParTy (XParTy pass)
(LHsType pass)
| HsIParamTy (XIParamTy pass)
(Located HsIPName)
(LHsType pass)
| HsStarTy (XStarTy pass)
Bool
| HsKindSig (XKindSig pass)
(LHsType pass)
(LHsKind pass)
| HsSpliceTy (XSpliceTy pass)
(HsSplice pass)
| HsDocTy (XDocTy pass)
(LHsType pass) LHsDocString
| HsBangTy (XBangTy pass)
HsSrcBang (LHsType pass)
| HsRecTy (XRecTy pass)
[LConDeclField pass]
| HsExplicitListTy
(XExplicitListTy pass)
PromotionFlag
[LHsType pass]
| HsExplicitTupleTy
(XExplicitTupleTy pass)
[LHsType pass]
| HsTyLit (XTyLit pass) HsTyLit
| HsWildCardTy (XWildCardTy pass)
| XHsType
(XXType pass)
data NewHsTypeX
= NHsCoreTy Type
deriving Data
instance Outputable NewHsTypeX where
ppr :: NewHsTypeX -> SDoc
ppr (NHsCoreTy ty :: Type
ty) = Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty
type instance XForAllTy (GhcPass _) = NoExt
type instance XQualTy (GhcPass _) = NoExt
type instance XTyVar (GhcPass _) = NoExt
type instance XAppTy (GhcPass _) = NoExt
type instance XFunTy (GhcPass _) = NoExt
type instance XListTy (GhcPass _) = NoExt
type instance XTupleTy (GhcPass _) = NoExt
type instance XSumTy (GhcPass _) = NoExt
type instance XOpTy (GhcPass _) = NoExt
type instance XParTy (GhcPass _) = NoExt
type instance XIParamTy (GhcPass _) = NoExt
type instance XStarTy (GhcPass _) = NoExt
type instance XKindSig (GhcPass _) = NoExt
type instance XAppKindTy (GhcPass _) = SrcSpan
type instance XSpliceTy GhcPs = NoExt
type instance XSpliceTy GhcRn = NoExt
type instance XSpliceTy GhcTc = Kind
type instance XDocTy (GhcPass _) = NoExt
type instance XBangTy (GhcPass _) = NoExt
type instance XRecTy (GhcPass _) = NoExt
type instance XExplicitListTy GhcPs = NoExt
type instance XExplicitListTy GhcRn = NoExt
type instance XExplicitListTy GhcTc = Kind
type instance XExplicitTupleTy GhcPs = NoExt
type instance XExplicitTupleTy GhcRn = NoExt
type instance XExplicitTupleTy GhcTc = [Kind]
type instance XTyLit (GhcPass _) = NoExt
type instance XWildCardTy (GhcPass _) = NoExt
type instance XXType (GhcPass _) = NewHsTypeX
data HsTyLit
= HsNumTy SourceText Integer
| HsStrTy SourceText FastString
deriving Typeable HsTyLit
DataType
Constr
Typeable HsTyLit =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTyLit -> c HsTyLit)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTyLit)
-> (HsTyLit -> Constr)
-> (HsTyLit -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsTyLit))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsTyLit))
-> ((forall b. Data b => b -> b) -> HsTyLit -> HsTyLit)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsTyLit -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsTyLit -> r)
-> (forall u. (forall d. Data d => d -> u) -> HsTyLit -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> HsTyLit -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit)
-> Data HsTyLit
HsTyLit -> DataType
HsTyLit -> Constr
(forall b. Data b => b -> b) -> HsTyLit -> HsTyLit
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTyLit -> c HsTyLit
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTyLit
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) -> HsTyLit -> u
forall u. (forall d. Data d => d -> u) -> HsTyLit -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsTyLit -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsTyLit -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTyLit
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTyLit -> c HsTyLit
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsTyLit)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsTyLit)
$cHsStrTy :: Constr
$cHsNumTy :: Constr
$tHsTyLit :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit
gmapMp :: (forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit
gmapM :: (forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsTyLit -> m HsTyLit
gmapQi :: Int -> (forall d. Data d => d -> u) -> HsTyLit -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HsTyLit -> u
gmapQ :: (forall d. Data d => d -> u) -> HsTyLit -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> HsTyLit -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsTyLit -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsTyLit -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsTyLit -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsTyLit -> r
gmapT :: (forall b. Data b => b -> b) -> HsTyLit -> HsTyLit
$cgmapT :: (forall b. Data b => b -> b) -> HsTyLit -> HsTyLit
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsTyLit)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsTyLit)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c HsTyLit)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsTyLit)
dataTypeOf :: HsTyLit -> DataType
$cdataTypeOf :: HsTyLit -> DataType
toConstr :: HsTyLit -> Constr
$ctoConstr :: HsTyLit -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTyLit
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTyLit
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTyLit -> c HsTyLit
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTyLit -> c HsTyLit
$cp1Data :: Typeable HsTyLit
Data
data HsTupleSort = HsUnboxedTuple
| HsBoxedTuple
| HsConstraintTuple
| HsBoxedOrConstraintTuple
deriving Typeable HsTupleSort
DataType
Constr
Typeable HsTupleSort =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTupleSort -> c HsTupleSort)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTupleSort)
-> (HsTupleSort -> Constr)
-> (HsTupleSort -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsTupleSort))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c HsTupleSort))
-> ((forall b. Data b => b -> b) -> HsTupleSort -> HsTupleSort)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsTupleSort -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsTupleSort -> r)
-> (forall u. (forall d. Data d => d -> u) -> HsTupleSort -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> HsTupleSort -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort)
-> Data HsTupleSort
HsTupleSort -> DataType
HsTupleSort -> Constr
(forall b. Data b => b -> b) -> HsTupleSort -> HsTupleSort
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTupleSort -> c HsTupleSort
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTupleSort
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) -> HsTupleSort -> u
forall u. (forall d. Data d => d -> u) -> HsTupleSort -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsTupleSort -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsTupleSort -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTupleSort
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTupleSort -> c HsTupleSort
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsTupleSort)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c HsTupleSort)
$cHsBoxedOrConstraintTuple :: Constr
$cHsConstraintTuple :: Constr
$cHsBoxedTuple :: Constr
$cHsUnboxedTuple :: Constr
$tHsTupleSort :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort
gmapMp :: (forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort
gmapM :: (forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HsTupleSort -> m HsTupleSort
gmapQi :: Int -> (forall d. Data d => d -> u) -> HsTupleSort -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HsTupleSort -> u
gmapQ :: (forall d. Data d => d -> u) -> HsTupleSort -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> HsTupleSort -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsTupleSort -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsTupleSort -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsTupleSort -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsTupleSort -> r
gmapT :: (forall b. Data b => b -> b) -> HsTupleSort -> HsTupleSort
$cgmapT :: (forall b. Data b => b -> b) -> HsTupleSort -> HsTupleSort
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c HsTupleSort)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c HsTupleSort)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c HsTupleSort)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HsTupleSort)
dataTypeOf :: HsTupleSort -> DataType
$cdataTypeOf :: HsTupleSort -> DataType
toConstr :: HsTupleSort -> Constr
$ctoConstr :: HsTupleSort -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTupleSort
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HsTupleSort
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTupleSort -> c HsTupleSort
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HsTupleSort -> c HsTupleSort
$cp1Data :: Typeable HsTupleSort
Data
type LConDeclField pass = Located (ConDeclField pass)
data ConDeclField pass
= ConDeclField { ConDeclField pass -> XConDeclField pass
cd_fld_ext :: XConDeclField pass,
ConDeclField pass -> [LFieldOcc pass]
cd_fld_names :: [LFieldOcc pass],
ConDeclField pass -> LBangType pass
cd_fld_type :: LBangType pass,
ConDeclField pass -> Maybe LHsDocString
cd_fld_doc :: Maybe LHsDocString }
| XConDeclField (XXConDeclField pass)
type instance XConDeclField (GhcPass _) = NoExt
type instance XXConDeclField (GhcPass _) = NoExt
instance (p ~ GhcPass pass, OutputableBndrId p)
=> Outputable (ConDeclField p) where
ppr :: ConDeclField p -> SDoc
ppr (ConDeclField _ fld_n :: [LFieldOcc p]
fld_n fld_ty :: LBangType p
fld_ty _) = [LFieldOcc p] -> SDoc
forall a. Outputable a => a -> SDoc
ppr [LFieldOcc p]
fld_n SDoc -> SDoc -> SDoc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
<+> LBangType p -> SDoc
forall a. Outputable a => a -> SDoc
ppr LBangType p
fld_ty
ppr (XConDeclField x :: XXConDeclField p
x) = NoExt -> SDoc
forall a. Outputable a => a -> SDoc
ppr XXConDeclField p
NoExt
x
data HsConDetails arg rec
= PrefixCon [arg]
| RecCon rec
| InfixCon arg arg
deriving Typeable (HsConDetails arg rec)
DataType
Constr
Typeable (HsConDetails arg rec) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsConDetails arg rec
-> c (HsConDetails arg rec))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsConDetails arg rec))
-> (HsConDetails arg rec -> Constr)
-> (HsConDetails arg rec -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (HsConDetails arg rec)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsConDetails arg rec)))
-> ((forall b. Data b => b -> b)
-> HsConDetails arg rec -> HsConDetails arg rec)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r)
-> (forall u.
(forall d. Data d => d -> u) -> HsConDetails arg rec -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> HsConDetails arg rec -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec))
-> Data (HsConDetails arg rec)
HsConDetails arg rec -> DataType
HsConDetails arg rec -> Constr
(forall b. Data b => b -> b)
-> HsConDetails arg rec -> HsConDetails arg rec
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsConDetails arg rec
-> c (HsConDetails arg rec)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsConDetails arg rec)
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsConDetails arg rec))
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) -> HsConDetails arg rec -> u
forall u.
(forall d. Data d => d -> u) -> HsConDetails arg rec -> [u]
forall arg rec.
(Data arg, Data rec) =>
Typeable (HsConDetails arg rec)
forall arg rec.
(Data arg, Data rec) =>
HsConDetails arg rec -> DataType
forall arg rec.
(Data arg, Data rec) =>
HsConDetails arg rec -> Constr
forall arg rec.
(Data arg, Data rec) =>
(forall b. Data b => b -> b)
-> HsConDetails arg rec -> HsConDetails arg rec
forall arg rec u.
(Data arg, Data rec) =>
Int -> (forall d. Data d => d -> u) -> HsConDetails arg rec -> u
forall arg rec u.
(Data arg, Data rec) =>
(forall d. Data d => d -> u) -> HsConDetails arg rec -> [u]
forall arg rec r r'.
(Data arg, Data rec) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r
forall arg rec r r'.
(Data arg, Data rec) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r
forall arg rec (m :: * -> *).
(Data arg, Data rec, Monad m) =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
forall arg rec (m :: * -> *).
(Data arg, Data rec, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
forall arg rec (c :: * -> *).
(Data arg, Data rec) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsConDetails arg rec)
forall arg rec (c :: * -> *).
(Data arg, Data rec) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsConDetails arg rec
-> c (HsConDetails arg rec)
forall arg rec (t :: * -> *) (c :: * -> *).
(Data arg, Data rec, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (HsConDetails arg rec))
forall arg rec (t :: * -> * -> *) (c :: * -> *).
(Data arg, Data rec, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsConDetails arg rec))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsConDetails arg rec)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsConDetails arg rec
-> c (HsConDetails arg rec)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (HsConDetails arg rec))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsConDetails arg rec))
$cInfixCon :: Constr
$cRecCon :: Constr
$cPrefixCon :: Constr
$tHsConDetails :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
$cgmapMo :: forall arg rec (m :: * -> *).
(Data arg, Data rec, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
gmapMp :: (forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
$cgmapMp :: forall arg rec (m :: * -> *).
(Data arg, Data rec, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
gmapM :: (forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
$cgmapM :: forall arg rec (m :: * -> *).
(Data arg, Data rec, Monad m) =>
(forall d. Data d => d -> m d)
-> HsConDetails arg rec -> m (HsConDetails arg rec)
gmapQi :: Int -> (forall d. Data d => d -> u) -> HsConDetails arg rec -> u
$cgmapQi :: forall arg rec u.
(Data arg, Data rec) =>
Int -> (forall d. Data d => d -> u) -> HsConDetails arg rec -> u
gmapQ :: (forall d. Data d => d -> u) -> HsConDetails arg rec -> [u]
$cgmapQ :: forall arg rec u.
(Data arg, Data rec) =>
(forall d. Data d => d -> u) -> HsConDetails arg rec -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r
$cgmapQr :: forall arg rec r r'.
(Data arg, Data rec) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r
$cgmapQl :: forall arg rec r r'.
(Data arg, Data rec) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HsConDetails arg rec -> r
gmapT :: (forall b. Data b => b -> b)
-> HsConDetails arg rec -> HsConDetails arg rec
$cgmapT :: forall arg rec.
(Data arg, Data rec) =>
(forall b. Data b => b -> b)
-> HsConDetails arg rec -> HsConDetails arg rec
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsConDetails arg rec))
$cdataCast2 :: forall arg rec (t :: * -> * -> *) (c :: * -> *).
(Data arg, Data rec, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (HsConDetails arg rec))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (HsConDetails arg rec))
$cdataCast1 :: forall arg rec (t :: * -> *) (c :: * -> *).
(Data arg, Data rec, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (HsConDetails arg rec))
dataTypeOf :: HsConDetails arg rec -> DataType
$cdataTypeOf :: forall arg rec.
(Data arg, Data rec) =>
HsConDetails arg rec -> DataType
toConstr :: HsConDetails arg rec -> Constr
$ctoConstr :: forall arg rec.
(Data arg, Data rec) =>
HsConDetails arg rec -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsConDetails arg rec)
$cgunfold :: forall arg rec (c :: * -> *).
(Data arg, Data rec) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (HsConDetails arg rec)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsConDetails arg rec
-> c (HsConDetails arg rec)
$cgfoldl :: forall arg rec (c :: * -> *).
(Data arg, Data rec) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> HsConDetails arg rec
-> c (HsConDetails arg rec)
$cp1Data :: forall arg rec.
(Data arg, Data rec) =>
Typeable (HsConDetails arg rec)
Data
instance (Outputable arg, Outputable rec)
=> Outputable (HsConDetails arg rec) where
ppr :: HsConDetails arg rec -> SDoc
ppr (PrefixCon args :: [arg]
args) = String -> SDoc
text "PrefixCon" SDoc -> SDoc -> SDoc
<+> [arg] -> SDoc
forall a. Outputable a => a -> SDoc
ppr [arg]
args
ppr (RecCon rec :: rec
rec) = String -> SDoc
text "RecCon:" SDoc -> SDoc -> SDoc
<+> rec -> SDoc
forall a. Outputable a => a -> SDoc
ppr rec
rec
ppr (InfixCon l :: arg
l r :: arg
r) = String -> SDoc
text "InfixCon:" SDoc -> SDoc -> SDoc
<+> [arg] -> SDoc
forall a. Outputable a => a -> SDoc
ppr [arg
l, arg
r]
hsWcScopedTvs :: LHsSigWcType GhcRn -> [Name]
hsWcScopedTvs :: LHsSigWcType GhcRn -> [Name]
hsWcScopedTvs sig_ty :: LHsSigWcType GhcRn
sig_ty
| HsWC { hswc_ext :: forall pass thing. HsWildCardBndrs pass thing -> XHsWC pass thing
hswc_ext = XHsWC GhcRn (LHsSigType GhcRn)
nwcs, hswc_body :: forall pass thing. HsWildCardBndrs pass thing -> thing
hswc_body = LHsSigType GhcRn
sig_ty1 } <- LHsSigWcType GhcRn
sig_ty
, HsIB { hsib_ext :: forall pass thing. HsImplicitBndrs pass thing -> XHsIB pass thing
hsib_ext = XHsIB GhcRn (LHsType GhcRn)
vars
, hsib_body :: forall pass thing. HsImplicitBndrs pass thing -> thing
hsib_body = LHsType GhcRn
sig_ty2 } <- LHsSigType GhcRn
sig_ty1
= case LHsType GhcRn
sig_ty2 of
L _ (HsForAllTy { hst_bndrs :: forall pass. HsType pass -> [LHsTyVarBndr pass]
hst_bndrs = [LHsTyVarBndr GhcRn]
tvs }) -> [Name]
XHsIB GhcRn (LHsType GhcRn)
vars [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [Name]
XHsWC GhcRn (LHsSigType GhcRn)
nwcs [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++
(LHsTyVarBndr GhcRn -> Name) -> [LHsTyVarBndr GhcRn] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map LHsTyVarBndr GhcRn -> Name
forall pass. LHsTyVarBndr pass -> IdP pass
hsLTyVarName [LHsTyVarBndr GhcRn]
tvs
_ -> [Name]
XHsWC GhcRn (LHsSigType GhcRn)
nwcs
hsWcScopedTvs (HsWC _ (XHsImplicitBndrs _)) = String -> [Name]
forall a. String -> a
panic "hsWcScopedTvs"
hsWcScopedTvs (XHsWildCardBndrs _) = String -> [Name]
forall a. String -> a
panic "hsWcScopedTvs"
hsScopedTvs :: LHsSigType GhcRn -> [Name]
hsScopedTvs :: LHsSigType GhcRn -> [Name]
hsScopedTvs sig_ty :: LHsSigType GhcRn
sig_ty
| HsIB { hsib_ext :: forall pass thing. HsImplicitBndrs pass thing -> XHsIB pass thing
hsib_ext = XHsIB GhcRn (LHsType GhcRn)
vars
, hsib_body :: forall pass thing. HsImplicitBndrs pass thing -> thing
hsib_body = LHsType GhcRn
sig_ty2 } <- LHsSigType GhcRn
sig_ty
, L _ (HsForAllTy { hst_bndrs :: forall pass. HsType pass -> [LHsTyVarBndr pass]
hst_bndrs = [LHsTyVarBndr GhcRn]
tvs }) <- LHsType GhcRn
sig_ty2
= [Name]
XHsIB GhcRn (LHsType GhcRn)
vars [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ (LHsTyVarBndr GhcRn -> Name) -> [LHsTyVarBndr GhcRn] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map LHsTyVarBndr GhcRn -> Name
forall pass. LHsTyVarBndr pass -> IdP pass
hsLTyVarName [LHsTyVarBndr GhcRn]
tvs
| Bool
otherwise
= []
hsTyVarName :: HsTyVarBndr pass -> IdP pass
hsTyVarName :: HsTyVarBndr pass -> IdP pass
hsTyVarName (UserTyVar _ (L _ n :: IdP pass
n)) = IdP pass
n
hsTyVarName (KindedTyVar _ (L _ n :: IdP pass
n) _) = IdP pass
n
hsTyVarName (XTyVarBndr{}) = String -> IdP pass
forall a. String -> a
panic "hsTyVarName"
hsLTyVarName :: LHsTyVarBndr pass -> IdP pass
hsLTyVarName :: LHsTyVarBndr pass -> IdP pass
hsLTyVarName = HsTyVarBndr pass -> IdP pass
forall pass. HsTyVarBndr pass -> IdP pass
hsTyVarName (HsTyVarBndr pass -> IdP pass)
-> (LHsTyVarBndr pass -> HsTyVarBndr pass)
-> LHsTyVarBndr pass
-> IdP pass
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LHsTyVarBndr pass -> HsTyVarBndr pass
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc
hsExplicitLTyVarNames :: LHsQTyVars pass -> [IdP pass]
hsExplicitLTyVarNames :: LHsQTyVars pass -> [IdP pass]
hsExplicitLTyVarNames qtvs :: LHsQTyVars pass
qtvs = (LHsTyVarBndr pass -> IdP pass)
-> [LHsTyVarBndr pass] -> [IdP pass]
forall a b. (a -> b) -> [a] -> [b]
map LHsTyVarBndr pass -> IdP pass
forall pass. LHsTyVarBndr pass -> IdP pass
hsLTyVarName (LHsQTyVars pass -> [LHsTyVarBndr pass]
forall pass. LHsQTyVars pass -> [LHsTyVarBndr pass]
hsQTvExplicit LHsQTyVars pass
qtvs)
hsAllLTyVarNames :: LHsQTyVars GhcRn -> [Name]
hsAllLTyVarNames :: LHsQTyVars GhcRn -> [Name]
hsAllLTyVarNames (HsQTvs { hsq_ext :: forall pass. LHsQTyVars pass -> XHsQTvs pass
hsq_ext = HsQTvsRn { hsq_implicit = kvs }
, hsq_explicit :: forall pass. LHsQTyVars pass -> [LHsTyVarBndr pass]
hsq_explicit = [LHsTyVarBndr GhcRn]
tvs })
= [Name]
kvs [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ (LHsTyVarBndr GhcRn -> Name) -> [LHsTyVarBndr GhcRn] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map LHsTyVarBndr GhcRn -> Name
forall pass. LHsTyVarBndr pass -> IdP pass
hsLTyVarName [LHsTyVarBndr GhcRn]
tvs
hsAllLTyVarNames (XLHsQTyVars _) = String -> [Name]
forall a. String -> a
panic "hsAllLTyVarNames"
hsLTyVarLocName :: LHsTyVarBndr pass -> Located (IdP pass)
hsLTyVarLocName :: LHsTyVarBndr pass -> Located (IdP pass)
hsLTyVarLocName = (SrcSpanLess (LHsTyVarBndr pass)
-> SrcSpanLess (Located (IdP pass)))
-> LHsTyVarBndr pass -> Located (IdP pass)
forall a b.
(HasSrcSpan a, HasSrcSpan b) =>
(SrcSpanLess a -> SrcSpanLess b) -> a -> b
onHasSrcSpan SrcSpanLess (LHsTyVarBndr pass) -> SrcSpanLess (Located (IdP pass))
forall pass. HsTyVarBndr pass -> IdP pass
hsTyVarName
hsLTyVarLocNames :: LHsQTyVars pass -> [Located (IdP pass)]
hsLTyVarLocNames :: LHsQTyVars pass -> [Located (IdP pass)]
hsLTyVarLocNames qtvs :: LHsQTyVars pass
qtvs = (LHsTyVarBndr pass -> Located (IdP pass))
-> [LHsTyVarBndr pass] -> [Located (IdP pass)]
forall a b. (a -> b) -> [a] -> [b]
map LHsTyVarBndr pass -> Located (IdP pass)
forall pass. LHsTyVarBndr pass -> Located (IdP pass)
hsLTyVarLocName (LHsQTyVars pass -> [LHsTyVarBndr pass]
forall pass. LHsQTyVars pass -> [LHsTyVarBndr pass]
hsQTvExplicit LHsQTyVars pass
qtvs)
hsLTyVarBndrToType :: LHsTyVarBndr (GhcPass p) -> LHsType (GhcPass p)
hsLTyVarBndrToType :: LHsTyVarBndr (GhcPass p) -> LHsType (GhcPass p)
hsLTyVarBndrToType = (SrcSpanLess (LHsTyVarBndr (GhcPass p))
-> SrcSpanLess (LHsType (GhcPass p)))
-> LHsTyVarBndr (GhcPass p) -> LHsType (GhcPass p)
forall a b.
(HasSrcSpan a, HasSrcSpan b) =>
(SrcSpanLess a -> SrcSpanLess b) -> a -> b
onHasSrcSpan SrcSpanLess (LHsTyVarBndr (GhcPass p))
-> SrcSpanLess (LHsType (GhcPass p))
forall pass.
(XKindSig pass ~ NoExt, XTyVar pass ~ NoExt) =>
HsTyVarBndr pass -> HsType pass
cvt
where cvt :: HsTyVarBndr pass -> HsType pass
cvt (UserTyVar _ n :: Located (IdP pass)
n) = XTyVar pass -> PromotionFlag -> Located (IdP pass) -> HsType pass
forall pass.
XTyVar pass -> PromotionFlag -> Located (IdP pass) -> HsType pass
HsTyVar XTyVar pass
NoExt
noExt PromotionFlag
NotPromoted Located (IdP pass)
n
cvt (KindedTyVar _ (L name_loc :: SrcSpan
name_loc n :: IdP pass
n) kind :: LHsKind pass
kind)
= XKindSig pass -> LHsKind pass -> LHsKind pass -> HsType pass
forall pass.
XKindSig pass -> LHsType pass -> LHsType pass -> HsType pass
HsKindSig XKindSig pass
NoExt
noExt
(SrcSpan -> HsType pass -> LHsKind pass
forall l e. l -> e -> GenLocated l e
L SrcSpan
name_loc (XTyVar pass -> PromotionFlag -> Located (IdP pass) -> HsType pass
forall pass.
XTyVar pass -> PromotionFlag -> Located (IdP pass) -> HsType pass
HsTyVar XTyVar pass
NoExt
noExt PromotionFlag
NotPromoted (SrcSpan -> IdP pass -> Located (IdP pass)
forall l e. l -> e -> GenLocated l e
L SrcSpan
name_loc IdP pass
n))) LHsKind pass
kind
cvt (XTyVarBndr{}) = String -> HsType pass
forall a. String -> a
panic "hsLTyVarBndrToType"
hsLTyVarBndrsToTypes :: LHsQTyVars (GhcPass p) -> [LHsType (GhcPass p)]
hsLTyVarBndrsToTypes :: LHsQTyVars (GhcPass p) -> [LHsType (GhcPass p)]
hsLTyVarBndrsToTypes (HsQTvs { hsq_explicit :: forall pass. LHsQTyVars pass -> [LHsTyVarBndr pass]
hsq_explicit = [LHsTyVarBndr (GhcPass p)]
tvbs }) = (LHsTyVarBndr (GhcPass p) -> LHsType (GhcPass p))
-> [LHsTyVarBndr (GhcPass p)] -> [LHsType (GhcPass p)]
forall a b. (a -> b) -> [a] -> [b]
map LHsTyVarBndr (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass). LHsTyVarBndr (GhcPass p) -> LHsType (GhcPass p)
hsLTyVarBndrToType [LHsTyVarBndr (GhcPass p)]
tvbs
hsLTyVarBndrsToTypes (XLHsQTyVars _) = String -> [LHsType (GhcPass p)]
forall a. String -> a
panic "hsLTyVarBndrsToTypes"
ignoreParens :: LHsType pass -> LHsType pass
ignoreParens :: LHsType pass -> LHsType pass
ignoreParens (L _ (HsParTy _ ty :: LHsType pass
ty)) = LHsType pass -> LHsType pass
forall pass. LHsType pass -> LHsType pass
ignoreParens LHsType pass
ty
ignoreParens ty :: LHsType pass
ty = LHsType pass
ty
isLHsForAllTy :: LHsType p -> Bool
isLHsForAllTy :: LHsType p -> Bool
isLHsForAllTy (L _ (HsForAllTy {})) = Bool
True
isLHsForAllTy _ = Bool
False
mkAnonWildCardTy :: HsType GhcPs
mkAnonWildCardTy :: HsType GhcPs
mkAnonWildCardTy = XWildCardTy GhcPs -> HsType GhcPs
forall pass. XWildCardTy pass -> HsType pass
HsWildCardTy XWildCardTy GhcPs
NoExt
noExt
mkHsOpTy :: LHsType (GhcPass p) -> Located (IdP (GhcPass p))
-> LHsType (GhcPass p) -> HsType (GhcPass p)
mkHsOpTy :: LHsType (GhcPass p)
-> Located (IdP (GhcPass p))
-> LHsType (GhcPass p)
-> HsType (GhcPass p)
mkHsOpTy ty1 :: LHsType (GhcPass p)
ty1 op :: Located (IdP (GhcPass p))
op ty2 :: LHsType (GhcPass p)
ty2 = XOpTy (GhcPass p)
-> LHsType (GhcPass p)
-> Located (IdP (GhcPass p))
-> LHsType (GhcPass p)
-> HsType (GhcPass p)
forall pass.
XOpTy pass
-> LHsType pass
-> Located (IdP pass)
-> LHsType pass
-> HsType pass
HsOpTy XOpTy (GhcPass p)
NoExt
noExt LHsType (GhcPass p)
ty1 Located (IdP (GhcPass p))
op LHsType (GhcPass p)
ty2
mkHsAppTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
mkHsAppTy :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
mkHsAppTy t1 :: LHsType (GhcPass p)
t1 t2 :: LHsType (GhcPass p)
t2
= LHsType (GhcPass p)
-> LHsType (GhcPass p)
-> SrcSpanLess (LHsType (GhcPass p))
-> LHsType (GhcPass p)
forall a b c.
(HasSrcSpan a, HasSrcSpan b, HasSrcSpan c) =>
a -> b -> SrcSpanLess c -> c
addCLoc LHsType (GhcPass p)
t1 LHsType (GhcPass p)
t2 (XAppTy (GhcPass p)
-> LHsType (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass.
XAppTy pass -> LHsType pass -> LHsType pass -> HsType pass
HsAppTy XAppTy (GhcPass p)
NoExt
noExt LHsType (GhcPass p)
t1 (PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType PprPrec
appPrec LHsType (GhcPass p)
t2))
mkHsAppTys :: LHsType (GhcPass p) -> [LHsType (GhcPass p)]
-> LHsType (GhcPass p)
mkHsAppTys :: LHsType (GhcPass p) -> [LHsType (GhcPass p)] -> LHsType (GhcPass p)
mkHsAppTys = (LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p))
-> LHsType (GhcPass p)
-> [LHsType (GhcPass p)]
-> LHsType (GhcPass p)
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
mkHsAppTy
mkHsAppKindTy :: XAppKindTy (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
-> LHsType (GhcPass p)
mkHsAppKindTy :: XAppKindTy (GhcPass p)
-> LHsType (GhcPass p)
-> LHsType (GhcPass p)
-> LHsType (GhcPass p)
mkHsAppKindTy ext :: XAppKindTy (GhcPass p)
ext ty :: LHsType (GhcPass p)
ty k :: LHsType (GhcPass p)
k
= LHsType (GhcPass p)
-> LHsType (GhcPass p)
-> SrcSpanLess (LHsType (GhcPass p))
-> LHsType (GhcPass p)
forall a b c.
(HasSrcSpan a, HasSrcSpan b, HasSrcSpan c) =>
a -> b -> SrcSpanLess c -> c
addCLoc LHsType (GhcPass p)
ty LHsType (GhcPass p)
k (XAppKindTy (GhcPass p)
-> LHsType (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass.
XAppKindTy pass -> LHsType pass -> LHsType pass -> HsType pass
HsAppKindTy XAppKindTy (GhcPass p)
ext LHsType (GhcPass p)
ty LHsType (GhcPass p)
k)
splitHsFunType :: LHsType GhcRn -> ([LHsType GhcRn], LHsType GhcRn)
splitHsFunType :: LHsType GhcRn -> ([LHsType GhcRn], LHsType GhcRn)
splitHsFunType (L _ (HsParTy _ ty :: LHsType GhcRn
ty))
= LHsType GhcRn -> ([LHsType GhcRn], LHsType GhcRn)
splitHsFunType LHsType GhcRn
ty
splitHsFunType (L _ (HsFunTy _ x :: LHsType GhcRn
x y :: LHsType GhcRn
y))
| (args :: [LHsType GhcRn]
args, res :: LHsType GhcRn
res) <- LHsType GhcRn -> ([LHsType GhcRn], LHsType GhcRn)
splitHsFunType LHsType GhcRn
y
= (LHsType GhcRn
xLHsType GhcRn -> [LHsType GhcRn] -> [LHsType GhcRn]
forall a. a -> [a] -> [a]
:[LHsType GhcRn]
args, LHsType GhcRn
res)
splitHsFunType orig_ty :: LHsType GhcRn
orig_ty@(L _ (HsAppTy _ t1 :: LHsType GhcRn
t1 t2 :: LHsType GhcRn
t2))
= LHsType GhcRn
-> [LHsType GhcRn] -> ([LHsType GhcRn], LHsType GhcRn)
go LHsType GhcRn
t1 [LHsType GhcRn
t2]
where
go :: LHsType GhcRn
-> [LHsType GhcRn] -> ([LHsType GhcRn], LHsType GhcRn)
go (L _ (HsTyVar _ _ (L _ fn :: IdP GhcRn
fn))) tys :: [LHsType GhcRn]
tys | Name
IdP GhcRn
fn Name -> Name -> Bool
forall a. Eq a => a -> a -> Bool
== Name
funTyConName
, [t1 :: LHsType GhcRn
t1,t2 :: LHsType GhcRn
t2] <- [LHsType GhcRn]
tys
, (args :: [LHsType GhcRn]
args, res :: LHsType GhcRn
res) <- LHsType GhcRn -> ([LHsType GhcRn], LHsType GhcRn)
splitHsFunType LHsType GhcRn
t2
= (LHsType GhcRn
t1LHsType GhcRn -> [LHsType GhcRn] -> [LHsType GhcRn]
forall a. a -> [a] -> [a]
:[LHsType GhcRn]
args, LHsType GhcRn
res)
go (L _ (HsAppTy _ t1 :: LHsType GhcRn
t1 t2 :: LHsType GhcRn
t2)) tys :: [LHsType GhcRn]
tys = LHsType GhcRn
-> [LHsType GhcRn] -> ([LHsType GhcRn], LHsType GhcRn)
go LHsType GhcRn
t1 (LHsType GhcRn
t2LHsType GhcRn -> [LHsType GhcRn] -> [LHsType GhcRn]
forall a. a -> [a] -> [a]
:[LHsType GhcRn]
tys)
go (L _ (HsParTy _ ty :: LHsType GhcRn
ty)) tys :: [LHsType GhcRn]
tys = LHsType GhcRn
-> [LHsType GhcRn] -> ([LHsType GhcRn], LHsType GhcRn)
go LHsType GhcRn
ty [LHsType GhcRn]
tys
go _ _ = ([], LHsType GhcRn
orig_ty)
splitHsFunType other :: LHsType GhcRn
other = ([], LHsType GhcRn
other)
hsTyGetAppHead_maybe :: LHsType (GhcPass p)
-> Maybe (Located (IdP (GhcPass p)))
hsTyGetAppHead_maybe :: LHsType (GhcPass p) -> Maybe (Located (IdP (GhcPass p)))
hsTyGetAppHead_maybe = LHsType (GhcPass p) -> Maybe (Located (IdP (GhcPass p)))
forall pass. LHsType pass -> Maybe (GenLocated SrcSpan (IdP pass))
go
where
go :: LHsType pass -> Maybe (GenLocated SrcSpan (IdP pass))
go (L _ (HsTyVar _ _ ln :: GenLocated SrcSpan (IdP pass)
ln)) = GenLocated SrcSpan (IdP pass)
-> Maybe (GenLocated SrcSpan (IdP pass))
forall a. a -> Maybe a
Just GenLocated SrcSpan (IdP pass)
ln
go (L _ (HsAppTy _ l :: LHsType pass
l _)) = LHsType pass -> Maybe (GenLocated SrcSpan (IdP pass))
go LHsType pass
l
go (L _ (HsAppKindTy _ t :: LHsType pass
t _)) = LHsType pass -> Maybe (GenLocated SrcSpan (IdP pass))
go LHsType pass
t
go (L _ (HsOpTy _ _ (L loc :: SrcSpan
loc n :: IdP pass
n) _)) = GenLocated SrcSpan (IdP pass)
-> Maybe (GenLocated SrcSpan (IdP pass))
forall a. a -> Maybe a
Just (SrcSpan -> IdP pass -> GenLocated SrcSpan (IdP pass)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc IdP pass
n)
go (L _ (HsParTy _ t :: LHsType pass
t)) = LHsType pass -> Maybe (GenLocated SrcSpan (IdP pass))
go LHsType pass
t
go (L _ (HsKindSig _ t :: LHsType pass
t _)) = LHsType pass -> Maybe (GenLocated SrcSpan (IdP pass))
go LHsType pass
t
go _ = Maybe (GenLocated SrcSpan (IdP pass))
forall a. Maybe a
Nothing
data HsArg tm ty
= HsValArg tm
| HsTypeArg SrcSpan ty
| HsArgPar SrcSpan
numVisibleArgs :: [HsArg tm ty] -> Arity
numVisibleArgs :: [HsArg tm ty] -> Int
numVisibleArgs = (HsArg tm ty -> Bool) -> [HsArg tm ty] -> Int
forall a. (a -> Bool) -> [a] -> Int
count HsArg tm ty -> Bool
forall tm ty. HsArg tm ty -> Bool
is_vis
where is_vis :: HsArg tm ty -> Bool
is_vis (HsValArg _) = Bool
True
is_vis _ = Bool
False
type LHsTypeArg p = HsArg (LHsType p) (LHsKind p)
instance (Outputable tm, Outputable ty) => Outputable (HsArg tm ty) where
ppr :: HsArg tm ty -> SDoc
ppr (HsValArg tm :: tm
tm) = tm -> SDoc
forall a. Outputable a => a -> SDoc
ppr tm
tm
ppr (HsTypeArg _ ty :: ty
ty) = Char -> SDoc
char '@' SDoc -> SDoc -> SDoc
<> ty -> SDoc
forall a. Outputable a => a -> SDoc
ppr ty
ty
ppr (HsArgPar sp :: SrcSpan
sp) = String -> SDoc
text "HsArgPar" SDoc -> SDoc -> SDoc
<+> SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr SrcSpan
sp
splitHsAppTys :: HsType GhcRn -> (LHsType GhcRn, [LHsTypeArg GhcRn])
splitHsAppTys :: HsType GhcRn -> (LHsType GhcRn, [LHsTypeArg GhcRn])
splitHsAppTys e :: HsType GhcRn
e = LHsType GhcRn
-> [LHsTypeArg GhcRn] -> (LHsType GhcRn, [LHsTypeArg GhcRn])
go (SrcSpanLess (LHsType GhcRn) -> LHsType GhcRn
forall a. HasSrcSpan a => SrcSpanLess a -> a
noLoc SrcSpanLess (LHsType GhcRn)
HsType GhcRn
e) []
where
go :: LHsType GhcRn -> [LHsTypeArg GhcRn]
-> (LHsType GhcRn, [LHsTypeArg GhcRn])
go :: LHsType GhcRn
-> [LHsTypeArg GhcRn] -> (LHsType GhcRn, [LHsTypeArg GhcRn])
go (L _ (HsAppTy _ f :: LHsType GhcRn
f a :: LHsType GhcRn
a)) as :: [LHsTypeArg GhcRn]
as = LHsType GhcRn
-> [LHsTypeArg GhcRn] -> (LHsType GhcRn, [LHsTypeArg GhcRn])
go LHsType GhcRn
f (LHsType GhcRn -> LHsTypeArg GhcRn
forall tm ty. tm -> HsArg tm ty
HsValArg LHsType GhcRn
a LHsTypeArg GhcRn -> [LHsTypeArg GhcRn] -> [LHsTypeArg GhcRn]
forall a. a -> [a] -> [a]
: [LHsTypeArg GhcRn]
as)
go (L _ (HsAppKindTy l :: XAppKindTy GhcRn
l ty :: LHsType GhcRn
ty k :: LHsType GhcRn
k)) as :: [LHsTypeArg GhcRn]
as = LHsType GhcRn
-> [LHsTypeArg GhcRn] -> (LHsType GhcRn, [LHsTypeArg GhcRn])
go LHsType GhcRn
ty (SrcSpan -> LHsType GhcRn -> LHsTypeArg GhcRn
forall tm ty. SrcSpan -> ty -> HsArg tm ty
HsTypeArg SrcSpan
XAppKindTy GhcRn
l LHsType GhcRn
k LHsTypeArg GhcRn -> [LHsTypeArg GhcRn] -> [LHsTypeArg GhcRn]
forall a. a -> [a] -> [a]
: [LHsTypeArg GhcRn]
as)
go (L sp :: SrcSpan
sp (HsParTy _ f :: LHsType GhcRn
f)) as :: [LHsTypeArg GhcRn]
as = LHsType GhcRn
-> [LHsTypeArg GhcRn] -> (LHsType GhcRn, [LHsTypeArg GhcRn])
go LHsType GhcRn
f (SrcSpan -> LHsTypeArg GhcRn
forall tm ty. SrcSpan -> HsArg tm ty
HsArgPar SrcSpan
sp LHsTypeArg GhcRn -> [LHsTypeArg GhcRn] -> [LHsTypeArg GhcRn]
forall a. a -> [a] -> [a]
: [LHsTypeArg GhcRn]
as)
go f :: LHsType GhcRn
f as :: [LHsTypeArg GhcRn]
as = (LHsType GhcRn
f,[LHsTypeArg GhcRn]
as)
splitLHsPatSynTy :: LHsType pass
-> ( [LHsTyVarBndr pass]
, LHsContext pass
, [LHsTyVarBndr pass]
, LHsContext pass
, LHsType pass)
splitLHsPatSynTy :: LHsType pass
-> ([LHsTyVarBndr pass], LHsContext pass, [LHsTyVarBndr pass],
LHsContext pass, LHsType pass)
splitLHsPatSynTy ty :: LHsType pass
ty = ([LHsTyVarBndr pass]
univs, LHsContext pass
reqs, [LHsTyVarBndr pass]
exis, LHsContext pass
provs, LHsType pass
ty4)
where
(univs :: [LHsTyVarBndr pass]
univs, ty1 :: LHsType pass
ty1) = LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
forall pass. LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
splitLHsForAllTy LHsType pass
ty
(reqs :: LHsContext pass
reqs, ty2 :: LHsType pass
ty2) = LHsType pass -> (LHsContext pass, LHsType pass)
forall pass. LHsType pass -> (LHsContext pass, LHsType pass)
splitLHsQualTy LHsType pass
ty1
(exis :: [LHsTyVarBndr pass]
exis, ty3 :: LHsType pass
ty3) = LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
forall pass. LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
splitLHsForAllTy LHsType pass
ty2
(provs :: LHsContext pass
provs, ty4 :: LHsType pass
ty4) = LHsType pass -> (LHsContext pass, LHsType pass)
forall pass. LHsType pass -> (LHsContext pass, LHsType pass)
splitLHsQualTy LHsType pass
ty3
splitLHsSigmaTy :: LHsType pass
-> ([LHsTyVarBndr pass], LHsContext pass, LHsType pass)
splitLHsSigmaTy :: LHsType pass
-> ([LHsTyVarBndr pass], LHsContext pass, LHsType pass)
splitLHsSigmaTy ty :: LHsType pass
ty
| (tvs :: [LHsTyVarBndr pass]
tvs, ty1 :: LHsType pass
ty1) <- LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
forall pass. LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
splitLHsForAllTy LHsType pass
ty
, (ctxt :: LHsContext pass
ctxt, ty2 :: LHsType pass
ty2) <- LHsType pass -> (LHsContext pass, LHsType pass)
forall pass. LHsType pass -> (LHsContext pass, LHsType pass)
splitLHsQualTy LHsType pass
ty1
= ([LHsTyVarBndr pass]
tvs, LHsContext pass
ctxt, LHsType pass
ty2)
splitLHsForAllTy :: LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
splitLHsForAllTy :: LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
splitLHsForAllTy (L _ (HsParTy _ ty :: LHsType pass
ty)) = LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
forall pass. LHsType pass -> ([LHsTyVarBndr pass], LHsType pass)
splitLHsForAllTy LHsType pass
ty
splitLHsForAllTy (L _ (HsForAllTy { hst_bndrs :: forall pass. HsType pass -> [LHsTyVarBndr pass]
hst_bndrs = [LHsTyVarBndr pass]
tvs, hst_body :: forall pass. HsType pass -> LHsType pass
hst_body = LHsType pass
body })) = ([LHsTyVarBndr pass]
tvs, LHsType pass
body)
splitLHsForAllTy body :: LHsType pass
body = ([], LHsType pass
body)
splitLHsQualTy :: LHsType pass -> (LHsContext pass, LHsType pass)
splitLHsQualTy :: LHsType pass -> (LHsContext pass, LHsType pass)
splitLHsQualTy (L _ (HsParTy _ ty :: LHsType pass
ty)) = LHsType pass -> (LHsContext pass, LHsType pass)
forall pass. LHsType pass -> (LHsContext pass, LHsType pass)
splitLHsQualTy LHsType pass
ty
splitLHsQualTy (L _ (HsQualTy { hst_ctxt :: forall pass. HsType pass -> LHsContext pass
hst_ctxt = LHsContext pass
ctxt, hst_body :: forall pass. HsType pass -> LHsType pass
hst_body = LHsType pass
body })) = (LHsContext pass
ctxt, LHsType pass
body)
splitLHsQualTy body :: LHsType pass
body = (LHsContext pass
forall pass. LHsContext pass
noLHsContext, LHsType pass
body)
splitLHsInstDeclTy :: LHsSigType GhcRn
-> ([Name], LHsContext GhcRn, LHsType GhcRn)
splitLHsInstDeclTy :: LHsSigType GhcRn -> ([Name], LHsContext GhcRn, LHsType GhcRn)
splitLHsInstDeclTy (HsIB { hsib_ext :: forall pass thing. HsImplicitBndrs pass thing -> XHsIB pass thing
hsib_ext = XHsIB GhcRn (LHsType GhcRn)
itkvs
, hsib_body :: forall pass thing. HsImplicitBndrs pass thing -> thing
hsib_body = LHsType GhcRn
inst_ty })
| (tvs :: [LHsTyVarBndr GhcRn]
tvs, cxt :: LHsContext GhcRn
cxt, body_ty :: LHsType GhcRn
body_ty) <- LHsType GhcRn
-> ([LHsTyVarBndr GhcRn], LHsContext GhcRn, LHsType GhcRn)
forall pass.
LHsType pass
-> ([LHsTyVarBndr pass], LHsContext pass, LHsType pass)
splitLHsSigmaTy LHsType GhcRn
inst_ty
= ([Name]
XHsIB GhcRn (LHsType GhcRn)
itkvs [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ (LHsTyVarBndr GhcRn -> Name) -> [LHsTyVarBndr GhcRn] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map LHsTyVarBndr GhcRn -> Name
forall pass. LHsTyVarBndr pass -> IdP pass
hsLTyVarName [LHsTyVarBndr GhcRn]
tvs, LHsContext GhcRn
cxt, LHsType GhcRn
body_ty)
splitLHsInstDeclTy (XHsImplicitBndrs _) = String -> ([Name], LHsContext GhcRn, LHsType GhcRn)
forall a. String -> a
panic "splitLHsInstDeclTy"
getLHsInstDeclHead :: LHsSigType pass -> LHsType pass
getLHsInstDeclHead :: LHsSigType pass -> LHsType pass
getLHsInstDeclHead inst_ty :: LHsSigType pass
inst_ty
| (_tvs :: [LHsTyVarBndr pass]
_tvs, _cxt :: LHsContext pass
_cxt, body_ty :: LHsType pass
body_ty) <- LHsType pass
-> ([LHsTyVarBndr pass], LHsContext pass, LHsType pass)
forall pass.
LHsType pass
-> ([LHsTyVarBndr pass], LHsContext pass, LHsType pass)
splitLHsSigmaTy (LHsSigType pass -> LHsType pass
forall pass. LHsSigType pass -> LHsType pass
hsSigType LHsSigType pass
inst_ty)
= LHsType pass
body_ty
getLHsInstDeclClass_maybe :: LHsSigType (GhcPass p)
-> Maybe (Located (IdP (GhcPass p)))
getLHsInstDeclClass_maybe :: LHsSigType (GhcPass p) -> Maybe (Located (IdP (GhcPass p)))
getLHsInstDeclClass_maybe inst_ty :: LHsSigType (GhcPass p)
inst_ty
= do { let head_ty :: LHsType (GhcPass p)
head_ty = LHsSigType (GhcPass p) -> LHsType (GhcPass p)
forall pass. LHsSigType pass -> LHsType pass
getLHsInstDeclHead LHsSigType (GhcPass p)
inst_ty
; Located (IdP (GhcPass p))
cls <- LHsType (GhcPass p) -> Maybe (Located (IdP (GhcPass p)))
forall (p :: Pass).
LHsType (GhcPass p) -> Maybe (Located (IdP (GhcPass p)))
hsTyGetAppHead_maybe LHsType (GhcPass p)
head_ty
; Located (IdP (GhcPass p)) -> Maybe (Located (IdP (GhcPass p)))
forall (m :: * -> *) a. Monad m => a -> m a
return Located (IdP (GhcPass p))
cls }
type LFieldOcc pass = Located (FieldOcc pass)
data FieldOcc pass = FieldOcc { FieldOcc pass -> XCFieldOcc pass
extFieldOcc :: XCFieldOcc pass
, FieldOcc pass -> Located RdrName
rdrNameFieldOcc :: Located RdrName
}
| XFieldOcc
(XXFieldOcc pass)
deriving instance (p ~ GhcPass pass, Eq (XCFieldOcc p)) => Eq (FieldOcc p)
deriving instance (p ~ GhcPass pass, Ord (XCFieldOcc p)) => Ord (FieldOcc p)
type instance XCFieldOcc GhcPs = NoExt
type instance XCFieldOcc GhcRn = Name
type instance XCFieldOcc GhcTc = Id
type instance XXFieldOcc (GhcPass _) = NoExt
instance Outputable (FieldOcc pass) where
ppr :: FieldOcc pass -> SDoc
ppr = Located RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Located RdrName -> SDoc)
-> (FieldOcc pass -> Located RdrName) -> FieldOcc pass -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FieldOcc pass -> Located RdrName
forall pass. FieldOcc pass -> Located RdrName
rdrNameFieldOcc
mkFieldOcc :: Located RdrName -> FieldOcc GhcPs
mkFieldOcc :: Located RdrName -> FieldOcc GhcPs
mkFieldOcc rdr :: Located RdrName
rdr = XCFieldOcc GhcPs -> Located RdrName -> FieldOcc GhcPs
forall pass. XCFieldOcc pass -> Located RdrName -> FieldOcc pass
FieldOcc XCFieldOcc GhcPs
NoExt
noExt Located RdrName
rdr
data AmbiguousFieldOcc pass
= Unambiguous (XUnambiguous pass) (Located RdrName)
| Ambiguous (XAmbiguous pass) (Located RdrName)
| XAmbiguousFieldOcc (XXAmbiguousFieldOcc pass)
type instance XUnambiguous GhcPs = NoExt
type instance XUnambiguous GhcRn = Name
type instance XUnambiguous GhcTc = Id
type instance XAmbiguous GhcPs = NoExt
type instance XAmbiguous GhcRn = NoExt
type instance XAmbiguous GhcTc = Id
type instance XXAmbiguousFieldOcc (GhcPass _) = NoExt
instance p ~ GhcPass pass => Outputable (AmbiguousFieldOcc p) where
ppr :: AmbiguousFieldOcc p -> SDoc
ppr = RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr (RdrName -> SDoc)
-> (AmbiguousFieldOcc (GhcPass pass) -> RdrName)
-> AmbiguousFieldOcc (GhcPass pass)
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AmbiguousFieldOcc (GhcPass pass) -> RdrName
forall (p :: Pass). AmbiguousFieldOcc (GhcPass p) -> RdrName
rdrNameAmbiguousFieldOcc
instance p ~ GhcPass pass => OutputableBndr (AmbiguousFieldOcc p) where
pprInfixOcc :: AmbiguousFieldOcc p -> SDoc
pprInfixOcc = RdrName -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprInfixOcc (RdrName -> SDoc)
-> (AmbiguousFieldOcc (GhcPass pass) -> RdrName)
-> AmbiguousFieldOcc (GhcPass pass)
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AmbiguousFieldOcc (GhcPass pass) -> RdrName
forall (p :: Pass). AmbiguousFieldOcc (GhcPass p) -> RdrName
rdrNameAmbiguousFieldOcc
pprPrefixOcc :: AmbiguousFieldOcc p -> SDoc
pprPrefixOcc = RdrName -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc (RdrName -> SDoc)
-> (AmbiguousFieldOcc (GhcPass pass) -> RdrName)
-> AmbiguousFieldOcc (GhcPass pass)
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AmbiguousFieldOcc (GhcPass pass) -> RdrName
forall (p :: Pass). AmbiguousFieldOcc (GhcPass p) -> RdrName
rdrNameAmbiguousFieldOcc
mkAmbiguousFieldOcc :: Located RdrName -> AmbiguousFieldOcc GhcPs
mkAmbiguousFieldOcc :: Located RdrName -> AmbiguousFieldOcc GhcPs
mkAmbiguousFieldOcc rdr :: Located RdrName
rdr = XUnambiguous GhcPs -> Located RdrName -> AmbiguousFieldOcc GhcPs
forall pass.
XUnambiguous pass -> Located RdrName -> AmbiguousFieldOcc pass
Unambiguous XUnambiguous GhcPs
NoExt
noExt Located RdrName
rdr
rdrNameAmbiguousFieldOcc :: AmbiguousFieldOcc (GhcPass p) -> RdrName
rdrNameAmbiguousFieldOcc :: AmbiguousFieldOcc (GhcPass p) -> RdrName
rdrNameAmbiguousFieldOcc (Unambiguous _ (L _ rdr :: RdrName
rdr)) = RdrName
rdr
rdrNameAmbiguousFieldOcc (Ambiguous _ (L _ rdr :: RdrName
rdr)) = RdrName
rdr
rdrNameAmbiguousFieldOcc (XAmbiguousFieldOcc _)
= String -> RdrName
forall a. String -> a
panic "rdrNameAmbiguousFieldOcc"
selectorAmbiguousFieldOcc :: AmbiguousFieldOcc GhcTc -> Id
selectorAmbiguousFieldOcc :: AmbiguousFieldOcc GhcTc -> Id
selectorAmbiguousFieldOcc (Unambiguous sel :: XUnambiguous GhcTc
sel _) = Id
XUnambiguous GhcTc
sel
selectorAmbiguousFieldOcc (Ambiguous sel :: XAmbiguous GhcTc
sel _) = Id
XAmbiguous GhcTc
sel
selectorAmbiguousFieldOcc (XAmbiguousFieldOcc _)
= String -> Id
forall a. String -> a
panic "selectorAmbiguousFieldOcc"
unambiguousFieldOcc :: AmbiguousFieldOcc GhcTc -> FieldOcc GhcTc
unambiguousFieldOcc :: AmbiguousFieldOcc GhcTc -> FieldOcc GhcTc
unambiguousFieldOcc (Unambiguous rdr :: XUnambiguous GhcTc
rdr sel :: Located RdrName
sel) = XCFieldOcc GhcTc -> Located RdrName -> FieldOcc GhcTc
forall pass. XCFieldOcc pass -> Located RdrName -> FieldOcc pass
FieldOcc XCFieldOcc GhcTc
XUnambiguous GhcTc
rdr Located RdrName
sel
unambiguousFieldOcc (Ambiguous rdr :: XAmbiguous GhcTc
rdr sel :: Located RdrName
sel) = XCFieldOcc GhcTc -> Located RdrName -> FieldOcc GhcTc
forall pass. XCFieldOcc pass -> Located RdrName -> FieldOcc pass
FieldOcc XCFieldOcc GhcTc
XAmbiguous GhcTc
rdr Located RdrName
sel
unambiguousFieldOcc (XAmbiguousFieldOcc _) = String -> FieldOcc GhcTc
forall a. String -> a
panic "unambiguousFieldOcc"
ambiguousFieldOcc :: FieldOcc GhcTc -> AmbiguousFieldOcc GhcTc
ambiguousFieldOcc :: FieldOcc GhcTc -> AmbiguousFieldOcc GhcTc
ambiguousFieldOcc (FieldOcc sel :: XCFieldOcc GhcTc
sel rdr :: Located RdrName
rdr) = XUnambiguous GhcTc -> Located RdrName -> AmbiguousFieldOcc GhcTc
forall pass.
XUnambiguous pass -> Located RdrName -> AmbiguousFieldOcc pass
Unambiguous XCFieldOcc GhcTc
XUnambiguous GhcTc
sel Located RdrName
rdr
ambiguousFieldOcc (XFieldOcc _) = String -> AmbiguousFieldOcc GhcTc
forall a. String -> a
panic "ambiguousFieldOcc"
instance (p ~ GhcPass pass, OutputableBndrId p) => Outputable (HsType p) where
ppr :: HsType p -> SDoc
ppr ty :: HsType p
ty = HsType (GhcPass pass) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
HsType (GhcPass p) -> SDoc
pprHsType HsType p
HsType (GhcPass pass)
ty
instance Outputable HsTyLit where
ppr :: HsTyLit -> SDoc
ppr = HsTyLit -> SDoc
ppr_tylit
instance (p ~ GhcPass pass, OutputableBndrId p)
=> Outputable (LHsQTyVars p) where
ppr :: LHsQTyVars p -> SDoc
ppr (HsQTvs { hsq_explicit :: forall pass. LHsQTyVars pass -> [LHsTyVarBndr pass]
hsq_explicit = [LHsTyVarBndr p]
tvs }) = [LHsTyVarBndr p] -> SDoc
forall a. Outputable a => [a] -> SDoc
interppSP [LHsTyVarBndr p]
tvs
ppr (XLHsQTyVars x :: XXLHsQTyVars p
x) = NoExt -> SDoc
forall a. Outputable a => a -> SDoc
ppr XXLHsQTyVars p
NoExt
x
instance (p ~ GhcPass pass, OutputableBndrId p)
=> Outputable (HsTyVarBndr p) where
ppr :: HsTyVarBndr p -> SDoc
ppr (UserTyVar _ n :: Located (IdP p)
n) = Located (IdP (GhcPass pass)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (IdP p)
Located (IdP (GhcPass pass))
n
ppr (KindedTyVar _ n :: Located (IdP p)
n k :: LHsKind p
k) = SDoc -> SDoc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
hsep [Located (IdP (GhcPass pass)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (IdP p)
Located (IdP (GhcPass pass))
n, SDoc
dcolon, LHsKind p -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsKind p
k]
ppr (XTyVarBndr n :: XXTyVarBndr p
n) = NoExt -> SDoc
forall a. Outputable a => a -> SDoc
ppr XXTyVarBndr p
NoExt
n
instance (p ~ GhcPass pass,Outputable thing)
=> Outputable (HsImplicitBndrs p thing) where
ppr :: HsImplicitBndrs p thing -> SDoc
ppr (HsIB { hsib_body :: forall pass thing. HsImplicitBndrs pass thing -> thing
hsib_body = thing
ty }) = thing -> SDoc
forall a. Outputable a => a -> SDoc
ppr thing
ty
ppr (XHsImplicitBndrs x :: XXHsImplicitBndrs p thing
x) = NoExt -> SDoc
forall a. Outputable a => a -> SDoc
ppr XXHsImplicitBndrs p thing
NoExt
x
instance (p ~ GhcPass pass,Outputable thing)
=> Outputable (HsWildCardBndrs p thing) where
ppr :: HsWildCardBndrs p thing -> SDoc
ppr (HsWC { hswc_body :: forall pass thing. HsWildCardBndrs pass thing -> thing
hswc_body = thing
ty }) = thing -> SDoc
forall a. Outputable a => a -> SDoc
ppr thing
ty
ppr (XHsWildCardBndrs x :: XXHsWildCardBndrs p thing
x) = NoExt -> SDoc
forall a. Outputable a => a -> SDoc
ppr XXHsWildCardBndrs p thing
NoExt
x
pprAnonWildCard :: SDoc
pprAnonWildCard :: SDoc
pprAnonWildCard = Char -> SDoc
char '_'
pprHsForAll :: (OutputableBndrId (GhcPass p))
=> [LHsTyVarBndr (GhcPass p)] -> LHsContext (GhcPass p) -> SDoc
pprHsForAll :: [LHsTyVarBndr (GhcPass p)] -> LHsContext (GhcPass p) -> SDoc
pprHsForAll = Maybe SrcSpan
-> [LHsTyVarBndr (GhcPass p)] -> LHsContext (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
Maybe SrcSpan
-> [LHsTyVarBndr (GhcPass p)] -> LHsContext (GhcPass p) -> SDoc
pprHsForAllExtra Maybe SrcSpan
forall a. Maybe a
Nothing
pprHsForAllExtra :: (OutputableBndrId (GhcPass p))
=> Maybe SrcSpan -> [LHsTyVarBndr (GhcPass p)]
-> LHsContext (GhcPass p) -> SDoc
extra :: Maybe SrcSpan
extra qtvs :: [LHsTyVarBndr (GhcPass p)]
qtvs cxt :: LHsContext (GhcPass p)
cxt
= SDoc
pp_forall SDoc -> SDoc -> SDoc
<+> Bool -> LHsContext (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
Bool -> LHsContext (GhcPass p) -> SDoc
pprLHsContextExtra (Maybe SrcSpan -> Bool
forall a. Maybe a -> Bool
isJust Maybe SrcSpan
extra) LHsContext (GhcPass p)
cxt
where
pp_forall :: SDoc
pp_forall | [LHsTyVarBndr (GhcPass p)] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [LHsTyVarBndr (GhcPass p)]
qtvs = SDoc -> SDoc
whenPprDebug (SDoc
forAllLit SDoc -> SDoc -> SDoc
<> SDoc
dot)
| Bool
otherwise = SDoc
forAllLit SDoc -> SDoc -> SDoc
<+> [LHsTyVarBndr (GhcPass p)] -> SDoc
forall a. Outputable a => [a] -> SDoc
interppSP [LHsTyVarBndr (GhcPass p)]
qtvs SDoc -> SDoc -> SDoc
<> SDoc
dot
pprHsExplicitForAll :: (OutputableBndrId (GhcPass p))
=> Maybe [LHsTyVarBndr (GhcPass p)] -> SDoc
pprHsExplicitForAll :: Maybe [LHsTyVarBndr (GhcPass p)] -> SDoc
pprHsExplicitForAll (Just qtvs :: [LHsTyVarBndr (GhcPass p)]
qtvs) = SDoc
forAllLit SDoc -> SDoc -> SDoc
<+> [LHsTyVarBndr (GhcPass p)] -> SDoc
forall a. Outputable a => [a] -> SDoc
interppSP [LHsTyVarBndr (GhcPass p)]
qtvs SDoc -> SDoc -> SDoc
<> SDoc
dot
pprHsExplicitForAll Nothing = SDoc
empty
pprLHsContext :: (OutputableBndrId (GhcPass p))
=> LHsContext (GhcPass p) -> SDoc
pprLHsContext :: LHsContext (GhcPass p) -> SDoc
pprLHsContext lctxt :: LHsContext (GhcPass p)
lctxt
| [LHsType (GhcPass p)] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (LHsContext (GhcPass p) -> SrcSpanLess (LHsContext (GhcPass p))
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc LHsContext (GhcPass p)
lctxt) = SDoc
empty
| Bool
otherwise = LHsContext (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsContext (GhcPass p) -> SDoc
pprLHsContextAlways LHsContext (GhcPass p)
lctxt
pprLHsContextAlways :: (OutputableBndrId (GhcPass p))
=> LHsContext (GhcPass p) -> SDoc
pprLHsContextAlways :: LHsContext (GhcPass p) -> SDoc
pprLHsContextAlways (L _ ctxt :: HsContext (GhcPass p)
ctxt)
= case HsContext (GhcPass p)
ctxt of
[] -> SDoc -> SDoc
parens SDoc
empty SDoc -> SDoc -> SDoc
<+> SDoc
darrow
[L _ ty :: HsType (GhcPass p)
ty] -> HsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
HsType (GhcPass p) -> SDoc
ppr_mono_ty HsType (GhcPass p)
ty SDoc -> SDoc -> SDoc
<+> SDoc
darrow
_ -> SDoc -> SDoc
parens (HsContext (GhcPass p) -> SDoc
forall a. Outputable a => [a] -> SDoc
interpp'SP HsContext (GhcPass p)
ctxt) SDoc -> SDoc -> SDoc
<+> SDoc
darrow
pprLHsContextExtra :: (OutputableBndrId (GhcPass p))
=> Bool -> LHsContext (GhcPass p) -> SDoc
show_extra :: Bool
show_extra lctxt :: LHsContext (GhcPass p)
lctxt@(L _ ctxt :: HsContext (GhcPass p)
ctxt)
| Bool -> Bool
not Bool
show_extra = LHsContext (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsContext (GhcPass p) -> SDoc
pprLHsContext LHsContext (GhcPass p)
lctxt
| HsContext (GhcPass p) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null HsContext (GhcPass p)
ctxt = Char -> SDoc
char '_' SDoc -> SDoc -> SDoc
<+> SDoc
darrow
| Bool
otherwise = SDoc -> SDoc
parens ([SDoc] -> SDoc
sep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma [SDoc]
ctxt')) SDoc -> SDoc -> SDoc
<+> SDoc
darrow
where
ctxt' :: [SDoc]
ctxt' = (LHsType (GhcPass p) -> SDoc) -> HsContext (GhcPass p) -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map LHsType (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsContext (GhcPass p)
ctxt [SDoc] -> [SDoc] -> [SDoc]
forall a. [a] -> [a] -> [a]
++ [Char -> SDoc
char '_']
pprConDeclFields :: (OutputableBndrId (GhcPass p))
=> [LConDeclField (GhcPass p)] -> SDoc
pprConDeclFields :: [LConDeclField (GhcPass p)] -> SDoc
pprConDeclFields fields :: [LConDeclField (GhcPass p)]
fields = SDoc -> SDoc
braces ([SDoc] -> SDoc
sep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((LConDeclField (GhcPass p) -> SDoc)
-> [LConDeclField (GhcPass p)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map LConDeclField (GhcPass p) -> SDoc
forall (pass :: Pass) l.
(OutputableBndr (IdP (GhcPass (NoGhcTcPass pass))),
OutputableBndr (NameOrRdrName (IdP (GhcPass (NoGhcTcPass pass)))),
OutputableBndr (IdP (GhcPass pass)),
OutputableBndr (NameOrRdrName (IdP (GhcPass pass))),
Outputable (XIPBinds (GhcPass pass)),
Outputable (XViaStrategy (GhcPass pass)),
Outputable (XIPBinds (GhcPass (NoGhcTcPass pass))),
Outputable (XViaStrategy (GhcPass (NoGhcTcPass pass))),
NoGhcTcPass pass ~ NoGhcTcPass (NoGhcTcPass pass)) =>
GenLocated l (ConDeclField (GhcPass pass)) -> SDoc
ppr_fld [LConDeclField (GhcPass p)]
fields)))
where
ppr_fld :: GenLocated l (ConDeclField (GhcPass pass)) -> SDoc
ppr_fld (L _ (ConDeclField { cd_fld_names :: forall pass. ConDeclField pass -> [LFieldOcc pass]
cd_fld_names = [LFieldOcc (GhcPass pass)]
ns, cd_fld_type :: forall pass. ConDeclField pass -> LBangType pass
cd_fld_type = LBangType (GhcPass pass)
ty,
cd_fld_doc :: forall pass. ConDeclField pass -> Maybe LHsDocString
cd_fld_doc = Maybe LHsDocString
doc }))
= [LFieldOcc (GhcPass pass)] -> SDoc
forall a. Outputable a => [a] -> SDoc
ppr_names [LFieldOcc (GhcPass pass)]
ns SDoc -> SDoc -> SDoc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
<+> LBangType (GhcPass pass) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LBangType (GhcPass pass)
ty SDoc -> SDoc -> SDoc
<+> Maybe LHsDocString -> SDoc
ppr_mbDoc Maybe LHsDocString
doc
ppr_fld (L _ (XConDeclField x :: XXConDeclField (GhcPass pass)
x)) = NoExt -> SDoc
forall a. Outputable a => a -> SDoc
ppr XXConDeclField (GhcPass pass)
NoExt
x
ppr_names :: [a] -> SDoc
ppr_names [n :: a
n] = a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
n
ppr_names ns :: [a]
ns = [SDoc] -> SDoc
sep (SDoc -> [SDoc] -> [SDoc]
punctuate SDoc
comma ((a -> SDoc) -> [a] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map a -> SDoc
forall a. Outputable a => a -> SDoc
ppr [a]
ns))
pprHsType :: (OutputableBndrId (GhcPass p)) => HsType (GhcPass p) -> SDoc
pprHsType :: HsType (GhcPass p) -> SDoc
pprHsType ty :: HsType (GhcPass p)
ty = HsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
HsType (GhcPass p) -> SDoc
ppr_mono_ty HsType (GhcPass p)
ty
ppr_mono_lty :: (OutputableBndrId (GhcPass p)) => LHsType (GhcPass p) -> SDoc
ppr_mono_lty :: LHsType (GhcPass p) -> SDoc
ppr_mono_lty ty :: LHsType (GhcPass p)
ty = HsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
HsType (GhcPass p) -> SDoc
ppr_mono_ty (LHsType (GhcPass p) -> SrcSpanLess (LHsType (GhcPass p))
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc LHsType (GhcPass p)
ty)
ppr_mono_ty :: (OutputableBndrId (GhcPass p)) => HsType (GhcPass p) -> SDoc
ppr_mono_ty :: HsType (GhcPass p) -> SDoc
ppr_mono_ty (HsForAllTy { hst_bndrs :: forall pass. HsType pass -> [LHsTyVarBndr pass]
hst_bndrs = [LHsTyVarBndr (GhcPass p)]
tvs, hst_body :: forall pass. HsType pass -> LHsType pass
hst_body = LHsType (GhcPass p)
ty })
= [SDoc] -> SDoc
sep [[LHsTyVarBndr (GhcPass p)] -> LHsContext (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
[LHsTyVarBndr (GhcPass p)] -> LHsContext (GhcPass p) -> SDoc
pprHsForAll [LHsTyVarBndr (GhcPass p)]
tvs LHsContext (GhcPass p)
forall pass. LHsContext pass
noLHsContext, LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty]
ppr_mono_ty (HsQualTy { hst_ctxt :: forall pass. HsType pass -> LHsContext pass
hst_ctxt = LHsContext (GhcPass p)
ctxt, hst_body :: forall pass. HsType pass -> LHsType pass
hst_body = LHsType (GhcPass p)
ty })
= [SDoc] -> SDoc
sep [LHsContext (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsContext (GhcPass p) -> SDoc
pprLHsContextAlways LHsContext (GhcPass p)
ctxt, LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty]
ppr_mono_ty (HsBangTy _ b :: HsSrcBang
b ty :: LHsType (GhcPass p)
ty) = HsSrcBang -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsSrcBang
b SDoc -> SDoc -> SDoc
<> LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty
ppr_mono_ty (HsRecTy _ flds :: [LConDeclField (GhcPass p)]
flds) = [LConDeclField (GhcPass p)] -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
[LConDeclField (GhcPass p)] -> SDoc
pprConDeclFields [LConDeclField (GhcPass p)]
flds
ppr_mono_ty (HsTyVar _ prom :: PromotionFlag
prom (L _ name :: IdP (GhcPass p)
name))
| PromotionFlag -> Bool
isPromoted PromotionFlag
prom = SDoc -> SDoc
quote (IdP (GhcPass p) -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc IdP (GhcPass p)
name)
| Bool
otherwise = IdP (GhcPass p) -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc IdP (GhcPass p)
name
ppr_mono_ty (HsFunTy _ ty1 :: LHsType (GhcPass p)
ty1 ty2 :: LHsType (GhcPass p)
ty2) = LHsType (GhcPass p) -> LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> LHsType (GhcPass p) -> SDoc
ppr_fun_ty LHsType (GhcPass p)
ty1 LHsType (GhcPass p)
ty2
ppr_mono_ty (HsTupleTy _ con :: HsTupleSort
con tys :: [LHsType (GhcPass p)]
tys) = TupleSort -> SDoc -> SDoc
tupleParens TupleSort
std_con ((LHsType (GhcPass p) -> SDoc) -> [LHsType (GhcPass p)] -> SDoc
forall a. (a -> SDoc) -> [a] -> SDoc
pprWithCommas LHsType (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr [LHsType (GhcPass p)]
tys)
where std_con :: TupleSort
std_con = case HsTupleSort
con of
HsUnboxedTuple -> TupleSort
UnboxedTuple
_ -> TupleSort
BoxedTuple
ppr_mono_ty (HsSumTy _ tys :: [LHsType (GhcPass p)]
tys)
= TupleSort -> SDoc -> SDoc
tupleParens TupleSort
UnboxedTuple ((LHsType (GhcPass p) -> SDoc) -> [LHsType (GhcPass p)] -> SDoc
forall a. (a -> SDoc) -> [a] -> SDoc
pprWithBars LHsType (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr [LHsType (GhcPass p)]
tys)
ppr_mono_ty (HsKindSig _ ty :: LHsType (GhcPass p)
ty kind :: LHsType (GhcPass p)
kind)
= LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty SDoc -> SDoc -> SDoc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
<+> LHsType (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsType (GhcPass p)
kind
ppr_mono_ty (HsListTy _ ty :: LHsType (GhcPass p)
ty) = SDoc -> SDoc
brackets (LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty)
ppr_mono_ty (HsIParamTy _ n :: Located HsIPName
n ty :: LHsType (GhcPass p)
ty) = (Located HsIPName -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located HsIPName
n SDoc -> SDoc -> SDoc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
<+> LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty)
ppr_mono_ty (HsSpliceTy _ s :: HsSplice (GhcPass p)
s) = HsSplice (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
HsSplice (GhcPass p) -> SDoc
pprSplice HsSplice (GhcPass p)
s
ppr_mono_ty (HsExplicitListTy _ prom :: PromotionFlag
prom tys :: [LHsType (GhcPass p)]
tys)
| PromotionFlag -> Bool
isPromoted PromotionFlag
prom = SDoc -> SDoc
quote (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> SDoc
brackets ([LHsType (GhcPass p)] -> SDoc -> SDoc
forall pass. [LHsType pass] -> SDoc -> SDoc
maybeAddSpace [LHsType (GhcPass p)]
tys (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ [LHsType (GhcPass p)] -> SDoc
forall a. Outputable a => [a] -> SDoc
interpp'SP [LHsType (GhcPass p)]
tys)
| Bool
otherwise = SDoc -> SDoc
brackets ([LHsType (GhcPass p)] -> SDoc
forall a. Outputable a => [a] -> SDoc
interpp'SP [LHsType (GhcPass p)]
tys)
ppr_mono_ty (HsExplicitTupleTy _ tys :: [LHsType (GhcPass p)]
tys)
= SDoc -> SDoc
quote (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> SDoc
parens ([LHsType (GhcPass p)] -> SDoc -> SDoc
forall pass. [LHsType pass] -> SDoc -> SDoc
maybeAddSpace [LHsType (GhcPass p)]
tys (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ [LHsType (GhcPass p)] -> SDoc
forall a. Outputable a => [a] -> SDoc
interpp'SP [LHsType (GhcPass p)]
tys)
ppr_mono_ty (HsTyLit _ t :: HsTyLit
t) = HsTyLit -> SDoc
ppr_tylit HsTyLit
t
ppr_mono_ty (HsWildCardTy {}) = Char -> SDoc
char '_'
ppr_mono_ty (HsStarTy _ isUni :: Bool
isUni) = Char -> SDoc
char (if Bool
isUni then '★' else '*')
ppr_mono_ty (HsAppTy _ fun_ty :: LHsType (GhcPass p)
fun_ty arg_ty :: LHsType (GhcPass p)
arg_ty)
= [SDoc] -> SDoc
hsep [LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
fun_ty, LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
arg_ty]
ppr_mono_ty (HsAppKindTy _ ty :: LHsType (GhcPass p)
ty k :: LHsType (GhcPass p)
k)
= LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty SDoc -> SDoc -> SDoc
<+> Char -> SDoc
char '@' SDoc -> SDoc -> SDoc
<> LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
k
ppr_mono_ty (HsOpTy _ ty1 :: LHsType (GhcPass p)
ty1 (L _ op :: IdP (GhcPass p)
op) ty2 :: LHsType (GhcPass p)
ty2)
= [SDoc] -> SDoc
sep [ LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty1
, [SDoc] -> SDoc
sep [IdP (GhcPass p) -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprInfixOcc IdP (GhcPass p)
op, LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty2 ] ]
ppr_mono_ty (HsParTy _ ty :: LHsType (GhcPass p)
ty)
= SDoc -> SDoc
parens (LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty)
ppr_mono_ty (HsDocTy _ ty :: LHsType (GhcPass p)
ty doc :: LHsDocString
doc)
= LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty SDoc -> SDoc -> SDoc
<+> HsDocString -> SDoc
forall a. Outputable a => a -> SDoc
ppr (LHsDocString -> SrcSpanLess LHsDocString
forall a. HasSrcSpan a => a -> SrcSpanLess a
unLoc LHsDocString
doc)
ppr_mono_ty (XHsType t :: XXType (GhcPass p)
t) = NewHsTypeX -> SDoc
forall a. Outputable a => a -> SDoc
ppr XXType (GhcPass p)
NewHsTypeX
t
ppr_fun_ty :: (OutputableBndrId (GhcPass p))
=> LHsType (GhcPass p) -> LHsType (GhcPass p) -> SDoc
ppr_fun_ty :: LHsType (GhcPass p) -> LHsType (GhcPass p) -> SDoc
ppr_fun_ty ty1 :: LHsType (GhcPass p)
ty1 ty2 :: LHsType (GhcPass p)
ty2
= let p1 :: SDoc
p1 = LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty1
p2 :: SDoc
p2 = LHsType (GhcPass p) -> SDoc
forall (p :: Pass).
OutputableBndrId (GhcPass p) =>
LHsType (GhcPass p) -> SDoc
ppr_mono_lty LHsType (GhcPass p)
ty2
in
[SDoc] -> SDoc
sep [SDoc
p1, SDoc
arrow SDoc -> SDoc -> SDoc
<+> SDoc
p2]
ppr_tylit :: HsTyLit -> SDoc
ppr_tylit :: HsTyLit -> SDoc
ppr_tylit (HsNumTy _ i :: Integer
i) = Integer -> SDoc
integer Integer
i
ppr_tylit (HsStrTy _ s :: FastString
s) = String -> SDoc
text (FastString -> String
forall a. Show a => a -> String
show FastString
s)
hsTypeNeedsParens :: PprPrec -> HsType pass -> Bool
hsTypeNeedsParens :: PprPrec -> HsType pass -> Bool
hsTypeNeedsParens p :: PprPrec
p = HsType pass -> Bool
go
where
go :: HsType pass -> Bool
go (HsForAllTy{}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
funPrec
go (HsQualTy{}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
funPrec
go (HsBangTy{}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
> PprPrec
topPrec
go (HsRecTy{}) = Bool
False
go (HsTyVar{}) = Bool
False
go (HsFunTy{}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
funPrec
go (HsTupleTy{}) = Bool
False
go (HsSumTy{}) = Bool
False
go (HsKindSig{}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
sigPrec
go (HsListTy{}) = Bool
False
go (HsIParamTy{}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
> PprPrec
topPrec
go (HsSpliceTy{}) = Bool
False
go (HsExplicitListTy{}) = Bool
False
go (HsExplicitTupleTy{}) = Bool
False
go (HsTyLit{}) = Bool
False
go (HsWildCardTy{}) = Bool
False
go (HsStarTy{}) = Bool
False
go (HsAppTy{}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
appPrec
go (HsAppKindTy{}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
appPrec
go (HsOpTy{}) = PprPrec
p PprPrec -> PprPrec -> Bool
forall a. Ord a => a -> a -> Bool
>= PprPrec
opPrec
go (HsParTy{}) = Bool
False
go (HsDocTy _ (L _ t :: HsType pass
t) _) = HsType pass -> Bool
go HsType pass
t
go (XHsType{}) = Bool
False
maybeAddSpace :: [LHsType pass] -> SDoc -> SDoc
maybeAddSpace :: [LHsType pass] -> SDoc -> SDoc
maybeAddSpace tys :: [LHsType pass]
tys doc :: SDoc
doc
| (ty :: LHsType pass
ty : _) <- [LHsType pass]
tys
, LHsType pass -> Bool
forall pass. LHsType pass -> Bool
lhsTypeHasLeadingPromotionQuote LHsType pass
ty = SDoc
space SDoc -> SDoc -> SDoc
<> SDoc
doc
| Bool
otherwise = SDoc
doc
lhsTypeHasLeadingPromotionQuote :: LHsType pass -> Bool
lhsTypeHasLeadingPromotionQuote :: LHsType pass -> Bool
lhsTypeHasLeadingPromotionQuote ty :: LHsType pass
ty
= LHsType pass -> Bool
forall pass. LHsType pass -> Bool
goL LHsType pass
ty
where
goL :: GenLocated SrcSpan (HsType pass) -> Bool
goL (L _ ty :: HsType pass
ty) = HsType pass -> Bool
go HsType pass
ty
go :: HsType pass -> Bool
go (HsForAllTy{}) = Bool
False
go (HsQualTy{ hst_ctxt :: forall pass. HsType pass -> LHsContext pass
hst_ctxt = LHsContext pass
ctxt, hst_body :: forall pass. HsType pass -> LHsType pass
hst_body = GenLocated SrcSpan (HsType pass)
body})
| L _ (c :: GenLocated SrcSpan (HsType pass)
c:_) <- LHsContext pass
ctxt = GenLocated SrcSpan (HsType pass) -> Bool
goL GenLocated SrcSpan (HsType pass)
c
| Bool
otherwise = GenLocated SrcSpan (HsType pass) -> Bool
goL GenLocated SrcSpan (HsType pass)
body
go (HsBangTy{}) = Bool
False
go (HsRecTy{}) = Bool
False
go (HsTyVar _ p :: PromotionFlag
p _) = PromotionFlag -> Bool
isPromoted PromotionFlag
p
go (HsFunTy _ arg :: GenLocated SrcSpan (HsType pass)
arg _) = GenLocated SrcSpan (HsType pass) -> Bool
goL GenLocated SrcSpan (HsType pass)
arg
go (HsListTy{}) = Bool
False
go (HsTupleTy{}) = Bool
False
go (HsSumTy{}) = Bool
False
go (HsOpTy _ t1 :: GenLocated SrcSpan (HsType pass)
t1 _ _) = GenLocated SrcSpan (HsType pass) -> Bool
goL GenLocated SrcSpan (HsType pass)
t1
go (HsKindSig _ t :: GenLocated SrcSpan (HsType pass)
t _) = GenLocated SrcSpan (HsType pass) -> Bool
goL GenLocated SrcSpan (HsType pass)
t
go (HsIParamTy{}) = Bool
False
go (HsSpliceTy{}) = Bool
False
go (HsExplicitListTy _ p :: PromotionFlag
p _) = PromotionFlag -> Bool
isPromoted PromotionFlag
p
go (HsExplicitTupleTy{}) = Bool
True
go (HsTyLit{}) = Bool
False
go (HsWildCardTy{}) = Bool
False
go (HsStarTy{}) = Bool
False
go (HsAppTy _ t :: GenLocated SrcSpan (HsType pass)
t _) = GenLocated SrcSpan (HsType pass) -> Bool
goL GenLocated SrcSpan (HsType pass)
t
go (HsAppKindTy _ t :: GenLocated SrcSpan (HsType pass)
t _) = GenLocated SrcSpan (HsType pass) -> Bool
goL GenLocated SrcSpan (HsType pass)
t
go (HsParTy{}) = Bool
False
go (HsDocTy _ t :: GenLocated SrcSpan (HsType pass)
t _) = GenLocated SrcSpan (HsType pass) -> Bool
goL GenLocated SrcSpan (HsType pass)
t
go (XHsType{}) = Bool
False
parenthesizeHsType :: PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType :: PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType p :: PprPrec
p lty :: LHsType (GhcPass p)
lty@(L loc :: SrcSpan
loc ty :: HsType (GhcPass p)
ty)
| PprPrec -> HsType (GhcPass p) -> Bool
forall pass. PprPrec -> HsType pass -> Bool
hsTypeNeedsParens PprPrec
p HsType (GhcPass p)
ty = SrcSpan -> HsType (GhcPass p) -> LHsType (GhcPass p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc (XParTy (GhcPass p) -> LHsType (GhcPass p) -> HsType (GhcPass p)
forall pass. XParTy pass -> LHsType pass -> HsType pass
HsParTy XParTy (GhcPass p)
NoExt
NoExt LHsType (GhcPass p)
lty)
| Bool
otherwise = LHsType (GhcPass p)
lty
parenthesizeHsContext :: PprPrec
-> LHsContext (GhcPass p) -> LHsContext (GhcPass p)
parenthesizeHsContext :: PprPrec -> LHsContext (GhcPass p) -> LHsContext (GhcPass p)
parenthesizeHsContext p :: PprPrec
p lctxt :: LHsContext (GhcPass p)
lctxt@(L loc :: SrcSpan
loc ctxt :: HsContext (GhcPass p)
ctxt) =
case HsContext (GhcPass p)
ctxt of
[c :: LHsType (GhcPass p)
c] -> SrcSpan -> HsContext (GhcPass p) -> LHsContext (GhcPass p)
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc [PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
forall (p :: Pass).
PprPrec -> LHsType (GhcPass p) -> LHsType (GhcPass p)
parenthesizeHsType PprPrec
p LHsType (GhcPass p)
c]
_ -> LHsContext (GhcPass p)
lctxt