Re: [GHC] #12102: “Constraints in kinds” illegal family application in instance (+ documentation issues?)
GHC
ghc-devs at haskell.org
Fri Dec 7 15:13:12 UTC 2018
#12102: “Constraints in kinds” illegal family application in instance (+
documentation issues?)
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #13780, #15872 | Differential Rev(s): Phab:D5397
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott <ryan.gl.scott@…>):
In [changeset:"73cce63f33ee80f5095085141df9313ac70d1cfa/ghc"
73cce63f/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="73cce63f33ee80f5095085141df9313ac70d1cfa"
Fix #12102/#15872 by removing outdated users' guide prose
Summary:
In the beginning, #12102 (and #15872, which is of a similar
ilk) were caused by a poor, confused user trying to use code that
looks like this (with a constraint in the kind of a data type):
```lang=haskell
type family IsTypeLit a where
IsTypeLit Nat = 'True
IsTypeLit Symbol = 'True
IsTypeLit a = 'False
data T :: forall a. (IsTypeLit a ~ 'True) => a -> * where
MkNat :: T 42
MkSymbol :: T "Don't panic!"
```
Many bizarre GHC quirks (documented in those tickets) arose from
this sort of construction. Ultimately, the use of constraints in
data type kinds like this has made a lot of people very confused and
been widely regarded as a bad move.
Commit 2257a86daa72db382eb927df12a718669d5491f8 finally put this
feature out of its misery, so now the code above simply errors with
`Illegal constraint in a kind`. As a result, the aforementioned
tickets are moot, so this patch wraps a bow on the whole thing by:
1. Removing the (now outdated) section on constraints in data type
kinds from the users' guide, and
2. Adding a test case to test this code path.
Test Plan: make test TEST=T12102
Reviewers: goldfire, simonpj, bgamari, tdammers
Reviewed By: tdammers
Subscribers: tdammers, rwbarton, carter
GHC Trac Issues: #12102, #15872
Differential Revision: https://phabricator.haskell.org/D5397
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12102#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list