Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Glasgow Haskell Compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
0ce66be9
Commit
0ce66be9
authored
Nov 06, 2018
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments adding to the fix for Trac #15859
parent
fe057642
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcExpr.hs
+24
-4
compiler/types/TyCoRep.hs
compiler/types/TyCoRep.hs
+4
-1
No files found.
compiler/typecheck/TcExpr.hs
View file @
0ce66be9
...
...
@@ -1331,8 +1331,9 @@ tcArgs fun orig_fun_ty fun_orig orig_args herald
;
case
tcSplitForAllTy_maybe
upsilon_ty
of
Just
(
tvb
,
inner_ty
)
|
binderArgFlag
tvb
==
Specified
->
-- It really can't be Inferred, because we've just instantiated those
-- But, oddly, it might just be Required. See #15859.
-- It really can't be Inferred, because we've justn
-- instantiated those. But, oddly, it might just be Required.
-- See Note [Required quantifiers in the type of a term]
do
{
let
tv
=
binderVar
tvb
kind
=
tyVarKind
tv
;
ty_arg
<-
tcHsTypeApp
hs_ty_arg
kind
...
...
@@ -1381,8 +1382,27 @@ tcArgs fun orig_fun_ty fun_orig orig_args herald
text
"Cannot apply expression of type"
<+>
quotes
(
ppr
ty
)
$$
text
"to a visible type argument"
<+>
quotes
(
ppr
arg
)
}
{- Note [Visible type application zonk]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{- Note [Required quantifiers in the type of a term]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider (Trac #15859)
data A k :: k -> Type -- A :: forall k -> k -> Type
type KindOf (a :: k) = k -- KindOf :: forall k. k -> Type
a = (undefind :: KindOf A) @Int
With ImpredicativeTypes (thin ice, I know), we instantiate
KindOf at type (forall k -> k -> Type), so
KindOf A = forall k -> k -> Type
whose first argument is Required
We want to reject this type application to Int, but in earlier
GHCs we had an ASSERT that Required could not occur here.
The ice is thin; c.f. Note [No Required TyCoBinder in terms]
in TyCoRep.
Note [Visible type application zonk]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Substitutions should be kind-preserving, so we need kind(tv) = kind(ty_arg).
* tcHsTypeApp only guarantees that
...
...
compiler/types/TyCoRep.hs
View file @
0ce66be9
...
...
@@ -711,7 +711,7 @@ See also Note [Required, Specified, and Inferred for types] in TcTyClsDecls
Visible Type Applications paper (ESOP'16).
Note [No Required TyCoBinder in terms]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
We don't allow Required foralls for term variables, including pattern
synonyms and data constructors. Why? Because then an application
would need a /compulsory/ type argument (possibly without an "@"?),
...
...
@@ -719,6 +719,9 @@ thus (f Int); and we don't have concrete syntax for that.
We could change this decision, but Required, Named TyCoBinders are rare
anyway. (Most are Anons.)
However the type of a term can (just about) have a required quantifier;
see Note [Required quantifiers in the type of a term] in TcExpr.
-}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment