[GHC] #16119: Hide the gnarly levity polymorphism stuff in the signatures of `undefined`, `throw`, etc

GHC ghc-devs at haskell.org
Wed Jan 2 04:32:10 UTC 2019


#16119: Hide the gnarly levity polymorphism stuff in the signatures of `undefined`,
`throw`, etc
-------------------------------------+-------------------------------------
           Reporter:  jberryman      |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:                 |           Version:  8.6.3
  libraries/base                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 In base-4.12, `throw` goes from

 {{{#!hs
 throw :: Exception e => e -> a
 }}}

 to

 {{{#!hs
 throw :: forall (r :: RuntimeRep). forall (a :: TYPE r). forall e.
 Exception e => e -> a
 }}}

 http://hackage.haskell.org/package/base-4.12.0.0/docs/Control-Exception-
 Base.html#v:throw

 Similar story for `undefined`. Even as a fairly experienced haskell
 programmer I find the signature difficult to parse, leaving aside the
 meaning of `RuntimeRep` and `TYPE`. The amount of research an expert in
 Haskell 98 would have to do to thoroughly understand that signature is
 unreasonable (the various meanings of `forall`, `DataKinds`, as well as
 the levity polymorphism stuff).

 I don't have a proposed solution, but a constraint synonym or something
 that hid `RuntimeRep` and `TYPE`, and which could be documented with "This
 means a type with any runtime representation; everything is fine" would be
 okay.

 Relevant:
 https://ghc.haskell.org/trac/ghc/ticket/12030
 https://ghc.haskell.org/trac/ghc/ticket/11549

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


More information about the ghc-tickets mailing list