Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reinier Maas
GHC
Commits
50b9f75d
Commit
50b9f75d
authored
1 year ago
by
Artin Ghasivand
Browse files
Options
Downloads
Patches
Plain Diff
Added StandaloneKindSignature examples to replace CUSKs ones
parent
d6f807ec
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/users_guide/exts/poly_kinds.rst
+19
-7
19 additions, 7 deletions
docs/users_guide/exts/poly_kinds.rst
with
19 additions
and
7 deletions
docs/users_guide/exts/poly_kinds.rst
+
19
−
7
View file @
50b9f75d
...
@@ -649,7 +649,7 @@ Kind inference for data/newtype instance declarations
...
@@ -649,7 +649,7 @@ Kind inference for data/newtype instance declarations
Consider these declarations ::
Consider these declarations ::
data family T :: forall k. (k->Type) -> k -> Type
data family T :: forall k. (k
->
Type) -> k -> Type
data instance T p q where
data instance T p q where
MkT :: forall r. r Int -> T r Int
MkT :: forall r. r Int -> T r Int
...
@@ -657,13 +657,13 @@ Consider these declarations ::
...
@@ -657,13 +657,13 @@ Consider these declarations ::
Here ``T`` has an invisible kind argument; and perhaps it is instantiated
Here ``T`` has an invisible kind argument; and perhaps it is instantiated
to ``Type`` in the instance, thus::
to ``Type`` in the instance, thus::
data instance T @Type (p :: Type->Type) (q :: Type) where
data instance T @Type (p :: Type
->
Type) (q :: Type) where
MkT :: forall r. r Int -> T r Int
MkT :: forall r. r Int -> T r Int
Or perhaps we intended the specialisation to be in the GADT data
Or perhaps we intended the specialisation to be in the GADT data
constructor, thus::
constructor, thus::
data instance T @k (p :: k->Type) (q :: k) where
data instance T @k (p :: k
->
Type) (q :: k) where
MkT :: forall r. r Int -> T @Type r Int
MkT :: forall r. r Int -> T @Type r Int
It gets more complicated if there are multiple constructors. In
It gets more complicated if there are multiple constructors. In
...
@@ -775,6 +775,11 @@ Closed type family instances are subject to the same rules: ::
...
@@ -775,6 +775,11 @@ Closed type family instances are subject to the same rules: ::
type family F :: Maybe (Maybe k) where
type family F :: Maybe (Maybe k) where
F = Just (Nothing :: Maybe k) -- rejected: k not in scope
F = Just (Nothing :: Maybe k) -- rejected: k not in scope
type F :: forall k. Maybe (Maybe k)
type family F @k where
F @k = Just (Nothing :: Maybe k) -- accepted
-- CUSKs version (Legacy)
type family F :: Maybe (Maybe k) where
type family F :: Maybe (Maybe k) where
F @k = Just (Nothing :: Maybe k) -- accepted
F @k = Just (Nothing :: Maybe k) -- accepted
...
@@ -858,10 +863,17 @@ For example: ::
...
@@ -858,10 +863,17 @@ For example: ::
F2 x = x
F2 x = x
-- F2 fails to compile: no complete signature
-- F2 fails to compile: no complete signature
type family F3 (a :: k) :: k where
type F3 :: k -> k
F3 True = False
type family F3 a where
F3 False = True
F3 True = False
F3 x = x
F3 False = True
F3 x = x
-- CUSKs version (legacy)
type family F4 (a :: k) :: k where
F4 True = False
F4 False = True
F4 x = x
-- OK
-- OK
Higher-rank kinds
Higher-rank kinds
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment