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

#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

#16119: Hide the gnarly levity polymorphism stuff in the signatures of `undefined`, `throw`, etc -------------------------------------+------------------------------------- Reporter: jberryman | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by harpocrates): This is gonna be easily fixable once Hi Haddock lands. See https://github.com/haskell/haddock/pull/941 in particular. There's going to be a module-level Haddock option for controlling whether levity polymorphic signatures in that module get defaulted or not. If we want `throw :: Exception e => e -> a`, we'll have to add `{-# OPTIONS_HADDOCK print-runtime-reps #-}` to the top of `Control.Exception.Base`. Personally, I'd lean towards leaving the `throw`'s levity polymorphic signature in `Control.Exception.Base` and defaulting the re-export in `Control.Exception`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16119#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16119: Hide the gnarly levity polymorphism stuff in the signatures of `undefined`, `throw`, etc -------------------------------------+------------------------------------- Reporter: jberryman | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by harpocrates): * cc: harpocrates (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16119#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC