[Git][ghc/ghc][wip/sand-witch/tysyn-info-ppr] Update GHCi :info type declaration printing (24459)
Andrei Borzenkov (@sand-witch)
gitlab at gitlab.haskell.org
Sat Dec 7 14:30:58 UTC 2024
Andrei Borzenkov pushed to branch wip/sand-witch/tysyn-info-ppr at Glasgow Haskell Compiler / GHC
Commits:
eb0131c1 by Andrei Borzenkov at 2024-12-07T18:30:35+04:00
Update GHCi :info type declaration printing (24459)
- Do not print result's kind in type families
because we have full kind in SAKS and we display
invisible arity using @-binders
- Do not suppress significant invisible binders
An invisible binder is considered significant when it meets at least
one of the following two criteria:
- It visibly occurs in the declaration's body
- It is followed by a significant binder,
so it affects positioning
For non-generative type declaration (type synonyms and type families)
there is one additional criteria:
- It is not followed by a visible binder, so it
affects the arity of a type synonym
See Note [Print invisible binders in interface declarations]
for more information about what is "visibly occurs"
- - - - -
25 changed files:
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Type.hs
- docs/users_guide/9.14.1-notes.rst
- docs/users_guide/ghci.rst
- testsuite/tests/backpack/should_fail/T19244a.stderr
- testsuite/tests/backpack/should_fail/T19244b.stderr
- testsuite/tests/backpack/should_fail/bkpfail46.stderr
- testsuite/tests/ghci/T18060/T18060.stdout
- testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout
- testsuite/tests/ghci/scripts/T15941.stdout
- testsuite/tests/ghci/scripts/T19310.stdout
- testsuite/tests/ghci/scripts/T21294a.stdout
- + testsuite/tests/ghci/scripts/T24459.script
- + testsuite/tests/ghci/scripts/T24459.stdout
- testsuite/tests/ghci/scripts/T8535.stdout
- testsuite/tests/ghci/scripts/T9181.stdout
- testsuite/tests/ghci/scripts/all.T
- testsuite/tests/ghci/scripts/ghci020.stdout
- testsuite/tests/ghci/should_run/T10145.stdout
- testsuite/tests/ghci/should_run/T18594.stdout
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/template-haskell-exports.stdout
- testsuite/tests/rep-poly/RepPolyBackpack3.stderr
Changes:
=====================================
compiler/GHC/Core/TyCon.hs
=====================================
@@ -24,7 +24,8 @@ module GHC.Core.TyCon(
mkRequiredTyConBinder,
mkAnonTyConBinder, mkAnonTyConBinders,
tyConBinderForAllTyFlag, tyConBndrVisForAllTyFlag, isNamedTyConBinder,
- isVisibleTyConBinder, isInvisibleTyConBinder,
+ isVisibleTyConBinder, isInvisSpecTyConBinder, isInvisibleTyConBinder,
+ isInferredTyConBinder,
isVisibleTcbVis, isInvisSpecTcbVis,
-- ** Field labels
@@ -487,7 +488,7 @@ mkRequiredTyConBinder dep_set tv
| tv `elemVarSet` dep_set = mkNamedTyConBinder Required tv
| otherwise = mkAnonTyConBinder tv
-tyConBinderForAllTyFlag :: TyConBinder -> ForAllTyFlag
+tyConBinderForAllTyFlag :: VarBndr a TyConBndrVis -> ForAllTyFlag
tyConBinderForAllTyFlag (Bndr _ vis) = tyConBndrVisForAllTyFlag vis
tyConBndrVisForAllTyFlag :: TyConBndrVis -> ForAllTyFlag
@@ -513,10 +514,22 @@ isInvisSpecTcbVis :: TyConBndrVis -> Bool
isInvisSpecTcbVis (NamedTCB Specified) = True
isInvisSpecTcbVis _ = False
+isInvisInferTcbVis :: TyConBndrVis -> Bool
+isInvisInferTcbVis (NamedTCB Inferred) = True
+isInvisInferTcbVis _ = False
+
+isInvisSpecTyConBinder :: VarBndr tv TyConBndrVis -> Bool
+-- Works for IfaceTyConBinder too
+isInvisSpecTyConBinder (Bndr _ tcb_vis) = isInvisSpecTcbVis tcb_vis
+
isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool
-- Works for IfaceTyConBinder too
isInvisibleTyConBinder tcb = not (isVisibleTyConBinder tcb)
+isInferredTyConBinder :: VarBndr var TyConBndrVis -> Bool
+-- Works for IfaceTyConBinder too
+isInferredTyConBinder (Bndr _ tcb_vis) = isInvisInferTcbVis tcb_vis
+
-- Build the 'tyConKind' from the binders and the result kind.
-- Keep in sync with 'mkTyConKind' in GHC.Iface.Type.
mkTyConKind :: [TyConBinder] -> Kind -> Kind
=====================================
compiler/GHC/Iface/Syntax.hs
=====================================
@@ -100,6 +100,7 @@ import Control.Monad
import System.IO.Unsafe
import Control.DeepSeq
import Data.Proxy
+import qualified Data.Set as Set
infixl 3 &&&
@@ -912,15 +913,167 @@ constraintIfaceKind :: IfaceKind
constraintIfaceKind =
IfaceTyConApp (IfaceTyCon constraintKindTyConName (mkIfaceTyConInfo NotPromoted IfaceNormalTyCon)) IA_Nil
+{- Note [Print invisible binders in interface declarations]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Starting from GHC 9.8 it is possible to write invisible @-binders
+in type-level declarations. That feature introduced several challenges
+in interface declaration pretty printing (:info command inside GHCi)
+to overcome.
+
+User-written invisible binders and "system" binders introduced by GHC
+are indistinctable at this stage, hence we try to print
+semantically significant binders only by default.
+
+An invisible binder is considered significant when it meets at least
+one of the following two criteria:
+ - It visibly occurs in the declaration's body (See more about that below)
+ - It is followed by a significant binder,
+ so it affects positioning
+For non-generative type declaration (type synonyms and type families)
+there is one additional criteria:
+ - It is not followed by a visible binder, so it
+ affects the arity of a type declaration
+
+Overall solution consists of three functions
+- `iface_decl_non_generative` decides whether current declaration is
+ generative or not
+
+- `iface_decl_mentioned_vars` gives a Set of variables that
+ visibly occurs in the declaration's body
+
+- `suppressIfaceInsignificantInvisibles` uses information provided
+ by the first two functions to actually filter out insignificant
+ @-binders
+
+Here is what we consider "visibly occurs" in general and for
+each declaration type:
+
+- Variables that visibly occur in IfaceType are collected by
+ `visibleTypeVarOccurencies` function.
+
+- Variables that visibly occur in IfaceAT are collected by `iface_at_mentioned_vars`
+ function. It accounts visible binders for associated data and type
+ family and invisible binders that affect arity for type families only.
+ Associated types can't have definition, so it's safe to drop all other
+ binders.
+
+- IfaceData declared using GADT syntax doesn't have visibly occured type
+ variables. This is because each constructor has its own variables, e.g.:
+
+ type D :: forall (a :: Type). Type
+ data D @a where
+ MkD :: D @b
+
+- For IfaceData declared using Haskell98 syntax variable is considered visible
+ if it's visibly occured at least in one argument's type in at least one constructor.
+
+- For IfaceSynonym variable is considered visible if it's visibly occured
+ at the RHS type.
+
+- For IfaceFamily variable is considered visible if it's occured inside
+ injectivity annotation, e.g.
+
+ type family F @a = r | r -> a
+
+- For IfaceClass variable is considered visible if it's occured at least
+ once inside functional dependency annotation or at least in one method's
+ type signature or visibly occured in at least one associated type's
+ declaration (Visible occurences in associated types are described above).
+
+- IfacePatSyn, IfaceId and IfaceAxiom are irrelevant to this problem.
+-}
+
+iface_decl_non_generative :: IfaceDecl -> Bool
+iface_decl_non_generative IfaceSynonym{} = True
+iface_decl_non_generative IfaceFamily{ifFamFlav = rhs}
+ | IfaceDataFamilyTyCon <- rhs = False
+ | otherwise = True
+iface_decl_non_generative IfaceData{} = False
+iface_decl_non_generative IfaceId{} = False
+iface_decl_non_generative IfaceClass{} = False
+iface_decl_non_generative IfaceAxiom{} = False
+iface_decl_non_generative IfacePatSyn{} = False
+
+iface_at_mentioned_vars :: IfaceAT -> Set.Set IfLclName
+iface_at_mentioned_vars (IfaceAT decl _)
+ = Set.fromList . map ifTyConBinderName . suppress_vars $ binders
+ where
+ -- ifBinders is not total, so we assume here that associated types
+ -- cannot be IfaceId, IfaceAxiom or IfacePatSyn
+ binders = case decl of
+ IfaceFamily {ifBinders} -> ifBinders
+ IfaceData{ifBinders} -> ifBinders
+ IfaceSynonym{ifBinders} -> ifBinders
+ IfaceClass{ifBinders} -> ifBinders
+ IfaceId{} -> panic "IfaceId shoudn't be an associated type!"
+ IfaceAxiom{} -> panic "IfaceAxiom shoudn't be an associated type!"
+ IfacePatSyn {} -> panic "IfacePatSyn shoudn't be an associated type!"
+
+ suppress_arity = iface_decl_non_generative decl
+
+ suppress_vars =
+ suppressIfaceInsignificantInvisibles
+ -- We need to count trailing invisibles for type families
+ (MkPrintArityInvisibles suppress_arity)
+ -- But this setting will simply count all invisibles
+ (PrintExplicitKinds False)
+ -- ...and associated types can't have RHS
+ mempty
+
+-- See Note [Print invisible binders in interface declarations]
+-- in particular parts about collecting visible occurences
+iface_decl_mentioned_vars :: IfaceDecl -> Set.Set IfLclName
+iface_decl_mentioned_vars (IfaceData { ifCons = condecls, ifGadtSyntax = gadt })
+ | gadt = mempty
+ -- Get visible occurences in each constructor in each alternative
+ | otherwise = Set.unions (map mentioned_con_vars cons)
+ where
+ mentioned_con_vars = Set.unions . map (visibleTypeVarOccurencies . snd) . ifConArgTys
+ cons = visibleIfConDecls condecls
+
+iface_decl_mentioned_vars (IfaceClass { ifFDs = fds, ifBody = IfAbstractClass })
+ = Set.unions (map fundep_names fds)
+ where
+ fundep_names fd = Set.fromList (fst fd) `Set.union` Set.fromList (snd fd)
+
+iface_decl_mentioned_vars
+ (IfaceClass { ifFDs = fds
+ , ifBody = IfConcreteClass {
+ ifATs = ats,
+ ifSigs = sigs
+ }})
+ = Set.unions
+ [ Set.unions (map fundep_names fds)
+ , Set.unions (map iface_at_mentioned_vars ats)
+ , Set.unions (map (visibleTypeVarOccurencies . class_op_type) sigs)
+ ]
+ where
+ class_op_type (IfaceClassOp _bndr ty _default) = ty
+
+ fundep_names fd = Set.fromList (fst fd) `Set.union` Set.fromList (snd fd)
+
+iface_decl_mentioned_vars (IfaceSynonym {ifSynRhs = poly_ty})
+ = visibleTypeVarOccurencies poly_ty
+
+iface_decl_mentioned_vars (IfaceFamily { ifBinders = binders, ifResVar = res_var, ifFamInj = inj })
+ | Just{} <- res_var
+ , Injective injectivity <- inj
+ = Set.fromList . map (ifTyConBinderName . snd) . filter fst $ zip injectivity binders
+ | otherwise = mempty
+
+iface_decl_mentioned_vars IfacePatSyn{} = mempty
+iface_decl_mentioned_vars IfaceId{} = mempty
+iface_decl_mentioned_vars IfaceAxiom{} = mempty
+
pprIfaceDecl :: ShowSub -> IfaceDecl -> SDoc
-- NB: pprIfaceDecl is also used for pretty-printing TyThings in GHCi
-- See Note [Pretty printing via Iface syntax] in GHC.Types.TyThing.Ppr
-pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype,
- ifCtxt = context, ifResKind = kind,
- ifRoles = roles, ifCons = condecls,
- ifParent = parent,
- ifGadtSyntax = gadt,
- ifBinders = binders })
+pprIfaceDecl ss decl@(IfaceData { ifName = tycon, ifCType = ctype,
+ ifCtxt = context, ifResKind = kind,
+ ifRoles = roles, ifCons = condecls,
+ ifParent = parent,
+ ifGadtSyntax = gadt,
+ ifBinders = binders })
| gadt = vcat [ pp_roles
, pp_ki_sig
@@ -946,8 +1099,10 @@ pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype,
pp_kind = ppUnless (ki_sig_printable || isIfaceLiftedTypeKind kind)
(dcolon <+> ppr kind)
+ decl_head = pprIfaceDeclHead decl suppress_bndr_sig context ss tycon binders
+
pp_lhs = case parent of
- IfNoParent -> pprIfaceDeclHead suppress_bndr_sig context ss tycon binders
+ IfNoParent -> decl_head
IfDataInstance{}
-> text "instance" <+> pp_data_inst_forall
<+> pprIfaceTyConParent parent
@@ -994,36 +1149,40 @@ pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype,
pp_extra = vcat [pprCType ctype]
-pprIfaceDecl ss (IfaceClass { ifName = clas
- , ifRoles = roles
- , ifFDs = fds
- , ifBinders = binders
- , ifBody = IfAbstractClass })
+pprIfaceDecl ss decl@(IfaceClass { ifName = clas
+ , ifRoles = roles
+ , ifFDs = fds
+ , ifBinders = binders
+ , ifBody = IfAbstractClass })
= vcat [ pprClassRoles ss clas binders roles
, pprClassStandaloneKindSig ss clas (mkIfaceTyConKind binders constraintIfaceKind)
- , text "class" <+> pprIfaceDeclHead suppress_bndr_sig [] ss clas binders <+> pprFundeps fds ]
+ , text "class" <+> decl_head <+> pprFundeps fds ]
where
+ decl_head = pprIfaceDeclHead decl suppress_bndr_sig [] ss clas binders
+
-- See Note [Suppressing binder signatures] in GHC.Iface.Type
suppress_bndr_sig = SuppressBndrSig True
-pprIfaceDecl ss (IfaceClass { ifName = clas
- , ifRoles = roles
- , ifFDs = fds
- , ifBinders = binders
- , ifBody = IfConcreteClass {
- ifATs = ats,
- ifSigs = sigs,
- ifClassCtxt = context,
- ifMinDef = minDef
- }})
+pprIfaceDecl ss decl@(IfaceClass { ifName = clas
+ , ifRoles = roles
+ , ifFDs = fds
+ , ifBinders = binders
+ , ifBody = IfConcreteClass {
+ ifATs = ats,
+ ifSigs = sigs,
+ ifClassCtxt = context,
+ ifMinDef = minDef
+ }})
= vcat [ pprClassRoles ss clas binders roles
, pprClassStandaloneKindSig ss clas (mkIfaceTyConKind binders constraintIfaceKind)
- , text "class" <+> pprIfaceDeclHead suppress_bndr_sig context ss clas binders <+> pprFundeps fds <+> pp_where
+ , text "class" <+> decl_head <+> pprFundeps fds <+> pp_where
, nest 2 (vcat [ vcat asocs, vcat dsigs
, ppShowAllSubs ss (pprMinDef $ fromIfaceBooleanFormula minDef)])]
where
pp_where = ppShowRhs ss $ ppUnless (null sigs && null ats) (text "where")
+ decl_head = pprIfaceDeclHead decl suppress_bndr_sig context ss clas binders
+
asocs = ppr_trim $ map maybeShowAssoc ats
dsigs = ppr_trim $ map maybeShowSig sigs
@@ -1055,19 +1214,20 @@ pprIfaceDecl ss (IfaceClass { ifName = clas
-- See Note [Suppressing binder signatures] in GHC.Iface.Type
suppress_bndr_sig = SuppressBndrSig True
-pprIfaceDecl ss (IfaceSynonym { ifName = tc
- , ifBinders = binders
- , ifSynRhs = mono_ty
- , ifResKind = res_kind})
+pprIfaceDecl ss decl@(IfaceSynonym { ifName = tc
+ , ifBinders = binders
+ , ifSynRhs = poly_ty
+ , ifResKind = res_kind})
= vcat [ pprStandaloneKindSig name_doc (mkIfaceTyConKind binders res_kind)
- , hang (text "type" <+> pprIfaceDeclHead suppress_bndr_sig [] ss tc binders <+> equals)
- 2 (sep [ pprIfaceForAll tvs, pprIfaceContextArr theta, ppr_tau
- , ppUnless (isIfaceLiftedTypeKind res_kind) (dcolon <+> ppr res_kind) ])
+ , hang (text "type" <+> decl_head <+> equals)
+ 2 (sep [ pprIfaceForAll tvs, pprIfaceContextArr theta, ppr_tau ])
]
where
- (tvs, theta, tau) = splitIfaceSigmaTy mono_ty
+ (tvs, theta, tau) = splitIfaceSigmaTy poly_ty
name_doc = pprPrefixIfDeclBndr (ss_how_much ss) (occName tc)
+ decl_head = pprIfaceDeclHead decl suppress_bndr_sig [] ss tc binders
+
-- See Note [Printing type abbreviations] in GHC.Iface.Type
ppr_tau | tc `hasKey` liftedTypeKindTyConKey ||
tc `hasKey` unrestrictedFunTyConKey ||
@@ -1078,20 +1238,18 @@ pprIfaceDecl ss (IfaceSynonym { ifName = tc
-- See Note [Suppressing binder signatures] in GHC.Iface.Type
suppress_bndr_sig = SuppressBndrSig True
-pprIfaceDecl ss (IfaceFamily { ifName = tycon
- , ifFamFlav = rhs, ifBinders = binders
- , ifResKind = res_kind
- , ifResVar = res_var, ifFamInj = inj })
+pprIfaceDecl ss decl@(IfaceFamily { ifName = tycon
+ , ifFamFlav = rhs, ifBinders = binders
+ , ifResKind = res_kind
+ , ifResVar = res_var, ifFamInj = inj })
| IfaceDataFamilyTyCon <- rhs
= vcat [ pprStandaloneKindSig name_doc (mkIfaceTyConKind binders res_kind)
- , text "data family" <+> pprIfaceDeclHead suppress_bndr_sig [] ss tycon binders
+ , text "data family" <+> decl_head
]
| otherwise
= vcat [ pprStandaloneKindSig name_doc (mkIfaceTyConKind binders res_kind)
- , hang (text "type family"
- <+> pprIfaceDeclHead suppress_bndr_sig [] ss tycon binders
- <+> pp_inj res_var inj
+ , hang (text "type family" <+> decl_head <+> pp_inj res_var inj
<+> ppShowRhs ss (pp_where rhs))
2 (ppShowRhs ss (pp_rhs rhs))
$$
@@ -1100,6 +1258,8 @@ pprIfaceDecl ss (IfaceFamily { ifName = tycon
where
name_doc = pprPrefixIfDeclBndr (ss_how_much ss) (occName tycon)
+ decl_head = pprIfaceDeclHead decl suppress_bndr_sig [] ss tycon binders
+
pp_where (IfaceClosedSynFamilyTyCon {}) = text "where"
pp_where _ = empty
@@ -1245,16 +1405,24 @@ pprIfaceTyConParent IfNoParent
pprIfaceTyConParent (IfDataInstance _ tc tys)
= pprIfaceTypeApp topPrec tc tys
-pprIfaceDeclHead :: SuppressBndrSig
+pprIfaceDeclHead :: IfaceDecl
+ -> SuppressBndrSig
-> IfaceContext -> ShowSub -> Name
-> [IfaceTyConBinder] -- of the tycon, for invisible-suppression
-> SDoc
-pprIfaceDeclHead suppress_sig context ss tc_occ bndrs
+pprIfaceDeclHead decl suppress_sig context ss tc_occ bndrs
= sdocOption sdocPrintExplicitKinds $ \print_kinds ->
sep [ pprIfaceContextArr context
, pprPrefixIfDeclBndr (ss_how_much ss) (occName tc_occ)
<+> pprIfaceTyConBinders suppress_sig
- (suppressIfaceInvisibles (PrintExplicitKinds print_kinds) bndrs bndrs) ]
+ (suppressIfaceInsignificantInvisibles
+ (MkPrintArityInvisibles print_arity)
+ (PrintExplicitKinds print_kinds)
+ mentioned_vars bndrs) ]
+ where
+ -- See Note [Print invisible binders in interface declarations]
+ mentioned_vars = iface_decl_mentioned_vars decl
+ print_arity = iface_decl_non_generative decl
pprIfaceConDecl :: ShowSub -> Bool
-> IfaceTopBndr
=====================================
compiler/GHC/Iface/Type.hs
=====================================
@@ -44,6 +44,7 @@ module GHC.Iface.Type (
SuppressBndrSig(..),
UseBndrParens(..),
PrintExplicitKinds(..),
+ PrintArityInvisibles(..),
pprIfaceType, pprParendIfaceType, pprPrecIfaceType,
pprIfaceContext, pprIfaceContextArr,
pprIfaceIdBndr, pprIfaceLamBndr, pprIfaceTvBndr, pprIfaceTyConBinders,
@@ -55,7 +56,8 @@ module GHC.Iface.Type (
pprIfaceCoTcApp, pprTyTcApp, pprIfacePrefixApp,
isIfaceRhoType,
- suppressIfaceInvisibles,
+ suppressIfaceInvisibles, suppressIfaceInsignificantInvisibles,
+ visibleTypeVarOccurencies,
stripIfaceInvisVars,
stripInvisArgs,
@@ -98,6 +100,9 @@ import Data.Word (Word8)
import Control.Arrow (first)
import Control.DeepSeq
import Control.Monad ((<$!>))
+import Data.List (dropWhileEnd)
+import qualified Data.List.NonEmpty as NonEmpty
+import qualified Data.Set as Set
{-
************************************************************************
@@ -619,6 +624,51 @@ suppressIfaceInvisibles (PrintExplicitKinds False) tys xs = suppress tys xs
| isInvisibleTyConBinder k = suppress ks xs
| otherwise = x : suppress ks xs
+newtype PrintArityInvisibles = MkPrintArityInvisibles Bool
+
+-- See Note [Print invisible binders in interface declarations]
+-- for the definition what binders are considered insignificant
+suppressIfaceInsignificantInvisibles :: PrintArityInvisibles
+ -> PrintExplicitKinds
+ -> Set.Set IfLclName
+ -> [IfaceTyConBinder]
+ -> [IfaceTyConBinder]
+suppressIfaceInsignificantInvisibles _ (PrintExplicitKinds True) _ tys = tys
+suppressIfaceInsignificantInvisibles
+ (MkPrintArityInvisibles arity_invisibles)
+ (PrintExplicitKinds False) mentioned_vars tys
+ = suppress tys
+ where
+ -- Consider this example:
+ -- type T :: forall k1 k2. Type
+ -- type T @a @b = b
+ -- `@a` is not mentioned on the RHS however we can't just
+ -- drop it because implicit argument positioning matters.
+ --
+ -- Hence just drop the end
+ only_mentioned_binders = dropWhileEnd (not . is_binder_mentioned)
+
+ is_binder_mentioned bndr = ifTyConBinderName bndr `Set.member` mentioned_vars
+
+ suppress_invisibles group =
+ applyWhen invis_group only_mentioned_binders bndrs
+ where
+ bndrs = NonEmpty.toList group
+ invis_group = isInvisibleTyConBinder (NonEmpty.head group)
+
+ suppress_invisible_groups [] = []
+ suppress_invisible_groups [group] =
+ if arity_invisibles
+ then NonEmpty.toList group -- the last group affects arity
+ else suppress_invisibles group
+ suppress_invisible_groups (group : groups)
+ = suppress_invisibles group ++ suppress_invisible_groups groups
+
+ suppress
+ = suppress_invisible_groups -- Filter out insignificant invisible binders
+ . NonEmpty.groupWith isInvisibleTyConBinder -- Find chunks of @-binders
+ . filterOut isInferredTyConBinder -- We don't want to display @{binders}
+
stripIfaceInvisVars :: PrintExplicitKinds -> [IfaceTyConBinder] -> [IfaceTyConBinder]
stripIfaceInvisVars (PrintExplicitKinds True) tyvars = tyvars
stripIfaceInvisVars (PrintExplicitKinds False) tyvars
@@ -659,6 +709,29 @@ ifTypeIsVarFree ty = go ty
go_args IA_Nil = True
go_args (IA_Arg arg _ args) = go arg && go_args args
+visibleTypeVarOccurencies :: IfaceType -> Set.Set IfLclName
+-- Returns True if the type contains this name. Doesn't count
+-- invisible application
+-- Just used to control pretty printing
+visibleTypeVarOccurencies = go
+ where
+ (<>) = Set.union
+
+ go (IfaceTyVar var) = Set.singleton var
+ go (IfaceFreeTyVar {}) = mempty
+ go (IfaceAppTy fun args) = go fun <> go_args args
+ go (IfaceFunTy _ w arg res) = go w <> go arg <> go res
+ go (IfaceForAllTy bndr ty) = go (ifaceBndrType $ binderVar bndr) <> go ty
+ go (IfaceTyConApp _ args) = go_args args
+ go (IfaceTupleTy _ _ args) = go_args args
+ go (IfaceLitTy _) = mempty
+ go (IfaceCastTy {}) = mempty -- Safe
+ go (IfaceCoercionTy {}) = mempty -- Safe
+
+ go_args IA_Nil = mempty
+ go_args (IA_Arg arg Required args) = go arg <> go_args args
+ go_args (IA_Arg _arg _ args) = go_args args
+
{- Note [Substitution on IfaceType]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Substitutions on IfaceType are done only during pretty-printing to
=====================================
docs/users_guide/9.14.1-notes.rst
=====================================
@@ -33,6 +33,10 @@ Compiler
GHCi
~~~~
+- :ghci-cmd:`:info` now outputs type declarations with @-binders that are
+ considered semantically significant. See documentation about :ghci-cmd:`:info`
+ itself for more detailed explanation.
+
Runtime system
~~~~~~~~~~~~~~
=====================================
docs/users_guide/ghci.rst
=====================================
@@ -2516,6 +2516,22 @@ commonly used commands.
⟨name⟩ has been loaded from a source file, then GHCi will also
display the location of its definition in the source.
+ GHCi outputs type declarations (type synonyms, newtypes and datatypes,
+ classes, type and data families) with semantically significant invisible
+ @-binders.
+
+ An invisible binder is considered significant when it meets at least
+ one of the following two criteria:
+
+ - It visibly occurs in the declaration's body (See more about that below)
+
+ - It is followed by a significant binder, so it affects positioning
+
+ For non-generative type declaration (type synonyms and type families)
+ there is one additional criteria:
+
+ - It is not followed by a visible binder, so it affects the arity of a type declaration
+
For types and classes, GHCi also summarises instances that mention
them. To avoid showing irrelevant information, an instance is shown
only if (a) its head mentions ⟨name⟩, and (b) all the other things
=====================================
testsuite/tests/backpack/should_fail/T19244a.stderr
=====================================
@@ -17,7 +17,7 @@ T19244a.bkp:22:9: error: [GHC-15843]
• Type constructor ‘Key’ has conflicting definitions in the module
and its hsig file.
Main module: type Key :: * -> Constraint
- type Key = GHC.Classes.Ord :: * -> Constraint
+ type Key = GHC.Classes.Ord
Hsig file: type Key :: forall {k}. k -> Constraint
class Key k1
The types have different kinds.
=====================================
testsuite/tests/backpack/should_fail/T19244b.stderr
=====================================
@@ -1,20 +1,20 @@
[1 of 3] Processing user
- [1 of 2] Compiling Map[sig] ( user\Map.hsig, nothing )
- [2 of 2] Compiling User ( user\User.hs, nothing )
+ [1 of 2] Compiling Map[sig] ( user/Map.hsig, nothing )
+ [2 of 2] Compiling User ( user/User.hs, nothing )
[2 of 3] Processing ordmap
Instantiating ordmap
- [1 of 1] Compiling Map ( ordmap\Map.hs, T19244b.out\ordmap\Map.o )
+ [1 of 1] Compiling Map ( ordmap/Map.hs, T19244b.out/ordmap/Map.o )
[3 of 3] Processing main
Instantiating main
[1 of 1] Including user[Map=ordmap:Map]
Instantiating user[Map=ordmap:Map]
- [1 of 2] Compiling Map[sig] ( user\Map.hsig, T19244b.out\user\user-GzloW2NeDdA2M0V8qzN4g2\Map.o )
+ [1 of 2] Compiling Map[sig] ( user/Map.hsig, T19244b.out/user/user-GzloW2NeDdA2M0V8qzN4g2/Map.o )
T19244b.bkp:11:27: error: [GHC-15843]
• Type constructor ‘Key’ has conflicting definitions in the module
and its hsig file.
Main module: type Key :: * -> Constraint
- type Key = GHC.Classes.Ord :: * -> Constraint
+ type Key = GHC.Classes.Ord
Hsig file: type Key :: forall {k}. k -> Constraint
class Key k1
The types have different kinds.
=====================================
testsuite/tests/backpack/should_fail/bkpfail46.stderr
=====================================
@@ -1,20 +1,20 @@
[1 of 3] Processing p
- [1 of 2] Compiling A[sig] ( p\A.hsig, nothing )
- [2 of 2] Compiling M ( p\M.hs, nothing )
+ [1 of 2] Compiling A[sig] ( p/A.hsig, nothing )
+ [2 of 2] Compiling M ( p/M.hs, nothing )
[2 of 3] Processing q
Instantiating q
- [1 of 1] Compiling A ( q\A.hs, bkpfail46.out\q\A.o )
+ [1 of 1] Compiling A ( q/A.hs, bkpfail46.out/q/A.o )
[3 of 3] Processing r
Instantiating r
[1 of 1] Including p[A=q:A]
Instantiating p[A=q:A]
- [1 of 2] Compiling A[sig] ( p\A.hsig, bkpfail46.out\p\p-HVmFlcYSefiK5n1aDP1v7x\A.o )
+ [1 of 2] Compiling A[sig] ( p/A.hsig, bkpfail46.out/p/p-HVmFlcYSefiK5n1aDP1v7x/A.o )
bkpfail46.bkp:16:9: error: [GHC-15843]
• Type constructor ‘K’ has conflicting definitions in the module
and its hsig file.
Main module: type K :: * -> Constraint
- type K a = GHC.Classes.Eq a :: Constraint
+ type K a = GHC.Classes.Eq a
Hsig file: type K :: * -> Constraint
class K a
Illegal parameterized type synonym in implementation of abstract data.
=====================================
testsuite/tests/ghci/T18060/T18060.stdout
=====================================
@@ -1,5 +1,5 @@
type (->) :: * -> * -> *
-type (->) = FUN Many :: * -> * -> *
+type (->) = FUN Many
-- Defined in ‘GHC.Types’
infixr -1 ->
instance Monoid b => Monoid (a -> b)
=====================================
testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout
=====================================
@@ -74,13 +74,13 @@ data Tuple2# a b = (#,#) a b
(# , #) :: a -> b -> Tuple2# a b
(Int, Int) :: Tuple2 (*) (*)
type T :: Tuple2 (*) (*)
-type T = (Int, Int) :: Tuple2 (*) (*)
+type T = (Int, Int)
-- Defined at <interactive>:19:1
type S :: Solo (*)
-type S = MkSolo Int :: Solo (*)
+type S = MkSolo Int
-- Defined at <interactive>:20:1
type L :: List (*)
-type L = [Int] :: List (*)
+type L = [Int]
-- Defined at <interactive>:21:1
f :: Int -> Tuple2 Int Int -> Int
(\ (_, _) -> ()) :: Tuple2 a b -> Unit
=====================================
testsuite/tests/ghci/scripts/T15941.stdout
=====================================
@@ -1,4 +1,3 @@
type T :: * -> * -> *
-type T =
- (->) @{GHC.Types.LiftedRep} @{GHC.Types.LiftedRep} :: * -> * -> *
+type T = (->) @{GHC.Types.LiftedRep} @{GHC.Types.LiftedRep}
-- Defined at <interactive>:2:1
=====================================
testsuite/tests/ghci/scripts/T19310.stdout
=====================================
@@ -1,3 +1,3 @@
type T :: * -> * -> *
-type T = (->) @{LiftedRep} @{LiftedRep} :: * -> * -> *
+type T = (->) @{LiftedRep} @{LiftedRep}
-- Defined at <interactive>:3:1
=====================================
testsuite/tests/ghci/scripts/T21294a.stdout
=====================================
@@ -1,5 +1,5 @@
type L0 :: * -> *
-type L0 = [] :: * -> *
+type L0 = []
-- Defined at <interactive>:1:1
type L1 :: * -> *
type L1 a = [a]
=====================================
testsuite/tests/ghci/scripts/T24459.script
=====================================
@@ -0,0 +1,250 @@
+:{
+{-# LANGUAGE TypeFamilies, TypeFamilyDependencies, DataKinds, TypeAbstractions, FunctionalDependencies, AllowAmbiguousTypes #-}
+
+import Data.Kind
+import Data.Data
+
+-- Check that we don't print what don't belong to arity
+type T0 :: forall k. k -> Type
+type T0 = Proxy :: forall k. k -> Type
+
+-- ...and that doesn't affected by type signature
+type T1 :: forall k. k -> Type
+type T1 = Proxy
+
+-- ...and that we print variables that are belong to arity
+type T2 :: forall k. k -> Type
+type T2 @k = Proxy
+
+-- ...but don't print invisibles that don't visibly occur and don't affect arity
+type T3 :: forall k. k -> Type
+type T3 a = Proxy a
+
+-- ...and print invisibles that do visibly occur
+type T4 :: forall a. Type -> Type
+type T4 @a _b = Proxy a
+
+-- ...one more check that it is not affected by user's input
+type T5 :: forall a. Type -> Type
+type T5 @a _b = Proxy _b
+
+-- ...and once again
+type T6 :: forall k. Type -> Type
+type T6 _a = ()
+
+-- ...now check that we don't mess up with positioning
+type T7 :: forall a b c. b -> forall d. Type
+type T7 @a @b @c f @d = b
+
+-- ...and that we count occurences in theta
+type T8 :: forall (a :: Constraint). Type -> Type
+type T8 @a _ = forall x. a => x
+
+-- ...and in forall binder signatures
+type T9 :: forall (a :: Type). Type -> Type
+type T9 @a _ = forall (x :: a). Int
+
+-- That's all with type synonyms, let's check other sorts of type declarations
+
+-- Equatuions should not affect invisibles for type families, but arity matters
+type TF1 :: forall a (b :: Type). a -> forall (d :: Type). Type
+type family TF1 @a @b c @d where
+ forall b d. TF1 @Type @b Int @d = ()
+ forall a b d. TF1 @a @b (_ :: a) @d = Bool
+
+-- Injectivity annotations should affect invisibles. Also check that positioning works
+type TF2 :: forall (a :: Type) (b :: Type). Type -> forall (d :: Type). Type
+type family TF2 @a @b c @d = r | r -> b
+
+-- Data families are generative and can't have injectivity annotations
+-- hence no invisibles should be printed
+type DF1 :: forall a (b :: Type). a -> forall (d :: Type). Type
+data family DF1 @a @b c @d
+
+-- Data families are generative, so invisible @b isn't a visible usage
+type C1 :: forall (a :: Type) (b :: Type). Type -> Constraint
+class C1 @a @b c where
+ data AD a @b
+
+-- But type families aren't generative, hense trailing @b occurs visibly
+type C2 :: forall (a :: Type) (b :: Type). Type -> Constraint
+class C2 @a @b c where
+ type AF a @b
+
+-- Check that trailing invisibles are handled properly
+type C3 :: forall x. Constraint
+class C3 @x where {}
+
+-- And check that signatures are visible occurences
+type C4 :: forall (a :: Type) (b :: Type). Constraint
+class C4 @a @b where
+ x :: a
+ y :: b
+
+-- Also check functional dependencies
+type C5 :: forall (a :: Type) (b :: Type). Type -> Constraint
+class C5 @a @b c | a -> c where {}
+
+-- GADTs should not have "visible" mentiones of binders at a declaration's head
+type D1 :: forall a. Type
+data D1 @a where
+ MkD :: b -> D1 @b
+
+-- Haskell98-style declarations should work properly
+type D2 :: forall a (b :: Type). Type -> forall d. Type
+data D2 @a @b c @d = MkD2_1 | MkD2_2 Int b
+
+-- And now a lot of stuff suggested by @int-index
+
+data P a b
+
+type F1 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F1 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P k1
+
+type F2 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F2 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P k2
+
+type F3 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F3 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P k3
+
+type F4 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F4 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P k4
+
+type F5 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P k5
+
+type F6 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P k6
+
+type F1x2 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F1x2 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k1,k2)
+
+type F1x3 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F1x3 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k1,k3)
+
+type F1x4 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F1x4 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k1,k4)
+
+type F1x5 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F1x5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k1,k5)
+
+type F1x6 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F1x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k1,k6)
+
+type F2x3 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F2x3 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k2,k3)
+
+type F2x4 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F2x4 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k2,k4)
+
+type F2x5 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F2x5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k2,k5)
+
+type F2x6 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F2x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k2,k6)
+
+type F3x4 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F3x4 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k3,k4)
+
+type F3x5 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F3x5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k3,k5)
+
+type F3x6 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F3x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k3,k6)
+
+type F4x5 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F4x5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k4,k5)
+
+type F4x6 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F4x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k4,k6)
+
+type F5x6 :: forall k1 k2. k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> Type
+type F5x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k5,k6)
+
+:}
+
+:i T0
+:i T1
+:i T2
+:i T3
+:i T4
+:i T5
+:i T6
+:i T7
+:i T8
+:i T9
+:i TF1
+:i TF2
+:i DF1
+:i C1
+:i C2
+:i C3
+:i C4
+:i C5
+:i D1
+:i D2
+:i F1
+:i F2
+:i F3
+:i F4
+:i F5
+:i F6
+:i F1x2
+:i F1x3
+:i F1x4
+:i F1x5
+:i F1x6
+:i F2x3
+:i F2x4
+:i F2x5
+:i F2x6
+:i F3x4
+:i F3x5
+:i F3x6
+:i F4x5
+:i F4x6
+:i F5x6
+
+:set -fprint-explicit-kinds
+
+:i T0
+:i T1
+:i T2
+:i T3
+:i T4
+:i T5
+:i T6
+:i T7
+:i T8
+:i T9
+:i TF1
+:i TF2
+:i DF1
+:i C1
+:i C2
+:i C3
+:i C4
+:i C5
+:i D1
+:i D2
+:i F1
+:i F2
+:i F3
+:i F4
+:i F5
+:i F6
+:i F1x2
+:i F1x3
+:i F1x4
+:i F1x5
+:i F1x6
+:i F2x3
+:i F2x4
+:i F2x5
+:i F2x6
+:i F3x4
+:i F3x5
+:i F3x6
+:i F4x5
+:i F4x6
+:i F5x6
=====================================
testsuite/tests/ghci/scripts/T24459.stdout
=====================================
@@ -0,0 +1,313 @@
+type T0 :: forall k. k -> *
+type T0 = Proxy
+ -- Defined at <interactive>:9:1
+type T1 :: forall k. k -> *
+type T1 = Proxy
+ -- Defined at <interactive>:13:1
+type T2 :: forall k. k -> *
+type T2 @k = Proxy
+ -- Defined at <interactive>:17:1
+type T3 :: forall k. k -> *
+type T3 a = Proxy a
+ -- Defined at <interactive>:21:1
+type T4 :: forall {k} (a :: k). * -> *
+type T4 @a _b = Proxy a
+ -- Defined at <interactive>:25:1
+type T5 :: forall {k} (a :: k). * -> *
+type T5 _b = Proxy _b
+ -- Defined at <interactive>:29:1
+type T6 :: forall {k} (k1 :: k). * -> *
+type T6 _a = ()
+ -- Defined at <interactive>:33:1
+type T7 :: forall {k} {k1} {k2} (a :: k) b (c :: k1).
+ b -> forall (d :: k2). *
+type T7 @a @b f @d = b
+ -- Defined at <interactive>:37:1
+type T8 :: forall (a :: Constraint). * -> *
+type T8 @a b = forall x. a => x
+ -- Defined at <interactive>:41:1
+type T9 :: forall a. * -> *
+type T9 @a b = forall (x :: a). Int
+ -- Defined at <interactive>:45:1
+type TF1 :: forall a b. a -> forall d. *
+type family TF1 c @d where
+ TF1 Int = ()
+ forall a (_1 :: a) b d. TF1 _1 = Bool
+ -- Defined at <interactive>:51:1
+type TF2 :: forall a b. * -> forall d. *
+type family TF2 @a @b c @d = r | r -> b
+ -- Defined at <interactive>:57:1
+type DF1 :: forall a b. a -> forall d. *
+data family DF1 c
+ -- Defined at <interactive>:62:1
+type C1 :: forall a b. * -> Constraint
+class C1 @a c where
+ type AD :: * -> forall b. *
+ data family AD a
+ -- Defined at <interactive>:66:1
+type C2 :: forall a b. * -> Constraint
+class C2 @a @b c where
+ type AF :: * -> forall b. *
+ type family AF a @b
+ -- Defined at <interactive>:71:1
+type C3 :: forall {k} (x :: k). Constraint
+class C3
+ -- Defined at <interactive>:76:1
+type C4 :: forall a b. Constraint
+class C4 @a @b where
+ x :: a
+ y :: b
+ {-# MINIMAL x, y #-}
+ -- Defined at <interactive>:80:1
+type C5 :: forall a b. * -> Constraint
+class C5 @a c | a -> c
+ -- Defined at <interactive>:86:1
+type D1 :: forall {k} (a :: k). *
+data D1 where
+ MkD :: b -> D1
+ -- Defined at <interactive>:90:1
+type role D2 phantom
+type D2 :: forall {k} {k1} (a :: k) b. * -> forall (d :: k1). *
+data D2 @a @b c = MkD2_1 | MkD2_2 Int b
+ -- Defined at <interactive>:95:1
+type F1 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1 @k1 a b c d e @k6 = P k1
+ -- Defined at <interactive>:102:1
+type F2 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2 @k1 @k2 a b c d e @k6 = P k2
+ -- Defined at <interactive>:105:1
+type F3 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F3 a b @k3 c d e @k6 = P k3
+ -- Defined at <interactive>:108:1
+type F4 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F4 a b @k3 @k4 c d e @k6 = P k4
+ -- Defined at <interactive>:111:1
+type F5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F5 a b @k3 @k4 @k5 c d e @k6 = P k5
+ -- Defined at <interactive>:114:1
+type F6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F6 a b c d e @k6 = P k6
+ -- Defined at <interactive>:117:1
+type F1x2 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x2 @k1 @k2 a b c d e @k6 = P (k1, k2)
+ -- Defined at <interactive>:120:1
+type F1x3 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x3 @k1 a b @k3 c d e @k6 = P (k1, k3)
+ -- Defined at <interactive>:123:1
+type F1x4 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x4 @k1 a b @k3 @k4 c d e @k6 = P (k1, k4)
+ -- Defined at <interactive>:126:1
+type F1x5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x5 @k1 a b @k3 @k4 @k5 c d e @k6 = P (k1, k5)
+ -- Defined at <interactive>:129:1
+type F1x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x6 @k1 a b c d e @k6 = P (k1, k6)
+ -- Defined at <interactive>:132:1
+type F2x3 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2x3 @k1 @k2 a b @k3 c d e @k6 = P (k2, k3)
+ -- Defined at <interactive>:135:1
+type F2x4 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2x4 @k1 @k2 a b @k3 @k4 c d e @k6 = P (k2, k4)
+ -- Defined at <interactive>:138:1
+type F2x5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2x5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P (k2, k5)
+ -- Defined at <interactive>:141:1
+type F2x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2x6 @k1 @k2 a b c d e @k6 = P (k2, k6)
+ -- Defined at <interactive>:144:1
+type F3x4 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F3x4 a b @k3 @k4 c d e @k6 = P (k3, k4)
+ -- Defined at <interactive>:147:1
+type F3x5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F3x5 a b @k3 @k4 @k5 c d e @k6 = P (k3, k5)
+ -- Defined at <interactive>:150:1
+type F3x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F3x6 a b @k3 c d e @k6 = P (k3, k6)
+ -- Defined at <interactive>:153:1
+type F4x5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F4x5 a b @k3 @k4 @k5 c d e @k6 = P (k4, k5)
+ -- Defined at <interactive>:156:1
+type F4x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F4x6 a b @k3 @k4 c d e @k6 = P (k4, k6)
+ -- Defined at <interactive>:159:1
+type F5x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F5x6 a b @k3 @k4 @k5 c d e @k6 = P (k5, k6)
+ -- Defined at <interactive>:162:1
+type T0 :: forall k. k -> *
+type T0 = Proxy
+ -- Defined at <interactive>:9:1
+type T1 :: forall k. k -> *
+type T1 = Proxy
+ -- Defined at <interactive>:13:1
+type T2 :: forall k. k -> *
+type T2 @k = Proxy @{k}
+ -- Defined at <interactive>:17:1
+type T3 :: forall k. k -> *
+type T3 @k a = Proxy @{k} a
+ -- Defined at <interactive>:21:1
+type T4 :: forall {k} (a :: k). * -> *
+type T4 @{k} @a _b = Proxy @{k} a
+ -- Defined at <interactive>:25:1
+type T5 :: forall {k} (a :: k). * -> *
+type T5 @{k} @a _b = Proxy @{*} _b
+ -- Defined at <interactive>:29:1
+type T6 :: forall {k} (k1 :: k). * -> *
+type T6 @{k} @k1 _a = ()
+ -- Defined at <interactive>:33:1
+type T7 :: forall {k} {k1} {k2} (a :: k) b (c :: k1).
+ b -> forall (d :: k2). *
+type T7 @{k} @{k1} @{k2} @a @b @c f @d = b
+ -- Defined at <interactive>:37:1
+type T8 :: forall (a :: Constraint). * -> *
+type T8 @a b = forall x. a => x
+ -- Defined at <interactive>:41:1
+type T9 :: forall a. * -> *
+type T9 @a b = forall (x :: a). Int
+ -- Defined at <interactive>:45:1
+type TF1 :: forall a b. a -> forall d. *
+type family TF1 @a @b c @d where
+ TF1 @(*) @b Int @d = ()
+ forall a (_1 :: a) b d. TF1 @a @b _1 @d = Bool
+ -- Defined at <interactive>:51:1
+type TF2 :: forall a b. * -> forall d. *
+type family TF2 @a @b c @d = r | r -> b
+ -- Defined at <interactive>:57:1
+type DF1 :: forall a b. a -> forall d. *
+data family DF1 @a @b c @d
+ -- Defined at <interactive>:62:1
+type C1 :: forall a b. * -> Constraint
+class C1 @a @b c where
+ type AD :: * -> forall b. *
+ data family AD a @b
+ -- Defined at <interactive>:66:1
+type C2 :: forall a b. * -> Constraint
+class C2 @a @b c where
+ type AF :: * -> forall b. *
+ type family AF a @b
+ -- Defined at <interactive>:71:1
+type C3 :: forall {k} (x :: k). Constraint
+class C3 @{k} @x
+ -- Defined at <interactive>:76:1
+type C4 :: forall a b. Constraint
+class C4 @a @b where
+ x :: a
+ y :: b
+ {-# MINIMAL x, y #-}
+ -- Defined at <interactive>:80:1
+type C5 :: forall a b. * -> Constraint
+class C5 @a @b c | a -> c
+ -- Defined at <interactive>:86:1
+type role D1 nominal nominal
+type D1 :: forall {k} (a :: k). *
+data D1 @{k} @a where
+ MkD :: b -> D1 @{*} @b
+ -- Defined at <interactive>:90:1
+type role D2 nominal nominal nominal nominal phantom nominal
+type D2 :: forall {k} {k1} (a :: k) b. * -> forall (d :: k1). *
+data D2 @{k} @{k1} @a @b c @d = MkD2_1 | MkD2_2 Int b
+ -- Defined at <interactive>:95:1
+type F1 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} k1
+ -- Defined at <interactive>:102:1
+type F2 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} k2
+ -- Defined at <interactive>:105:1
+type F3 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F3 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} k3
+ -- Defined at <interactive>:108:1
+type F4 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F4 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} k4
+ -- Defined at <interactive>:111:1
+type F5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} k5
+ -- Defined at <interactive>:114:1
+type F6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} k6
+ -- Defined at <interactive>:117:1
+type F1x2 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x2 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k1, k2)
+ -- Defined at <interactive>:120:1
+type F1x3 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x3 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k1, k3)
+ -- Defined at <interactive>:123:1
+type F1x4 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x4 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k1, k4)
+ -- Defined at <interactive>:126:1
+type F1x5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k1, k5)
+ -- Defined at <interactive>:129:1
+type F1x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F1x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k1, k6)
+ -- Defined at <interactive>:132:1
+type F2x3 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2x3 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k2, k3)
+ -- Defined at <interactive>:135:1
+type F2x4 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2x4 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k2, k4)
+ -- Defined at <interactive>:138:1
+type F2x5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2x5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k2, k5)
+ -- Defined at <interactive>:141:1
+type F2x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F2x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k2, k6)
+ -- Defined at <interactive>:144:1
+type F3x4 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F3x4 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k3, k4)
+ -- Defined at <interactive>:147:1
+type F3x5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F3x5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k3, k5)
+ -- Defined at <interactive>:150:1
+type F3x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F3x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k3, k6)
+ -- Defined at <interactive>:153:1
+type F4x5 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F4x5 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k4, k5)
+ -- Defined at <interactive>:156:1
+type F4x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F4x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k4, k6)
+ -- Defined at <interactive>:159:1
+type F5x6 :: forall k1 k2.
+ k1 -> k2 -> forall k3 k4 k5. k3 -> k4 -> k5 -> forall k6. k6 -> *
+type F5x6 @k1 @k2 a b @k3 @k4 @k5 c d e @k6 = P @{*} @{k6} (k5, k6)
+ -- Defined at <interactive>:162:1
=====================================
testsuite/tests/ghci/scripts/T8535.stdout
=====================================
@@ -1,5 +1,5 @@
type (->) :: * -> * -> *
-type (->) = FUN Many :: * -> * -> *
+type (->) = FUN Many
-- Defined in ‘GHC.Types’
infixr -1 ->
instance Monoid b => Monoid (a -> b)
=====================================
testsuite/tests/ghci/scripts/T9181.stdout
=====================================
@@ -13,12 +13,10 @@ type (GHC.Internal.Data.Type.Ord.<=) x y =
GHC.Internal.TypeError.Assert
(x GHC.Internal.Data.Type.Ord.<=? y)
(GHC.Internal.Data.Type.Ord.LeErrMsg x y)
- :: Constraint
type (GHC.Internal.Data.Type.Ord.<=?) :: forall k. k -> k -> Bool
type (GHC.Internal.Data.Type.Ord.<=?) m n =
GHC.Internal.Data.Type.Ord.OrdCond
(GHC.Internal.Data.Type.Ord.Compare m n) True True False
- :: Bool
type GHC.Internal.TypeLits.AppendSymbol :: GHC.Types.Symbol
-> GHC.Types.Symbol -> GHC.Types.Symbol
type family GHC.Internal.TypeLits.AppendSymbol a b
=====================================
testsuite/tests/ghci/scripts/all.T
=====================================
@@ -385,3 +385,4 @@ test('T23686', normal, ghci_script, ['T23686.script'])
test('T13869', extra_files(['T13869a.hs', 'T13869b.hs']), ghci_script, ['T13869.script'])
test('ListTuplePunsPpr', normal, ghci_script, ['ListTuplePunsPpr.script'])
test('ListTuplePunsPprNoAbbrevTuple', [expect_broken(23135), limit_stdout_lines(13)], ghci_script, ['ListTuplePunsPprNoAbbrevTuple.script'])
+test('T24459', normal, ghci_script, ['T24459.script'])
=====================================
testsuite/tests/ghci/scripts/ghci020.stdout
=====================================
@@ -1,5 +1,5 @@
type (->) :: * -> * -> *
-type (->) = FUN Many :: * -> * -> *
+type (->) = FUN Many
-- Defined in ‘GHC.Types’
infixr -1 ->
instance Monoid b => Monoid (a -> b)
=====================================
testsuite/tests/ghci/should_run/T10145.stdout
=====================================
@@ -1,5 +1,5 @@
type (->) :: * -> * -> *
-type (->) = FUN Many :: * -> * -> *
+type (->) = FUN Many
-- Defined in ‘GHC.Types’
infixr -1 ->
instance Monoid b => Monoid (a -> b)
=====================================
testsuite/tests/ghci/should_run/T18594.stdout
=====================================
@@ -1,5 +1,5 @@
type (->) :: * -> * -> *
-type (->) = FUN Many :: * -> * -> *
+type (->) = FUN Many
-- Defined in ‘GHC.Types’
infixr -1 ->
instance Monoid b => Monoid (a -> b)
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -1012,7 +1012,7 @@ module Data.Fixed where
type Fixed :: forall k. k -> *
newtype Fixed a = MkFixed GHC.Num.Integer.Integer
type HasResolution :: forall k. k -> Constraint
- class HasResolution a where
+ class HasResolution @k a where
resolution :: forall (p :: k -> *). p a -> GHC.Num.Integer.Integer
{-# MINIMAL resolution #-}
type Micro :: *
@@ -1781,27 +1781,27 @@ module Data.Type.Equality where
module Data.Type.Ord where
-- Safety: Safe
type (<) :: forall {t}. t -> t -> Constraint
- type (<) x y = GHC.Internal.TypeError.Assert (x <? y) (GHC.Internal.Data.Type.Ord.LtErrMsg x y) :: Constraint
+ type (<) x y = GHC.Internal.TypeError.Assert (x <? y) (GHC.Internal.Data.Type.Ord.LtErrMsg x y)
type (<=) :: forall {t}. t -> t -> Constraint
- type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint
+ type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y)
type (<=?) :: forall k. k -> k -> GHC.Types.Bool
- type (<=?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool
+ type (<=?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False
type (<?) :: forall k. k -> k -> GHC.Types.Bool
- type (<?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.False GHC.Types.False :: GHC.Types.Bool
+ type (<?) m n = OrdCond (Compare m n) GHC.Types.True GHC.Types.False GHC.Types.False
type (>) :: forall {t}. t -> t -> Constraint
- type (>) x y = GHC.Internal.TypeError.Assert (x >? y) (GHC.Internal.Data.Type.Ord.GtErrMsg x y) :: Constraint
+ type (>) x y = GHC.Internal.TypeError.Assert (x >? y) (GHC.Internal.Data.Type.Ord.GtErrMsg x y)
type (>=) :: forall {t}. t -> t -> Constraint
- type (>=) x y = GHC.Internal.TypeError.Assert (x >=? y) (GHC.Internal.Data.Type.Ord.GeErrMsg x y) :: Constraint
+ type (>=) x y = GHC.Internal.TypeError.Assert (x >=? y) (GHC.Internal.Data.Type.Ord.GeErrMsg x y)
type (>=?) :: forall k. k -> k -> GHC.Types.Bool
- type (>=?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.True GHC.Types.True :: GHC.Types.Bool
+ type (>=?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.True GHC.Types.True
type (>?) :: forall k. k -> k -> GHC.Types.Bool
- type (>?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.False GHC.Types.True :: GHC.Types.Bool
+ type (>?) m n = OrdCond (Compare m n) GHC.Types.False GHC.Types.False GHC.Types.True
type Compare :: forall k. k -> k -> GHC.Types.Ordering
type family Compare a b
type Max :: forall k. k -> k -> k
- type Max m n = OrdCond (Compare m n) n n m :: k
+ type Max m n = OrdCond (Compare m n) n n m
type Min :: forall k. k -> k -> k
- type Min m n = OrdCond (Compare m n) m m n :: k
+ type Min m n = OrdCond (Compare m n) m m n
type OrdCond :: forall k. GHC.Types.Ordering -> k -> k -> k -> k
type family OrdCond o lt eq gt where
forall k (lt :: k) (eq :: k) (gt :: k). OrdCond GHC.Types.LT lt eq gt = lt
@@ -3207,7 +3207,7 @@ module GHC.Base where
many :: forall a. f a -> f [a]
{-# MINIMAL empty, (<|>) #-}
type Any :: forall k. k
- type family Any where
+ type family Any @k where
type Applicative :: (* -> *) -> Constraint
class Functor f => Applicative f where
pure :: forall a. a -> f a
@@ -3336,7 +3336,7 @@ module GHC.Base where
type Levity :: *
data Levity = Lifted | Unlifted
type LiftedRep :: RuntimeRep
- type LiftedRep = BoxedRep Lifted :: RuntimeRep
+ type LiftedRep = BoxedRep Lifted
type List :: * -> *
data List a = ...
type role MVar# nominal representational
@@ -3449,7 +3449,7 @@ module GHC.Base where
type TypeLitSort :: *
data TypeLitSort = TypeLitSymbol | TypeLitNat | TypeLitChar
type UnliftedRep :: RuntimeRep
- type UnliftedRep = BoxedRep Unlifted :: RuntimeRep
+ type UnliftedRep = BoxedRep Unlifted
type UnliftedType :: *
type UnliftedType = TYPE UnliftedRep
type VecCount :: *
@@ -3459,7 +3459,7 @@ module GHC.Base where
type Void :: *
data Void
type Void# :: ZeroBitType
- type Void# = (# #) :: ZeroBitType
+ type Void# = (# #)
type Weak# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType
data Weak# a
type WithDict :: Constraint -> * -> Constraint
@@ -3505,7 +3505,7 @@ module GHC.Base where
type WordBox :: TYPE WordRep -> *
data WordBox a = MkWordBox a
type ZeroBitRep :: RuntimeRep
- type ZeroBitRep = TupleRep '[] :: RuntimeRep
+ type ZeroBitRep = TupleRep '[]
type ZeroBitType :: *
type ZeroBitType = TYPE ZeroBitRep
absentErr :: forall a. a
@@ -5406,7 +5406,7 @@ module GHC.Exts where
type Addr# :: TYPE AddrRep
data Addr#
type Any :: forall k. k
- type family Any where
+ type family Any @k where
type Array# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType
data Array# a
type ArrayArray# :: UnliftedType
@@ -5533,7 +5533,7 @@ module GHC.Exts where
type Levity :: *
data Levity = Lifted | Unlifted
type LiftedRep :: RuntimeRep
- type LiftedRep = BoxedRep Lifted :: RuntimeRep
+ type LiftedRep = BoxedRep Lifted
type List :: * -> *
data List a = ...
type role MVar# nominal representational
@@ -5608,7 +5608,7 @@ module GHC.Exts where
TypeLitNat :: GHC.Types.TypeLitSort
TypeLitSymbol :: GHC.Types.TypeLitSort
type UnliftedRep :: RuntimeRep
- type UnliftedRep = BoxedRep Unlifted :: RuntimeRep
+ type UnliftedRep = BoxedRep Unlifted
type UnliftedType :: *
type UnliftedType = TYPE UnliftedRep
type VecCount :: *
@@ -5616,7 +5616,7 @@ module GHC.Exts where
type VecElem :: *
data VecElem = Int8ElemRep | Int16ElemRep | Int32ElemRep | Int64ElemRep | Word8ElemRep | Word16ElemRep | Word32ElemRep | Word64ElemRep | FloatElemRep | DoubleElemRep
type Void# :: ZeroBitType
- type Void# = (# #) :: ZeroBitType
+ type Void# = (# #)
type Weak# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType
data Weak# a
type WithDict :: Constraint -> * -> Constraint
@@ -5662,7 +5662,7 @@ module GHC.Exts where
type WordBox :: TYPE WordRep -> *
data WordBox a = MkWordBox a
type ZeroBitRep :: RuntimeRep
- type ZeroBitRep = TupleRep '[] :: RuntimeRep
+ type ZeroBitRep = TupleRep '[]
type ZeroBitType :: *
type ZeroBitType = TYPE ZeroBitRep
acosDouble# :: Double# -> Double#
@@ -7397,7 +7397,7 @@ module GHC.Generics where
type C :: *
data C
type C1 :: forall {k}. Meta -> (k -> *) -> k -> *
- type C1 = M1 C :: Meta -> (k -> *) -> k -> *
+ type C1 = M1 C
type Constructor :: forall {k}. k -> Constraint
class Constructor c where
conName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t c f a -> [GHC.Types.Char]
@@ -7407,7 +7407,7 @@ module GHC.Generics where
type D :: *
data D
type D1 :: forall {k}. Meta -> (k -> *) -> k -> *
- type D1 = M1 D :: Meta -> (k -> *) -> k -> *
+ type D1 = M1 D
type Datatype :: forall {k}. k -> Constraint
class Datatype d where
datatypeName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t d f a -> [GHC.Types.Char]
@@ -7429,7 +7429,7 @@ module GHC.Generics where
to :: forall x. Rep a x -> a
{-# MINIMAL from, to #-}
type Generic1 :: forall k. (k -> *) -> Constraint
- class Generic1 f where
+ class Generic1 @k f where
type Rep1 :: forall k. (k -> *) -> k -> *
type family Rep1 f
from1 :: forall (a :: k). f a -> Rep1 f a
@@ -7454,14 +7454,14 @@ module GHC.Generics where
type R :: *
data R
type Rec0 :: forall {k}. * -> k -> *
- type Rec0 = K1 R :: * -> k -> *
+ type Rec0 = K1 R
type role Rec1 representational nominal
type Rec1 :: forall k. (k -> *) -> k -> *
newtype Rec1 f p = Rec1 {unRec1 :: f p}
type S :: *
data S
type S1 :: forall {k}. Meta -> (k -> *) -> k -> *
- type S1 = M1 S :: Meta -> (k -> *) -> k -> *
+ type S1 = M1 S
type Selector :: forall {k}. k -> Constraint
class Selector s where
selName :: forall k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). t s f a -> [GHC.Types.Char]
@@ -7478,24 +7478,24 @@ module GHC.Generics where
data U1 p = U1
UAddr :: forall k (p :: k). GHC.Prim.Addr# -> URec (GHC.Internal.Ptr.Ptr ()) p
type UAddr :: forall {k}. k -> *
- type UAddr = URec (GHC.Internal.Ptr.Ptr ()) :: k -> *
+ type UAddr = URec (GHC.Internal.Ptr.Ptr ())
UChar :: forall k (p :: k). GHC.Prim.Char# -> URec GHC.Types.Char p
type UChar :: forall {k}. k -> *
- type UChar = URec GHC.Types.Char :: k -> *
+ type UChar = URec GHC.Types.Char
UDouble :: forall k (p :: k). GHC.Prim.Double# -> URec GHC.Types.Double p
type UDouble :: forall {k}. k -> *
- type UDouble = URec GHC.Types.Double :: k -> *
+ type UDouble = URec GHC.Types.Double
UFloat :: forall k (p :: k). GHC.Prim.Float# -> URec GHC.Types.Float p
type UFloat :: forall {k}. k -> *
- type UFloat = URec GHC.Types.Float :: k -> *
+ type UFloat = URec GHC.Types.Float
UInt :: forall k (p :: k). GHC.Prim.Int# -> URec GHC.Types.Int p
type UInt :: forall {k}. k -> *
- type UInt = URec GHC.Types.Int :: k -> *
+ type UInt = URec GHC.Types.Int
type URec :: forall k. * -> k -> *
data family URec a p
UWord :: forall k (p :: k). GHC.Prim.Word# -> URec GHC.Types.Word p
type UWord :: forall {k}. k -> *
- type UWord = URec GHC.Types.Word :: k -> *
+ type UWord = URec GHC.Types.Word
type role V1 phantom
type V1 :: forall k. k -> *
data V1 p
@@ -8583,7 +8583,7 @@ module GHC.Num.BigNat where
type BigNat :: *
data BigNat = BN# {unBigNat :: BigNat#}
type BigNat# :: GHC.Types.UnliftedType
- type BigNat# = GHC.Num.WordArray.WordArray# :: GHC.Types.UnliftedType
+ type BigNat# = GHC.Num.WordArray.WordArray#
bigNatAdd :: BigNat# -> BigNat# -> BigNat#
bigNatAddWord :: BigNat# -> GHC.Types.Word -> BigNat#
bigNatAddWord# :: BigNat# -> GHC.Prim.Word# -> BigNat#
@@ -9357,7 +9357,7 @@ module GHC.Stack where
type CostCentreStack :: *
data CostCentreStack
type HasCallStack :: Constraint
- type HasCallStack = ?callStack::CallStack :: Constraint
+ type HasCallStack = ?callStack::CallStack
type SrcLoc :: *
data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: {-# UNPACK #-}GHC.Types.Int, srcLocStartCol :: {-# UNPACK #-}GHC.Types.Int, srcLocEndLine :: {-# UNPACK #-}GHC.Types.Int, srcLocEndCol :: {-# UNPACK #-}GHC.Types.Int}
callStack :: HasCallStack => CallStack
@@ -9418,7 +9418,7 @@ module GHC.Stack.Types where
type CallStack :: *
data CallStack = EmptyCallStack | PushCallStack [GHC.Types.Char] SrcLoc CallStack | FreezeCallStack CallStack
type HasCallStack :: Constraint
- type HasCallStack = ?callStack::CallStack :: Constraint
+ type HasCallStack = ?callStack::CallStack
type SrcLoc :: *
data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: {-# UNPACK #-}GHC.Types.Int, srcLocStartCol :: {-# UNPACK #-}GHC.Types.Int, srcLocEndLine :: {-# UNPACK #-}GHC.Types.Int, srcLocEndCol :: {-# UNPACK #-}GHC.Types.Int}
emptyCallStack :: CallStack
@@ -9573,9 +9573,9 @@ module GHC.TypeLits where
type (-) :: Natural -> Natural -> Natural
type family (-) a b
type (<=) :: forall {t}. t -> t -> Constraint
- type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint
+ type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y)
type (<=?) :: forall k. k -> k -> GHC.Types.Bool
- type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool
+ type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False
type AppendSymbol :: Symbol -> Symbol -> Symbol
type family AppendSymbol a b
type CharToNat :: GHC.Types.Char -> Natural
@@ -9692,9 +9692,9 @@ module GHC.TypeNats where
type (-) :: Natural -> Natural -> Natural
type family (-) a b
type (<=) :: forall {t}. t -> t -> Constraint
- type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y) :: Constraint
+ type (<=) x y = GHC.Internal.TypeError.Assert (x <=? y) (GHC.Internal.Data.Type.Ord.LeErrMsg x y)
type (<=?) :: forall k. k -> k -> GHC.Types.Bool
- type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False :: GHC.Types.Bool
+ type (<=?) m n = GHC.Internal.Data.Type.Ord.OrdCond (GHC.Internal.Data.Type.Ord.Compare m n) GHC.Types.True GHC.Types.True GHC.Types.False
type CmpNat :: Natural -> Natural -> GHC.Types.Ordering
type family CmpNat a b
type Div :: Natural -> Natural -> Natural
=====================================
testsuite/tests/interface-stability/ghc-experimental-exports.stdout
=====================================
@@ -1480,9 +1480,9 @@ module Data.Tuple.Experimental where
class a => CSolo a
{-# MINIMAL #-}
type CTuple0 :: Constraint
- type CTuple0 = () :: Constraint :: Constraint
+ type CTuple0 = () :: Constraint
type CTuple1 :: Constraint -> Constraint
- type CTuple1 = CSolo :: Constraint -> Constraint
+ type CTuple1 = CSolo
type CTuple10 :: Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint
class (a, b, c, d, e, f, g, h, i, j) => CTuple10 a b c d e f g h i j
{-# MINIMAL #-}
@@ -2637,11 +2637,11 @@ module Data.Tuple.Experimental where
type Tuple0 :: *
type Tuple0 = ()
type Tuple0# :: GHC.Types.ZeroBitType
- type Tuple0# = (# #) :: GHC.Types.ZeroBitType
+ type Tuple0# = (# #)
type Tuple1 :: * -> *
- type Tuple1 = Solo :: * -> *
+ type Tuple1 = Solo
type Tuple1# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep])
- type Tuple1# = Solo# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep])
+ type Tuple1# = Solo#
type Tuple10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
data Tuple10 a b c d e f g h i j = ...
type Tuple10# :: forall (k0 :: GHC.Types.RuntimeRep) (k1 :: GHC.Types.RuntimeRep) (k2 :: GHC.Types.RuntimeRep) (k3 :: GHC.Types.RuntimeRep) (k4 :: GHC.Types.RuntimeRep) (k5 :: GHC.Types.RuntimeRep) (k6 :: GHC.Types.RuntimeRep) (k7 :: GHC.Types.RuntimeRep) (k8 :: GHC.Types.RuntimeRep) (k9 :: GHC.Types.RuntimeRep). TYPE k0 -> TYPE k1 -> TYPE k2 -> TYPE k3 -> TYPE k4 -> TYPE k5 -> TYPE k6 -> TYPE k7 -> TYPE k8 -> TYPE k9 -> TYPE (GHC.Types.TupleRep [k0, k1, k2, k3, k4, k5, k6, k7, k8, k9])
@@ -4341,7 +4341,7 @@ module GHC.PrimOps where
type Addr# :: TYPE AddrRep
data Addr#
type Any :: forall k. k
- type family Any where
+ type family Any @k where
type Array# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType
data Array# a
type ArrayArray# :: UnliftedType
@@ -4468,7 +4468,7 @@ module GHC.PrimOps where
type Levity :: *
data Levity = Lifted | Unlifted
type LiftedRep :: RuntimeRep
- type LiftedRep = BoxedRep Lifted :: RuntimeRep
+ type LiftedRep = BoxedRep Lifted
type List :: * -> *
data List a = ...
type role MVar# nominal representational
@@ -4543,7 +4543,7 @@ module GHC.PrimOps where
TypeLitNat :: GHC.Types.TypeLitSort
TypeLitSymbol :: GHC.Types.TypeLitSort
type UnliftedRep :: RuntimeRep
- type UnliftedRep = BoxedRep Unlifted :: RuntimeRep
+ type UnliftedRep = BoxedRep Unlifted
type UnliftedType :: *
type UnliftedType = TYPE UnliftedRep
type VecCount :: *
@@ -4551,7 +4551,7 @@ module GHC.PrimOps where
type VecElem :: *
data VecElem = Int8ElemRep | Int16ElemRep | Int32ElemRep | Int64ElemRep | Word8ElemRep | Word16ElemRep | Word32ElemRep | Word64ElemRep | FloatElemRep | DoubleElemRep
type Void# :: ZeroBitType
- type Void# = (# #) :: ZeroBitType
+ type Void# = (# #)
type Weak# :: forall {l :: Levity}. TYPE (BoxedRep l) -> UnliftedType
data Weak# a
type WithDict :: Constraint -> * -> Constraint
@@ -4597,7 +4597,7 @@ module GHC.PrimOps where
type WordBox :: TYPE WordRep -> *
data WordBox a = MkWordBox a
type ZeroBitRep :: RuntimeRep
- type ZeroBitRep = TupleRep '[] :: RuntimeRep
+ type ZeroBitRep = TupleRep '[]
type ZeroBitType :: *
type ZeroBitType = TYPE ZeroBitRep
acosDouble# :: Double# -> Double#
@@ -6329,9 +6329,9 @@ module Prelude.Experimental where
class a => CSolo a
{-# MINIMAL #-}
type CTuple0 :: Constraint
- type CTuple0 = () :: Constraint :: Constraint
+ type CTuple0 = () :: Constraint
type CTuple1 :: Constraint -> Constraint
- type CTuple1 = CSolo :: Constraint -> Constraint
+ type CTuple1 = CSolo
type CTuple10 :: Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint -> Constraint
class (a, b, c, d, e, f, g, h, i, j) => CTuple10 a b c d e f g h i j
{-# MINIMAL #-}
@@ -8960,11 +8960,11 @@ module Prelude.Experimental where
type Tuple0 :: *
type Tuple0 = ()
type Tuple0# :: GHC.Types.ZeroBitType
- type Tuple0# = (# #) :: GHC.Types.ZeroBitType
+ type Tuple0# = (# #)
type Tuple1 :: * -> *
- type Tuple1 = Solo :: * -> *
+ type Tuple1 = Solo
type Tuple1# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep])
- type Tuple1# = Solo# :: * -> TYPE (GHC.Types.TupleRep '[GHC.Types.LiftedRep])
+ type Tuple1# = Solo#
type Tuple10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *
data Tuple10 a b c d e f g h i j = ...
type Tuple10# :: forall (k0 :: GHC.Types.RuntimeRep) (k1 :: GHC.Types.RuntimeRep) (k2 :: GHC.Types.RuntimeRep) (k3 :: GHC.Types.RuntimeRep) (k4 :: GHC.Types.RuntimeRep) (k5 :: GHC.Types.RuntimeRep) (k6 :: GHC.Types.RuntimeRep) (k7 :: GHC.Types.RuntimeRep) (k8 :: GHC.Types.RuntimeRep) (k9 :: GHC.Types.RuntimeRep). TYPE k0 -> TYPE k1 -> TYPE k2 -> TYPE k3 -> TYPE k4 -> TYPE k5 -> TYPE k6 -> TYPE k7 -> TYPE k8 -> TYPE k9 -> TYPE (GHC.Types.TupleRep [k0, k1, k2, k3, k4, k5, k6, k7, k8, k9])
=====================================
testsuite/tests/interface-stability/template-haskell-exports.stdout
=====================================
@@ -31,7 +31,7 @@ module Language.Haskell.TH where
type Code :: (* -> *) -> forall (r :: GHC.Types.RuntimeRep). TYPE r -> *
newtype Code m a = Code {examineCode :: m (TExp a)}
type CodeQ :: forall (r :: GHC.Types.RuntimeRep). TYPE r -> *
- type CodeQ = Code Q :: forall (r :: GHC.Types.RuntimeRep). TYPE r -> *
+ type CodeQ = Code Q
type Con :: *
data Con = NormalC Name [BangType] | RecC Name [VarBangType] | InfixC BangType Name BangType | ForallC [TyVarBndr Specificity] Cxt Con | GadtC [Name] [BangType] Type | RecGadtC [Name] [VarBangType] Type
type ConQ :: *
@@ -881,7 +881,7 @@ module Language.Haskell.TH.Lib where
type ClauseQ :: *
type ClauseQ = GHC.Internal.TH.Syntax.Q GHC.Internal.TH.Syntax.Clause
type CodeQ :: forall (r :: GHC.Types.RuntimeRep). TYPE r -> *
- type CodeQ = GHC.Internal.TH.Syntax.Code GHC.Internal.TH.Syntax.Q :: forall (r :: GHC.Types.RuntimeRep). TYPE r -> *
+ type CodeQ = GHC.Internal.TH.Syntax.Code GHC.Internal.TH.Syntax.Q
type ConQ :: *
type ConQ = GHC.Internal.TH.Syntax.Q GHC.Internal.TH.Syntax.Con
type CxtQ :: *
@@ -1220,7 +1220,7 @@ module Language.Haskell.TH.Lib.Internal where
type ClauseQ :: *
type ClauseQ = GHC.Internal.TH.Syntax.Q GHC.Internal.TH.Syntax.Clause
type CodeQ :: forall (r :: GHC.Types.RuntimeRep). TYPE r -> *
- type CodeQ = GHC.Internal.TH.Syntax.Code GHC.Internal.TH.Syntax.Q :: forall (r :: GHC.Types.RuntimeRep). TYPE r -> *
+ type CodeQ = GHC.Internal.TH.Syntax.Code GHC.Internal.TH.Syntax.Q
type ConQ :: *
type ConQ = GHC.Internal.TH.Syntax.Q GHC.Internal.TH.Syntax.Con
type CxtQ :: *
=====================================
testsuite/tests/rep-poly/RepPolyBackpack3.stderr
=====================================
@@ -1,19 +1,19 @@
[1 of 3] Processing sig
- [1 of 1] Compiling Sig[sig] ( sig\Sig.hsig, nothing )
+ [1 of 1] Compiling Sig[sig] ( sig/Sig.hsig, nothing )
[2 of 3] Processing impl
Instantiating impl
- [1 of 1] Compiling Impl ( impl\Impl.hs, RepPolyBackpack3.out\impl\Impl.o )
+ [1 of 1] Compiling Impl ( impl/Impl.hs, RepPolyBackpack3.out/impl/Impl.o )
[3 of 3] Processing main
Instantiating main
[1 of 1] Including sig[Sig=impl:Impl]
Instantiating sig[Sig=impl:Impl]
- [1 of 1] Compiling Sig[sig] ( sig\Sig.hsig, RepPolyBackpack3.out\sig\sig-Absk5cIXTXe6UYhGMYGber\Sig.o )
+ [1 of 1] Compiling Sig[sig] ( sig/Sig.hsig, RepPolyBackpack3.out/sig/sig-Absk5cIXTXe6UYhGMYGber/Sig.o )
RepPolyBackpack3.bkp:17:5: error: [GHC-15843]
• Type constructor ‘Rep’ has conflicting definitions in the module
and its hsig file.
Main module: type Rep :: GHC.Types.RuntimeRep
- type Rep = T :: GHC.Types.RuntimeRep
+ type Rep = T
Hsig file: type Rep :: GHC.Types.RuntimeRep
data Rep
Illegal implementation of abstract data: Invalid type family ‘T’.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eb0131c16679a02762899735da44c0519eb81620
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eb0131c16679a02762899735da44c0519eb81620
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241207/d340ca11/attachment-0001.html>
More information about the ghc-commits
mailing list