• Ryan Scott's avatar
    Fix #12102/#15872 by removing outdated users' guide prose · 73cce63f
    Ryan Scott authored
    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):
    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 2257a86d 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
glasgow_exts.rst 587 KB