LBangType, BangType, HsBang(..),
getBangType, getBangStrictness,
- mkExplicitHsForAllTy, mkImplicitHsForAllTy,
+ mkExplicitHsForAllTy, mkImplicitHsForAllTy, hsExplicitTvs,
hsTyVarName, hsTyVarNames, replaceTyVarName,
hsLTyVarName, hsLTyVarNames, hsLTyVarLocName, hsLTyVarLocNames,
splitHsInstDeclTy, splitHsFunType,
import {-# SOURCE #-} HsExpr ( HsSplice, pprSplice )
import Type ( Type )
-import Kind ( {- instance Outputable Kind -}, Kind,
+import {- Kind parts of -}
+ Type ( {- instance Outputable Kind -} Kind,
pprParendKind, pprKind, isLiftedTypeKind )
+import HsDoc ( LHsDoc, HsDoc )
import BasicTypes ( IPName, Boxity, tupleParens )
import SrcLoc ( Located(..), unLoc, noSrcSpan )
import StaticFlags ( opt_PprStyle_Debug )
| HsSpliceTy (HsSplice name)
+ | HsDocTy (LHsType name) (LHsDoc name) -- A documented type
+
data HsExplicitForAll = Explicit | Implicit
-----------------------
Implicit `plus` Implicit = Implicit
exp1 `plus` exp2 = Explicit
+hsExplicitTvs :: LHsType name -> [name]
+-- The explicitly-given forall'd type variables of a HsType
+hsExplicitTvs (L _ (HsForAllTy Explicit tvs _ _)) = hsLTyVarNames tvs
+hsExplicitTvs other = []
+
+---------------------
type LHsTyVarBndr name = Located (HsTyVarBndr name)
data HsTyVarBndr name
where
split_tau tvs cxt (HsPredTy (HsClassP cls tys)) = (tvs, cxt, cls, tys)
split_tau tvs cxt (HsParTy (L _ ty)) = split_tau tvs cxt ty
+ split_tau _ _ other = pprPanic "splitHsInstDeclTy" (ppr inst_ty)
-- Splits HsType into the (init, last) parts
-- Breaks up any parens in the result type:
-- But we still use the precedence stuff to add parens because
-- toHsType doesn't put in any HsParTys, so we may still need them
+ppr_mono_ty ctxt_prec (HsDocTy ty doc)
+ = ppr ty <+> ppr (unLoc doc)
+
--------------------------
ppr_fun_ty ctxt_prec ty1 ty2
= let p1 = ppr_mono_lty pREC_FUN ty1