Commit 371dadfb authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

Break up TyCoRep

This breaks up the monstrous TyCoReps module into several new modules by
topic:

 * TyCoRep: Contains the `Coercion`, `Type`, and related type
   definitions and a few simple predicates but nothing further

 * TyCoPpr: Contains the the pretty-printer logic

 * TyCoFVs: Contains the free variable computations (and
   `tyConAppNeedsKindSig`, although I suspect this should change)

 * TyCoSubst: Contains the substitution logic for types and coercions

 * TyCoTidy: Contains the tidying logic for types

While we are able to eliminate a good number of `SOURCE` imports (and
make a few others smaller) with this change, we must introduce one new
`hs-boot` file for `TyCoPpr` so that `TyCoRep` can define `Outputable`
instances for the types it defines.

Metric Increase:
    haddock.Cabal
    haddock.compiler
parent 2829f6da
......@@ -89,7 +89,8 @@ module Var (
import GhcPrelude
import {-# SOURCE #-} TyCoRep( Type, Kind, pprKind )
import {-# SOURCE #-} TyCoRep( Type, Kind )
import {-# SOURCE #-} TyCoPpr( pprKind )
import {-# SOURCE #-} TcType( TcTyVarDetails, pprTcTyVarDetails, vanillaSkolemTv )
import {-# SOURCE #-} IdInfo( IdDetails, IdInfo, coVarDetails, isCoVarDetails,
vanillaIdInfo, pprIdDetails )
......
......@@ -72,6 +72,7 @@ import VarSet
import Var
import Type
import TyCoRep
import TyCoFVs
import TyCon
import CoAxiom
import FamInstEnv
......
......@@ -49,6 +49,8 @@ import Kind
import Type
import RepType
import TyCoRep -- checks validity of types/coercions
import TyCoSubst
import TyCoFVs
import TyCon
import CoAxiom
import BasicTypes
......@@ -1051,7 +1053,7 @@ lintTyApp fun_ty arg_ty
; in_scope <- getInScope
-- substTy needs the set of tyvars in scope to avoid generating
-- uniques that are already in scope.
-- See Note [The substitution invariant] in TyCoRep
-- See Note [The substitution invariant] in TyCoSubst
; return (substTyWithInScope in_scope [tv] [arg_ty] body_ty) }
| otherwise
......@@ -1495,7 +1497,7 @@ lint_app :: SDoc -> LintedKind -> [(LintedType,LintedKind)] -> LintM Kind
lint_app doc kfn kas
= do { in_scope <- getInScope
-- We need the in_scope set to satisfy the invariant in
-- Note [The substitution invariant] in TyCoRep
-- Note [The substitution invariant] in TyCoSubst
; foldlM (go_app in_scope) kfn kas }
where
fail_msg extra = vcat [ hang (text "Kind application error in") 2 doc
......@@ -1717,7 +1719,7 @@ lintCoercion (ForAllCo tv1 kind_co co)
-- scope. All the free vars of `t2` and `kind_co` should
-- already be in `in_scope`, because they've been
-- linted and `tv2` has the same unique as `tv1`.
-- See Note [The substitution invariant]
-- See Note [The substitution invariant] in TyCoSubst.
unitVarEnv tv1 (TyVarTy tv2 `mkCastTy` mkSymCo kind_co)
tyr = mkInvForAllTy tv2 $
substTy subst t2
......@@ -1748,7 +1750,7 @@ lintCoercion (ForAllCo cv1 kind_co co)
-- scope. All the free vars of `t2` and `kind_co` should
-- already be in `in_scope`, because they've been
-- linted and `cv2` has the same unique as `cv1`.
-- See Note [The substitution invariant]
-- See Note [The substitution invariant] in TyCoSubst.
unitVarEnv cv1 (eta1 `mkTransCo` (mkCoVarCo cv2)
`mkTransCo` (mkSymCo eta2))
tyr = mkTyCoInvForAllTy cv2 $
......
......@@ -79,9 +79,9 @@ import Data.List
--
-- Some invariants apply to how you use the substitution:
--
-- 1. Note [The substitution invariant] in TyCoRep
-- 1. Note [The substitution invariant] in TyCoSubst
--
-- 2. Note [Substitutions apply only once] in TyCoRep
-- 2. Note [Substitutions apply only once] in TyCoSubst
data Subst
= Subst InScopeSet -- Variables in in scope (both Ids and TyVars) /after/
-- applying the substitution
......@@ -89,7 +89,7 @@ data Subst
TvSubstEnv -- Substitution from TyVars to Types
CvSubstEnv -- Substitution from CoVars to Coercions
-- INVARIANT 1: See TyCoRep Note [The substitution invariant]
-- INVARIANT 1: See TyCoSubst Note [The substitution invariant]
-- This is what lets us deal with name capture properly
-- It's a hard invariant to check...
--
......@@ -104,7 +104,7 @@ Note [Extending the Subst]
For a core Subst, which binds Ids as well, we make a different choice for Ids
than we do for TyVars.
For TyVars, see Note [Extending the TCvSubst] with Type.TvSubstEnv
For TyVars, see Note [Extending the TCvSubst] in TyCoSubst.
For Ids, we have a different invariant
The IdSubstEnv is extended *only* when the Unique on an Id changes
......@@ -171,7 +171,7 @@ mkEmptySubst in_scope = Subst in_scope emptyVarEnv emptyVarEnv emptyVarEnv
mkSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> IdSubstEnv -> Subst
mkSubst in_scope tvs cvs ids = Subst in_scope ids tvs cvs
-- | Find the in-scope set: see TyCoRep Note [The substitution invariant]
-- | Find the in-scope set: see TyCoSubst Note [The substitution invariant]
substInScope :: Subst -> InScopeSet
substInScope (Subst in_scope _ _ _) = in_scope
......@@ -181,7 +181,7 @@ zapSubstEnv :: Subst -> Subst
zapSubstEnv (Subst in_scope _ _ _) = Subst in_scope emptyVarEnv emptyVarEnv emptyVarEnv
-- | Add a substitution for an 'Id' to the 'Subst': you must ensure that the in-scope set is
-- such that TyCoRep Note [The substitution invariant]
-- such that TyCoSubst Note [The substitution invariant]
-- holds after extending the substitution like this
extendIdSubst :: Subst -> Id -> CoreExpr -> Subst
-- ToDo: add an ASSERT that fvs(subst-result) is already in the in-scope set
......@@ -198,7 +198,7 @@ extendIdSubstList (Subst in_scope ids tvs cvs) prs
-- | Add a substitution for a 'TyVar' to the 'Subst'
-- The 'TyVar' *must* be a real TyVar, and not a CoVar
-- You must ensure that the in-scope set is such that
-- TyCoRep Note [The substitution invariant] holds
-- TyCoSubst Note [The substitution invariant] holds
-- after extending the substitution like this.
extendTvSubst :: Subst -> TyVar -> Type -> Subst
extendTvSubst (Subst in_scope ids tvs cvs) tv ty
......@@ -214,7 +214,7 @@ extendTvSubstList subst vrs
-- | Add a substitution from a 'CoVar' to a 'Coercion' to the 'Subst':
-- you must ensure that the in-scope set satisfies
-- TyCoRep Note [The substitution invariant]
-- TyCoSubst Note [The substitution invariant]
-- after extending the substitution like this
extendCvSubst :: Subst -> CoVar -> Coercion -> Subst
extendCvSubst (Subst in_scope ids tvs cvs) v r
......@@ -339,7 +339,7 @@ instance Outputable Subst where
-- | Apply a substitution to an entire 'CoreExpr'. Remember, you may only
-- apply the substitution /once/:
-- see Note [Substitutions apply only once] in TyCoRep
-- See Note [Substitutions apply only once] in TyCoSubst
--
-- Do *not* attempt to short-cut in the case of an empty substitution!
-- See Note [Extending the Subst]
......
......@@ -547,6 +547,10 @@ Library
Kind
Type
TyCoRep
TyCoFVs
TyCoSubst
TyCoPpr
TyCoTidy
Unify
Bag
Binary
......
......@@ -106,6 +106,7 @@ import TcEvidence
import RdrName
import Var
import TyCoRep
import TyCoFVs ( tyConAppNeedsKindSig )
import Type ( appTyArgFlags, splitAppTys, tyConArgFlags )
import TysWiredIn ( unitTy )
import TcType
......
......@@ -1075,7 +1075,7 @@ pprIfaceSigmaType show_forall ty
pprUserIfaceForAll :: [IfaceForAllBndr] -> SDoc
pprUserIfaceForAll tvs
= sdocWithDynFlags $ \dflags ->
-- See Note [When to print foralls]
-- See Note [When to print foralls] in this module.
ppWhen (any tv_has_kind_var tvs
|| any tv_is_required tvs
|| gopt Opt_PrintExplicitForalls dflags) $
......
......@@ -35,6 +35,7 @@ import Type
import Coercion
import CoAxiom
import TyCoRep -- needs to build types & coercions in a knot
import TyCoSubst ( substTyCoVars )
import HscTypes
import Annotations
import InstEnv
......
......@@ -68,6 +68,7 @@ import Var
import VarEnv
import VarSet
import TyCoRep
import TyCoTidy ( tidyCo )
import Demand ( isTopSig )
import Data.Maybe ( catMaybes )
......
......@@ -72,7 +72,7 @@ extendInScope :: Id -> Subst -> Subst
extendInScope id (Subst in_scope env) = Subst (in_scope `extendInScopeSet` id) env
-- | Add a substitution for an 'Id' to the 'Subst': you must ensure that the
-- in-scope set is such that TyCORep Note [The substitution invariant]
-- in-scope set is such that TyCoSubst Note [The substitution invariant]
-- holds after extending the substitution like this.
extendSubst :: Id -> Id -> Subst -> Subst
extendSubst id new_id (Subst in_scope env)
......
......@@ -56,6 +56,7 @@ import NameSet
import RdrName
import TyCon
import TyCoRep
import TyCoSubst (substTyWithInScope)
import Type
import TcEvidence
import VarSet
......
......@@ -397,7 +397,7 @@ tcCheckPatSynDecl psb@PSB{ psb_id = lname@(dL->L _ name), psb_args = details
-- satisfy the substitution invariant. There's no need to
-- add 'ex_tvs' as they are already in the domain of the
-- substitution.
-- See also Note [The substitution invariant] in TyCoRep.
-- See also Note [The substitution invariant] in TyCoSubst.
; prov_dicts <- mapM (emitWanted (ProvCtxtOrigin psb)) prov_theta'
; args' <- zipWithM (tc_arg subst) arg_names arg_tys
; return (ex_tvs', prov_dicts, args') }
......
......@@ -74,6 +74,7 @@ import TcMType
import TcHsType
import TcIface
import TyCoRep
import TyCoFVs ( tyConAppNeedsKindSig )
import FamInst
import FamInstEnv
import InstEnv
......
......@@ -196,6 +196,9 @@ import GhcPrelude
import Kind
import TyCoRep
import TyCoSubst ( mkTvSubst, substTyWithCoVars )
import TyCoFVs
import TyCoPpr ( pprParendTheta )
import Class
import Var
import ForeignCall
......
......@@ -26,7 +26,8 @@ module Class (
import GhcPrelude
import {-# SOURCE #-} TyCon ( TyCon )
import {-# SOURCE #-} TyCoRep ( Type, PredType, pprType )
import {-# SOURCE #-} TyCoRep ( Type, PredType )
import {-# SOURCE #-} TyCoPpr ( pprType )
import Var
import Name
import BasicTypes
......
......@@ -31,7 +31,8 @@ module CoAxiom (
import GhcPrelude
import {-# SOURCE #-} TyCoRep ( Type, pprType )
import {-# SOURCE #-} TyCoRep ( Type )
import {-# SOURCE #-} TyCoPpr ( pprType )
import {-# SOURCE #-} TyCon ( TyCon )
import Outputable
import FastString
......
......@@ -120,6 +120,10 @@ import GhcPrelude
import IfaceType
import TyCoRep
import TyCoFVs
import TyCoPpr
import TyCoSubst
import TyCoTidy
import Type
import TyCon
import CoAxiom
......
......@@ -10,6 +10,7 @@ import GhcPrelude
import DynFlags
import TyCoRep
import TyCoSubst
import Coercion
import Type hiding( substTyVarBndr, substTy )
import TcType ( exactTyCoVarsOfType )
......
This diff is collapsed.
-- | Pretty-printing types and coercions.
module TyCoPpr
(
-- * Pretty-printing
pprType, pprParendType, pprPrecType, pprPrecTypeX,
pprTypeApp, pprTCvBndr, pprTCvBndrs,
pprSigmaType,
pprTheta, pprParendTheta, pprForAll, pprUserForAll,
pprTyVar, pprTyVars,
pprThetaArrowTy, pprClassPred,
pprKind, pprParendKind, pprTyLit,
PprPrec(..), topPrec, sigPrec, opPrec, funPrec, appPrec, maybeParen,
pprDataCons, pprWithExplicitKindsWhen,
pprCo, pprParendCo,
debugPprType,
) where
import GhcPrelude
import {-# SOURCE #-} ToIface( toIfaceTypeX, toIfaceTyLit, toIfaceForAllBndr
, toIfaceTyCon, toIfaceTcArgs, toIfaceCoercionX )
import {-# SOURCE #-} DataCon( dataConFullSig
, dataConUserTyVarBinders
, DataCon )
import TyCon
import TyCoRep
import TyCoTidy
import TyCoFVs
import Class
import Var
import IfaceType
import VarSet
import VarEnv
import DynFlags ( gopt_set, GeneralFlag(Opt_PrintExplicitKinds) )
import Outputable
import BasicTypes ( PprPrec(..), topPrec, sigPrec, opPrec
, funPrec, appPrec, maybeParen )
{-
%************************************************************************
%* *
Pretty-printing types
Defined very early because of debug printing in assertions
%* *
%************************************************************************
@pprType@ is the standard @Type@ printer; the overloaded @ppr@ function is
defined to use this. @pprParendType@ is the same, except it puts
parens around the type, except for the atomic cases. @pprParendType@
works just by setting the initial context precedence very high.
Note that any function which pretty-prints a @Type@ first converts the @Type@
to an @IfaceType@. See Note [IfaceType and pretty-printing] in IfaceType.
See Note [Precedence in types] in BasicTypes.
-}
--------------------------------------------------------
-- When pretty-printing types, we convert to IfaceType,
-- and pretty-print that.
-- See Note [Pretty printing via IfaceSyn] in PprTyThing
--------------------------------------------------------
pprType, pprParendType :: Type -> SDoc
pprType = pprPrecType topPrec
pprParendType = pprPrecType appPrec
pprPrecType :: PprPrec -> Type -> SDoc
pprPrecType = pprPrecTypeX emptyTidyEnv
pprPrecTypeX :: TidyEnv -> PprPrec -> Type -> SDoc
pprPrecTypeX env prec ty
= getPprStyle $ \sty ->
if debugStyle sty -- Use debugPprType when in
then debug_ppr_ty prec ty -- when in debug-style
else pprPrecIfaceType prec (tidyToIfaceTypeStyX env ty sty)
-- NB: debug-style is used for -dppr-debug
-- dump-style is used for -ddump-tc-trace etc
pprTyLit :: TyLit -> SDoc
pprTyLit = pprIfaceTyLit . toIfaceTyLit
pprKind, pprParendKind :: Kind -> SDoc
pprKind = pprType
pprParendKind = pprParendType
tidyToIfaceTypeStyX :: TidyEnv -> Type -> PprStyle -> IfaceType
tidyToIfaceTypeStyX env ty sty
| userStyle sty = tidyToIfaceTypeX env ty
| otherwise = toIfaceTypeX (tyCoVarsOfType ty) ty
-- in latter case, don't tidy, as we'll be printing uniques.
tidyToIfaceType :: Type -> IfaceType
tidyToIfaceType = tidyToIfaceTypeX emptyTidyEnv
tidyToIfaceTypeX :: TidyEnv -> Type -> IfaceType
-- It's vital to tidy before converting to an IfaceType
-- or nested binders will become indistinguishable!
--
-- Also for the free type variables, tell toIfaceTypeX to
-- leave them as IfaceFreeTyVar. This is super-important
-- for debug printing.
tidyToIfaceTypeX env ty = toIfaceTypeX (mkVarSet free_tcvs) (tidyType env' ty)
where
env' = tidyFreeTyCoVars env free_tcvs
free_tcvs = tyCoVarsOfTypeWellScoped ty
------------
pprCo, pprParendCo :: Coercion -> SDoc
pprCo co = getPprStyle $ \ sty -> pprIfaceCoercion (tidyToIfaceCoSty co sty)
pprParendCo co = getPprStyle $ \ sty -> pprParendIfaceCoercion (tidyToIfaceCoSty co sty)
tidyToIfaceCoSty :: Coercion -> PprStyle -> IfaceCoercion
tidyToIfaceCoSty co sty
| userStyle sty = tidyToIfaceCo co
| otherwise = toIfaceCoercionX (tyCoVarsOfCo co) co
-- in latter case, don't tidy, as we'll be printing uniques.
tidyToIfaceCo :: Coercion -> IfaceCoercion
-- It's vital to tidy before converting to an IfaceType
-- or nested binders will become indistinguishable!
--
-- Also for the free type variables, tell toIfaceCoercionX to
-- leave them as IfaceFreeCoVar. This is super-important
-- for debug printing.
tidyToIfaceCo co = toIfaceCoercionX (mkVarSet free_tcvs) (tidyCo env co)
where
env = tidyFreeTyCoVars emptyTidyEnv free_tcvs
free_tcvs = scopedSort $ tyCoVarsOfCoList co
------------
pprClassPred :: Class -> [Type] -> SDoc
pprClassPred clas tys = pprTypeApp (classTyCon clas) tys
------------
pprTheta :: ThetaType -> SDoc
pprTheta = pprIfaceContext topPrec . map tidyToIfaceType
pprParendTheta :: ThetaType -> SDoc
pprParendTheta = pprIfaceContext appPrec . map tidyToIfaceType
pprThetaArrowTy :: ThetaType -> SDoc
pprThetaArrowTy = pprIfaceContextArr . map tidyToIfaceType
------------------
pprSigmaType :: Type -> SDoc
pprSigmaType = pprIfaceSigmaType ShowForAllWhen . tidyToIfaceType
pprForAll :: [TyCoVarBinder] -> SDoc
pprForAll tvs = pprIfaceForAll (map toIfaceForAllBndr tvs)
-- | Print a user-level forall; see Note [When to print foralls] in this module.
pprUserForAll :: [TyCoVarBinder] -> SDoc
pprUserForAll = pprUserIfaceForAll . map toIfaceForAllBndr
pprTCvBndrs :: [TyCoVarBinder] -> SDoc
pprTCvBndrs tvs = sep (map pprTCvBndr tvs)
pprTCvBndr :: TyCoVarBinder -> SDoc
pprTCvBndr = pprTyVar . binderVar
pprTyVars :: [TyVar] -> SDoc
pprTyVars tvs = sep (map pprTyVar tvs)
pprTyVar :: TyVar -> SDoc
-- Print a type variable binder with its kind (but not if *)
-- Here we do not go via IfaceType, because the duplication with
-- pprIfaceTvBndr is minimal, and the loss of uniques etc in
-- debug printing is disastrous
pprTyVar tv
| isLiftedTypeKind kind = ppr tv
| otherwise = parens (ppr tv <+> dcolon <+> ppr kind)
where
kind = tyVarKind tv
-----------------
debugPprType :: Type -> SDoc
-- ^ debugPprType is a simple pretty printer that prints a type
-- without going through IfaceType. It does not format as prettily
-- as the normal route, but it's much more direct, and that can
-- be useful for debugging. E.g. with -dppr-debug it prints the
-- kind on type-variable /occurrences/ which the normal route
-- fundamentally cannot do.
debugPprType ty = debug_ppr_ty topPrec ty
debug_ppr_ty :: PprPrec -> Type -> SDoc
debug_ppr_ty _ (LitTy l)
= ppr l
debug_ppr_ty _ (TyVarTy tv)
= ppr tv -- With -dppr-debug we get (tv :: kind)
debug_ppr_ty prec (FunTy { ft_af = af, ft_arg = arg, ft_res = res })
= maybeParen prec funPrec $
sep [debug_ppr_ty funPrec arg, arrow <+> debug_ppr_ty prec res]
where
arrow = case af of
VisArg -> text "->"
InvisArg -> text "=>"
debug_ppr_ty prec (TyConApp tc tys)
| null tys = ppr tc
| otherwise = maybeParen prec appPrec $
hang (ppr tc) 2 (sep (map (debug_ppr_ty appPrec) tys))
debug_ppr_ty _ (AppTy t1 t2)
= hang (debug_ppr_ty appPrec t1) -- Print parens so we see ((a b) c)
2 (debug_ppr_ty appPrec t2) -- so that we can distinguish
-- TyConApp from AppTy
debug_ppr_ty prec (CastTy ty co)
= maybeParen prec topPrec $
hang (debug_ppr_ty topPrec ty)
2 (text "|>" <+> ppr co)
debug_ppr_ty _ (CoercionTy co)
= parens (text "CO" <+> ppr co)
debug_ppr_ty prec ty@(ForAllTy {})
| (tvs, body) <- split ty
= maybeParen prec funPrec $
hang (text "forall" <+> fsep (map ppr tvs) <> dot)
-- The (map ppr tvs) will print kind-annotated
-- tvs, because we are (usually) in debug-style
2 (ppr body)
where
split ty | ForAllTy tv ty' <- ty
, (tvs, body) <- split ty'
= (tv:tvs, body)
| otherwise
= ([], ty)
{-
Note [When to print foralls]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mostly we want to print top-level foralls when (and only when) the user specifies
-fprint-explicit-foralls. But when kind polymorphism is at work, that suppresses
too much information; see #9018.
So I'm trying out this rule: print explicit foralls if
a) User specifies -fprint-explicit-foralls, or
b) Any of the quantified type variables has a kind
that mentions a kind variable
This catches common situations, such as a type siguature
f :: m a
which means
f :: forall k. forall (m :: k->*) (a :: k). m a
We really want to see both the "forall k" and the kind signatures
on m and a. The latter comes from pprTCvBndr.
Note [Infix type variables]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
With TypeOperators you can say
f :: (a ~> b) -> b
and the (~>) is considered a type variable. However, the type
pretty-printer in this module will just see (a ~> b) as
App (App (TyVarTy "~>") (TyVarTy "a")) (TyVarTy "b")
So it'll print the type in prefix form. To avoid confusion we must
remember to parenthesise the operator, thus
(~>) a b -> b
See #2766.
-}
pprDataCons :: TyCon -> SDoc
pprDataCons = sepWithVBars . fmap pprDataConWithArgs . tyConDataCons
where
sepWithVBars [] = empty
sepWithVBars docs = sep (punctuate (space <> vbar) docs)
pprDataConWithArgs :: DataCon -> SDoc
pprDataConWithArgs dc = sep [forAllDoc, thetaDoc, ppr dc <+> argsDoc]
where
(_univ_tvs, _ex_tvs, _eq_spec, theta, arg_tys, _res_ty) = dataConFullSig dc
user_bndrs = dataConUserTyVarBinders dc
forAllDoc = pprUserForAll user_bndrs
thetaDoc = pprThetaArrowTy theta
argsDoc = hsep (fmap pprParendType arg_tys)
pprTypeApp :: TyCon -> [Type] -> SDoc
pprTypeApp tc tys
= pprIfaceTypeApp topPrec (toIfaceTyCon tc)
(toIfaceTcArgs tc tys)
-- TODO: toIfaceTcArgs seems rather wasteful here
------------------
-- | Display all kind information (with @-fprint-explicit-kinds@) when the
-- provided 'Bool' argument is 'True'.
-- See @Note [Kind arguments in error messages]@ in "TcErrors".
pprWithExplicitKindsWhen :: Bool -> SDoc -> SDoc
pprWithExplicitKindsWhen b
= updSDocDynFlags $ \dflags ->
if b then gopt_set dflags Opt_PrintExplicitKinds
else dflags
module TyCoPpr where
import {-# SOURCE #-} TyCoRep (Type, Kind, Coercion, TyLit)
import Outputable
pprType :: Type -> SDoc
pprKind :: Kind -> SDoc
pprCo :: Coercion -> SDoc
pprTyLit :: TyLit -> SDoc
This diff is collapsed.
......@@ -2,7 +2,6 @@ module TyCoRep where
import GhcPrelude
import Outputable ( SDoc )
import Data.Data ( Data )
import {-# SOURCE #-} Var( Var, ArgFlag, AnonArgFlag )
......@@ -10,7 +9,6 @@ data Type
data TyThing
data Coercion
data UnivCoProvenance
data TCvSubst
data TyLit
data TyCoBinder
data MCoercion
......@@ -21,8 +19,6 @@ type ThetaType = [PredType]
type CoercionN = Coercion
type MCoercionN = MCoercion
pprKind :: Kind -> SDoc
pprType :: Type -> SDoc
mkFunTy :: AnonArgFlag -> Type -> Type -> Type
mkForAllTy :: Var -> ArgFlag -> Type -> Type
......
This diff is collapsed.
{-# LANGUAGE BangPatterns #-}
-- | Tidying types and coercions for printing in error messages.
module TyCoTidy
(
-- * Tidying type related things up for printing
tidyType, tidyTypes,
tidyOpenType, tidyOpenTypes,
tidyOpenKind,
tidyVarBndr, tidyVarBndrs, tidyFreeTyCoVars, avoidNameClashes,
tidyOpenTyCoVar, tidyOpenTyCoVars,
tidyTyCoVarOcc,
tidyTopType,
tidyKind,
tidyCo, tidyCos,
tidyTyCoVarBinder, tidyTyCoVarBinders
) where
import GhcPrelude
import TyCoRep