[GHC] #13962: GHCi allows unsaturated type family

GHC ghc-devs at haskell.org
Tue Jan 8 19:34:10 UTC 2019


#13962: GHCi allows unsaturated type family
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:  wontfix           |             Keywords:  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #12089, #16013    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * related:  #12089 => #12089, #16013


Comment:

 Note that we opted to disallow unsaturated type synonyms/families in GHCi
 when not at the top level in commit
 [https://gitlab.haskell.org/ghc/ghc/commit/6b70cf611e5ddc475edaa54b893d20990699ddb8
 6b70cf611e5ddc475edaa54b893d20990699ddb8]:

 {{{
 commit 6b70cf611e5ddc475edaa54b893d20990699ddb8
 Author: Ryan Scott <ryan.gl.scott at gmail.com>
 Date:   Tue Jan 8 07:37:18 2019 -0500

     Be pickier about unsaturated synonyms in :kind

     Summary:
     We currently permit any and all uses of unsaturated type
     synonyms and type families in GHCi's `:kind` command, which allows
     strange interactions like this one:

     ```
     > :set -XTypeFamilies -XPolyKinds
     > type family Id (a :: k)
     > type instance Id a = a
     > type Foo x = Maybe
     > :kind! Id Foo
     ```

     This is probably a stretch too far, so this patch moves to disallow
     unsaturated synonyms that aren't at the top level (we still want to
     allow `:kind Id`, for instance). We do this by augmenting `GhciCtxt`
     with an additional `Bool` field to indicate if we are at the
     outermost level of the type being passed to `:kind` or not. See
     `Note [Unsaturated type synonyms in GHCi]` in `TcValidity` for the
     full story.

     Test Plan: make test TEST=T16013

     Reviewers: goldfire, bgamari

     Reviewed By: goldfire

     Subscribers: simonpj, goldfire, rwbarton, carter

     GHC Trac Issues: #16013

     Differential Revision: https://phabricator.haskell.org/D5471
 }}}

 See #16013.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13962#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list