[GHC] #12679: Permit abstract data types in signatures that don't have kind *

GHC ghc-devs at haskell.org
Mon Oct 10 06:40:33 UTC 2016


#12679: Permit abstract data types in signatures that don't have kind *
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  low            |         Milestone:
          Component:  Compiler       |           Version:  8.1
  (Type checker)                     |
           Keywords:  backpack       |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Here is a fascinating program that I would like to write, but cannot with
 Backpack today:

 {{{
 unit p where
     signature Key where
         import GHC.Exts (Constraint)
         data Key k :: Constraint
         instance Key Bool
     signature Map where
         import Key
         data Map k a
         empty :: Map k a
         insert :: Key k => k -> a -> Map k a -> Map k a
         lookup :: Key k => k -> Map k a -> Maybe a
     signature Keys where
         import Map
     module M where
         import Map
         import Key
         x = insert True "foo" empty
 }}}

 `data Key k :: Constraint` is implementable, because we can implement
 abstract data types using type synonyms in Backpack, and synonyms can have
 more kinds than just `*`. However, GHC chokes on this declaration, because
 it thinks that data types always have to have kind `*`.

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


More information about the ghc-tickets mailing list