summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/GHC/Builtin/Names.hs3
-rw-r--r--compiler/GHC/Core.hs5
-rw-r--r--compiler/GHC/Core/TyCo/Rep.hs6
-rw-r--r--compiler/GHC/Core/TyCo/Tidy.hs9
-rw-r--r--compiler/GHC/Core/TyCon.hs6
-rw-r--r--compiler/GHC/Core/Type.hs18
-rw-r--r--compiler/GHC/HsToCore/Quote.hs8
-rw-r--r--compiler/GHC/Iface/Type.hs6
-rw-r--r--compiler/GHC/Tc/Errors/Hole.hs6
-rw-r--r--compiler/GHC/Tc/Gen/Head.hs8
-rw-r--r--compiler/GHC/Tc/Module.hs2
-rw-r--r--compiler/GHC/Tc/Validity.hs4
-rw-r--r--docs/users_guide/exts/scoped_type_variables.rst2
-rw-r--r--docs/users_guide/exts/static_pointers.rst12
-rw-r--r--docs/users_guide/exts/type_applications.rst29
-rw-r--r--docs/users_guide/ghci.rst5
-rw-r--r--ghc/GHCi/UI.hs1
17 files changed, 35 insertions, 95 deletions
diff --git a/compiler/GHC/Builtin/Names.hs b/compiler/GHC/Builtin/Names.hs
index a1cb4fbcb5..89dbfa5f30 100644
--- a/compiler/GHC/Builtin/Names.hs
+++ b/compiler/GHC/Builtin/Names.hs
@@ -767,12 +767,11 @@ toList_RDR = nameRdrName toListName
compose_RDR :: RdrName
compose_RDR = varQual_RDR gHC_BASE (fsLit ".")
-not_RDR, getTag_RDR, dataToTag_RDR, succ_RDR, pred_RDR, minBound_RDR, maxBound_RDR,
+not_RDR, dataToTag_RDR, succ_RDR, pred_RDR, minBound_RDR, maxBound_RDR,
and_RDR, range_RDR, inRange_RDR, index_RDR,
unsafeIndex_RDR, unsafeRangeSize_RDR :: RdrName
and_RDR = varQual_RDR gHC_CLASSES (fsLit "&&")
not_RDR = varQual_RDR gHC_CLASSES (fsLit "not")
-getTag_RDR = varQual_RDR gHC_BASE (fsLit "getTag")
dataToTag_RDR = varQual_RDR gHC_PRIM (fsLit "dataToTag#")
succ_RDR = varQual_RDR gHC_ENUM (fsLit "succ")
pred_RDR = varQual_RDR gHC_ENUM (fsLit "pred")
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs
index 2e41f9932b..cc7320f531 100644
--- a/compiler/GHC/Core.hs
+++ b/compiler/GHC/Core.hs
@@ -114,7 +114,6 @@ import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.Panic.Plain
-import GHC.Utils.Trace
import Data.Data hiding (TyCon)
import Data.Int
@@ -1601,9 +1600,7 @@ cmpAltCon (DataAlt _) DEFAULT = GT
cmpAltCon (LitAlt l1) (LitAlt l2) = l1 `compare` l2
cmpAltCon (LitAlt _) DEFAULT = GT
-cmpAltCon con1 con2 = warnPprTrace True (text "Comparing incomparable AltCons" <+>
- ppr con1 <+> ppr con2) $
- LT
+cmpAltCon con1 con2 = pprPanic "cmpAltCon" (ppr con1 $$ ppr con2)
{-
************************************************************************
diff --git a/compiler/GHC/Core/TyCo/Rep.hs b/compiler/GHC/Core/TyCo/Rep.hs
index bb7280dd0d..31c8813e10 100644
--- a/compiler/GHC/Core/TyCo/Rep.hs
+++ b/compiler/GHC/Core/TyCo/Rep.hs
@@ -713,10 +713,8 @@ data TyCoBinder
instance Outputable TyCoBinder where
ppr (Anon af ty) = ppr af <+> ppr ty
ppr (Named (Bndr v Required)) = ppr v
- -- See Note [Explicit Case Statement for Specificity]
- ppr (Named (Bndr v (Invisible spec))) = case spec of
- SpecifiedSpec -> char '@' <> ppr v
- InferredSpec -> braces (ppr v)
+ ppr (Named (Bndr v Specified)) = char '@' <> ppr v
+ ppr (Named (Bndr v Inferred)) = braces (ppr v)
-- | 'TyBinder' is like 'TyCoBinder', but there can only be 'TyVarBinder'
diff --git a/compiler/GHC/Core/TyCo/Tidy.hs b/compiler/GHC/Core/TyCo/Tidy.hs
index 96cbed6ade..97d3adf8e0 100644
--- a/compiler/GHC/Core/TyCo/Tidy.hs
+++ b/compiler/GHC/Core/TyCo/Tidy.hs
@@ -8,12 +8,10 @@ module GHC.Core.TyCo.Tidy
-- * 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
@@ -215,13 +213,6 @@ tidyTopType :: Type -> Type
tidyTopType ty = tidyType emptyTidyEnv ty
---------------
-tidyOpenKind :: TidyEnv -> Kind -> (TidyEnv, Kind)
-tidyOpenKind = tidyOpenType
-
-tidyKind :: TidyEnv -> Kind -> Kind
-tidyKind = tidyType
-
-----------------
-- | Tidy a Coercion
--
diff --git a/compiler/GHC/Core/TyCon.hs b/compiler/GHC/Core/TyCon.hs
index 24807945cc..e267932e14 100644
--- a/compiler/GHC/Core/TyCon.hs
+++ b/compiler/GHC/Core/TyCon.hs
@@ -680,10 +680,8 @@ instance OutputableBndr tv => Outputable (VarBndr tv TyConBndrVis) where
ppr_bi (AnonTCB VisArg) = text "anon-vis"
ppr_bi (AnonTCB InvisArg) = text "anon-invis"
ppr_bi (NamedTCB Required) = text "req"
- -- See Note [Explicit Case Statement for Specificity]
- ppr_bi (NamedTCB (Invisible spec)) = case spec of
- SpecifiedSpec -> text "spec"
- InferredSpec -> text "inf"
+ ppr_bi (NamedTCB Specified) = text "spec"
+ ppr_bi (NamedTCB Inferred) = text "inf"
instance Binary TyConBndrVis where
put_ bh (AnonTCB af) = do { putByte bh 0; put_ bh af }
diff --git a/compiler/GHC/Core/Type.hs b/compiler/GHC/Core/Type.hs
index cf671657b0..85cc635791 100644
--- a/compiler/GHC/Core/Type.hs
+++ b/compiler/GHC/Core/Type.hs
@@ -222,12 +222,10 @@ module GHC.Core.Type (
-- * Tidying type related things up for printing
tidyType, tidyTypes,
tidyOpenType, tidyOpenTypes,
- tidyOpenKind,
tidyVarBndr, tidyVarBndrs, tidyFreeTyCoVars,
tidyOpenTyCoVar, tidyOpenTyCoVars,
tidyTyCoVarOcc,
tidyTopType,
- tidyKind,
tidyTyCoVarBinder, tidyTyCoVarBinders,
-- * Kinds
@@ -3541,22 +3539,10 @@ tyConAppNeedsKindSig spec_inj_pos tc n_args
_ -> emptyFV
source_of_injectivity Required = True
- -- See Note [Explicit Case Statement for Specificity]
- source_of_injectivity (Invisible spec) = case spec of
- SpecifiedSpec -> spec_inj_pos
- InferredSpec -> False
+ source_of_injectivity Specified = spec_inj_pos
+ source_of_injectivity Inferred = False
{-
-Note [Explicit Case Statement for Specificity]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When pattern matching against an `ArgFlag`, you should not pattern match against
-the pattern synonyms 'Specified' or 'Inferred', as this results in a
-non-exhaustive pattern match warning.
-Instead, pattern match against 'Invisible spec' and do another case analysis on
-this specificity argument.
-The issue has been fixed in GHC 8.10 (ticket #17876). This hack can thus be
-dropped once version 8.10 is used as the minimum version for building GHC.
-
Note [When does a tycon application need an explicit kind signature?]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are a couple of places in GHC where we convert Core Types into forms that
diff --git a/compiler/GHC/HsToCore/Quote.hs b/compiler/GHC/HsToCore/Quote.hs
index 42d2742bec..6fdd87a0e3 100644
--- a/compiler/GHC/HsToCore/Quote.hs
+++ b/compiler/GHC/HsToCore/Quote.hs
@@ -2675,7 +2675,7 @@ repH98DataCon con details
arg_tys <- repPrefixConArgs ps
rep2 normalCName [unC con', unC arg_tys]
InfixCon st1 st2 -> do
- verifyLinearConstructors [st1, st2]
+ verifyLinearFields [st1, st2]
arg1 <- repBangTy (hsScaledThing st1)
arg2 <- repBangTy (hsScaledThing st2)
rep2 infixCName [unC arg1, unC con', unC arg2]
@@ -2705,8 +2705,8 @@ repGadtDataCons cons details res_ty
-- denotes a linear field.
-- This check is not performed in repRecConArgs, since the GADT record
-- syntax currently does not have a way to mark fields as nonlinear.
-verifyLinearConstructors :: [HsScaled GhcRn (LHsType GhcRn)] -> MetaM ()
-verifyLinearConstructors ps = do
+verifyLinearFields :: [HsScaled GhcRn (LHsType GhcRn)] -> MetaM ()
+verifyLinearFields ps = do
linear <- lift $ xoptM LangExt.LinearTypes
let allGood = all (\st -> case hsMult st of
HsUnrestrictedArrow _ -> not linear
@@ -2718,7 +2718,7 @@ verifyLinearConstructors ps = do
repPrefixConArgs :: [HsScaled GhcRn (LHsType GhcRn)]
-> MetaM (Core [M TH.BangType])
repPrefixConArgs ps = do
- verifyLinearConstructors ps
+ verifyLinearFields ps
repListM bangTypeTyConName repBangTy (map hsScaledThing ps)
-- Desugar the arguments in a data constructor declared with record syntax.
diff --git a/compiler/GHC/Iface/Type.hs b/compiler/GHC/Iface/Type.hs
index 407b474bac..2427bba019 100644
--- a/compiler/GHC/Iface/Type.hs
+++ b/compiler/GHC/Iface/Type.hs
@@ -862,10 +862,8 @@ pprIfaceTyConBinders suppress_sig = sep . map go
-- The above case is rare. (See Note [AnonTCB InvisArg] in GHC.Core.TyCon.)
-- Should we print these differently?
NamedTCB Required -> ppr_bndr (UseBndrParens True)
- -- See Note [Explicit Case Statement for Specificity]
- NamedTCB (Invisible spec) -> case spec of
- SpecifiedSpec -> char '@' <> ppr_bndr (UseBndrParens True)
- InferredSpec -> char '@' <> braces (ppr_bndr (UseBndrParens False))
+ NamedTCB Specified -> char '@' <> ppr_bndr (UseBndrParens True)
+ NamedTCB Inferred -> char '@' <> braces (ppr_bndr (UseBndrParens False))
where
ppr_bndr = pprIfaceTvBndr bndr suppress_sig
diff --git a/compiler/GHC/Tc/Errors/Hole.hs b/compiler/GHC/Tc/Errors/Hole.hs
index 00e948bd10..d1c727da35 100644
--- a/compiler/GHC/Tc/Errors/Hole.hs
+++ b/compiler/GHC/Tc/Errors/Hole.hs
@@ -484,12 +484,10 @@ pprHoleFit (HFDC sWrp sWrpVars sTy sProv sMs) (HoleFit {..}) =
hang display 2 provenance
where tyApp = sep $ zipWithEqual "pprHoleFit" pprArg vars hfWrap
where pprArg b arg = case binderArgFlag b of
- -- See Note [Explicit Case Statement for Specificity]
- (Invisible spec) -> case spec of
- SpecifiedSpec -> text "@" <> pprParendType arg
+ Specified -> text "@" <> pprParendType arg
-- Do not print type application for inferred
-- variables (#16456)
- InferredSpec -> empty
+ Inferred -> empty
Required -> pprPanic "pprHoleFit: bad Required"
(ppr b <+> ppr arg)
tyAppVars = sep $ punctuate comma $
diff --git a/compiler/GHC/Tc/Gen/Head.hs b/compiler/GHC/Tc/Gen/Head.hs
index 821b118ded..9fbd972f8a 100644
--- a/compiler/GHC/Tc/Gen/Head.hs
+++ b/compiler/GHC/Tc/Gen/Head.hs
@@ -483,7 +483,7 @@ tcInferRecSelId (FieldOcc sel_name lbl)
= do { thing <- tcLookup sel_name
; case thing of
ATcId { tct_id = id }
- -> do { check_naughty occ id
+ -> do { check_naughty occ id -- See Note [Local record selectors]
; check_local_id id
; return id }
@@ -1034,11 +1034,11 @@ errors in a polymorphic situation.
If this check fails (which isn't impossible) we get another chance; see
Note [Converting strings] in Convert.hs
-Local record selectors
-~~~~~~~~~~~~~~~~~~~~~~
+Note [Local record selectors]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Record selectors for TyCons in this module are ordinary local bindings,
which show up as ATcIds rather than AGlobals. So we need to check for
-naughtiness in both branches. c.f. TcTyClsBindings.mkAuxBinds.
+naughtiness in both branches. c.f. GHC.Tc.TyCl.Utils.mkRecSelBinds.
-}
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index e2a53c4f39..dca730f6f0 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -2708,7 +2708,7 @@ https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0179-printi
reverse :: forall a. [a] -> [a]
-- foo :: forall a f b. (Show a, Num b, Foldable f) => a -> f b -> String
- > :type +v foo @Int
+ > :type foo @Int
forall f b. (Show Int, Num b, Foldable f) => Int -> f b -> String
Note that Show Int is still reported, because the solver never got a chance
diff --git a/compiler/GHC/Tc/Validity.hs b/compiler/GHC/Tc/Validity.hs
index de007d0fac..c5dc68469f 100644
--- a/compiler/GHC/Tc/Validity.hs
+++ b/compiler/GHC/Tc/Validity.hs
@@ -433,7 +433,7 @@ checkTySynRhs ctxt ty
; expand <- initialExpandMode
; check_pred_ty emptyTidyEnv dflags ctxt expand ty })
else addErrTcM ( emptyTidyEnv
- , TcRnIllegalConstraintSynonymOfKind (tidyKind emptyTidyEnv actual_kind)
+ , TcRnIllegalConstraintSynonymOfKind (tidyType emptyTidyEnv actual_kind)
) }
| otherwise
@@ -923,7 +923,7 @@ forAllEscapeErr env tvbs theta tau tau_kind
-- NB: Don't tidy the sigma type since the tvbs were already tidied
-- previously, and re-tidying them will make the names of type
-- variables different from tau_kind.
- = (env, TcRnForAllEscapeError (mkSigmaTy tvbs theta tau) (tidyKind env tau_kind))
+ = (env, TcRnForAllEscapeError (mkSigmaTy tvbs theta tau) (tidyType env tau_kind))
{-
Note [Type variables escaping through kinds]
diff --git a/docs/users_guide/exts/scoped_type_variables.rst b/docs/users_guide/exts/scoped_type_variables.rst
index d8a3885fa3..fa117fc032 100644
--- a/docs/users_guide/exts/scoped_type_variables.rst
+++ b/docs/users_guide/exts/scoped_type_variables.rst
@@ -263,7 +263,7 @@ Class and instance declarations
:extension:`ScopedTypeVariables` allow the type variables bound by the top of a
``class`` or ``instance`` declaration to scope over the methods defined in the
-``where`` part. Unlike :ref`decl-type-sigs`, type variables from class and
+``where`` part. Unlike :ref:`decl-type-sigs`, type variables from class and
instance declarations can be lexically scoped without an explicit ``forall``
(although you are allowed an explicit ``forall`` in an ``instance``
declaration; see :ref:`explicit-foralls`). For example: ::
diff --git a/docs/users_guide/exts/static_pointers.rst b/docs/users_guide/exts/static_pointers.rst
index e142b14be2..d6f5e55a73 100644
--- a/docs/users_guide/exts/static_pointers.rst
+++ b/docs/users_guide/exts/static_pointers.rst
@@ -51,18 +51,18 @@ All of the following are permissible: ::
inc :: Int -> Int
inc x = x + 1
- ref1 = static 1
+ ref1 = static 'a'
ref2 = static inc
ref3 = static (inc 1)
ref4 = static ((\x -> x + 1) (1 :: Int))
- ref5 y = static (let x = 1 in x)
- ref6 y = let x = 1 in static x
+ ref5 = static (let x = 'a' in x)
+ ref6 = let x = 'a' in static x
While the following definitions are rejected: ::
ref7 y = let x = y in static x -- x is not closed
ref8 y = static (let x = 1 in y) -- y is not let-bound
- ref8 (y :: a) = let x = undefined :: a
+ ref9 (y :: a) = let x = undefined :: a
in static x -- x has a non-closed type
.. note::
@@ -99,7 +99,7 @@ expression is overloaded to allow lifting a ``StaticPtr`` into another
type implicitly, via the ``IsStatic`` class: ::
class IsStatic p where
- fromStaticPtr :: StaticPtr a -> p a
+ fromStaticPtr :: Typeable a => StaticPtr a -> p a
The only predefined instance is the obvious one that does nothing: ::
@@ -111,7 +111,7 @@ See :base-ref:`GHC.StaticPtr.IsStatic`.
Furthermore, type ``t`` is constrained to have a ``Typeable`` instance.
The following are therefore illegal: ::
- static show -- No Typeable instance for (Show a => a -> String)
+ static id -- No Typeable instance for (a -> a)
static Control.Monad.ST.runST -- No Typeable instance for ((forall s. ST s a) -> a)
That being said, with the appropriate use of wrapper datatypes, the
diff --git a/docs/users_guide/exts/type_applications.rst b/docs/users_guide/exts/type_applications.rst
index a459e1966d..00b33fe3fc 100644
--- a/docs/users_guide/exts/type_applications.rst
+++ b/docs/users_guide/exts/type_applications.rst
@@ -84,12 +84,12 @@ We can observe this behavior in a GHCi session: ::
> :set -XTypeApplications -fprint-explicit-foralls
> let myLength1 :: Foldable f => f a -> Int; myLength1 = length
- > :type +v myLength1
+ > :type myLength1
myLength1 :: forall (f :: * -> *) a. Foldable f => f a -> Int
> let myLength2 = length
- > :type +v myLength2
- myLength2 :: forall {a} {t :: * -> *}. Foldable t => t a -> Int
- > :type +v myLength2 @[]
+ > :type myLength2
+ myLength2 :: forall {t :: * -> *} {a}. Foldable t => t a -> Int
+ > :type myLength2 @[]
<interactive>:1:1: error:
• Cannot apply expression of type ‘t0 a0 -> Int’
@@ -97,30 +97,11 @@ We can observe this behavior in a GHCi session: ::
• In the expression: myLength2 @[]
Notice that since ``myLength1`` was defined with an explicit type signature,
-:ghci-cmd:`:type +v` reports that all of its type variables are available
+:ghci-cmd:`:type` reports that all of its type variables are available
for type application. On the other hand, ``myLength2`` was not given a type
signature. As a result, all of its type variables are surrounded with braces,
and trying to use visible type application with ``myLength2`` fails.
-Also note the use of :ghci-cmd:`:type +v` in the GHCi session above instead
-of :ghci-cmd:`:type`. This is because :ghci-cmd:`:type` gives you the type
-that would be inferred for a variable assigned to the expression provided
-(that is, the type of ``x`` in ``let x = <expr>``). As we saw above with
-``myLength2``, this type will have no variables available to visible type
-application. On the other hand, :ghci-cmd:`:type +v` gives you the actual
-type of the expression provided. To illustrate this: ::
-
- > :type myLength1
- myLength1 :: forall {a} {f :: * -> *}. Foldable f => f a -> Int
- > :type myLength2
- myLength2 :: forall {a} {t :: * -> *}. Foldable t => t a -> Int
-
-Using :ghci-cmd:`:type` might lead one to conclude that none of the type
-variables in ``myLength1``'s type signature are available for type
-application. This isn't true, however! Be sure to use :ghci-cmd:`:type +v`
-if you want the most accurate information with respect to visible type
-application properties.
-
.. index::
single: ScopedSort
diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst
index bec44f969a..72fba318bf 100644
--- a/docs/users_guide/ghci.rst
+++ b/docs/users_guide/ghci.rst
@@ -2948,11 +2948,6 @@ commonly used commands.
*X> :type length
length :: Foldable t => t a -> Int
-.. ghci-cmd:: :type +v; ⟨expression⟩
-
- Infers and prints the type of ⟨expression⟩, binding inferred type variables
- with :ref:`*specified* visibility <inferred-vs-specified>`.
-
.. ghci-cmd:: :type +d; ⟨expression⟩
Infers and prints the type of ⟨expression⟩, instantiating *all* the forall
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 58bbf4f6fe..b628575362 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -347,7 +347,6 @@ defFullHelpText =
" :script <file> run the script <file>\n" ++
" :type <expr> show the type of <expr>\n" ++
" :type +d <expr> show the type of <expr>, defaulting type variables\n" ++
- " :type +v <expr> show the type of <expr>, with its specified tyvars\n" ++
" :unadd <module> ... remove module(s) from the current target set\n" ++
" :undef <cmd> undefine user-defined command :<cmd>\n" ++
" ::<cmd> run the builtin command\n" ++