Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
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
Travis Whitaker
GHC
Commits
df021fb1
Commit
df021fb1
authored
May 08, 2020
by
Icelandjack
Committed by
Marge Bot
May 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document (->) using inferred quantification for its runtime representations.
Fixes #18142.
parent
b17574f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
+26
-6
compiler/GHC/Builtin/Types/Prim.hs
compiler/GHC/Builtin/Types/Prim.hs
+16
-2
compiler/GHC/Core/Coercion.hs
compiler/GHC/Core/Coercion.hs
+3
-1
compiler/GHC/Core/TyCo/Rep.hs
compiler/GHC/Core/TyCo/Rep.hs
+4
-1
compiler/GHC/Core/Type.hs
compiler/GHC/Core/Type.hs
+3
-2
No files found.
compiler/GHC/Builtin/Types/Prim.hs
View file @
df021fb1
...
...
@@ -399,9 +399,23 @@ funTyConName = mkPrimTyConName (fsLit "->") funTyConKey funTyCon
-- | The @(->)@ type constructor.
--
-- @
-- (->) :: forall
(rep1 :: RuntimeRep) (rep2 :: RuntimeRep)
.
-- TYPE rep1 -> TYPE rep2 ->
*
-- (->) :: forall
{rep1 :: RuntimeRep} {rep2 :: RuntimeRep}
.
-- TYPE rep1 -> TYPE rep2 ->
Type
-- @
--
-- The runtime representations quantification is left inferred. This
-- means they cannot be specified with @-XTypeApplications@.
--
-- This is a deliberate choice to allow future extensions to the
-- function arrow. To allow visible application a type synonym can be
-- defined:
--
-- @
-- type Arr :: forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep).
-- TYPE rep1 -> TYPE rep2 -> Type
-- type Arr = (->)
-- @
--
funTyCon
::
TyCon
funTyCon
=
mkFunTyCon
funTyConName
tc_bndrs
tc_rep_nm
where
...
...
compiler/GHC/Core/Coercion.hs
View file @
df021fb1
...
...
@@ -292,7 +292,9 @@ tidyCoAxBndrsForUser init_env tcvs
Note [Function coercions]
~~~~~~~~~~~~~~~~~~~~~~~~~
Remember that
(->) :: forall r1 r2. TYPE r1 -> TYPE r2 -> TYPE LiftedRep
(->) :: forall {r1} {r2}. TYPE r1 -> TYPE r2 -> TYPE LiftedRep
whose `RuntimeRep' arguments are intentionally marked inferred to
avoid type application.
Hence
FunCo r co1 co2 :: (s1->t1) ~r (s2->t2)
...
...
compiler/GHC/Core/TyCo/Rep.hs
View file @
df021fb1
...
...
@@ -255,12 +255,15 @@ about it!
* FFunTy is the data constructor, meaning "full function type".
* The function type constructor (->) has kind
(->) :: forall
r1 r2
. TYPE r1 -> TYPE r2 -> Type LiftedRep
(->) :: forall
{r1} {r2}
. TYPE r1 -> TYPE r2 -> Type LiftedRep
mkTyConApp ensure that we convert a saturated application
TyConApp (->) [r1,r2,t1,t2] into FunTy t1 t2
dropping the 'r1' and 'r2' arguments; they are easily recovered
from 't1' and 't2'.
* For the time being its RuntimeRep quantifiers are left
inferred. This is to allow for it to evolve.
* The ft_af field says whether or not this is an invisible argument
VisArg: t1 -> t2 Ordinary function type
InvisArg: t1 => t2 t1 is guaranteed to be a predicate type,
...
...
compiler/GHC/Core/Type.hs
View file @
df021fb1
...
...
@@ -1012,9 +1012,10 @@ Note [Representation of function types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Functions (e.g. Int -> Char) can be thought of as being applications
of funTyCon (known in Haskell surface syntax as (->)),
of funTyCon (known in Haskell surface syntax as (->)), (note that
`RuntimeRep' quantifiers are left inferred)
(->) :: forall
(r1 :: RuntimeRep) (r2 :: RuntimeRep)
(->) :: forall
{r1 :: RuntimeRep} {r2 :: RuntimeRep}
(a :: TYPE r1) (b :: TYPE r2).
a -> b -> Type
...
...
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