Skip to content

Hide the gnarly levity polymorphism stuff in the signatures of `undefined`, `throw`, etc

In base-4.12, throw goes from

throw :: Exception e => e -> a

to

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: #12030 (closed) #11549 (closed)

Trac metadata
Trac field Value
Version 8.6.3
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information