[Haskell-cafe] LiberalTypeSynonyms: documentation issue

Obscaenvs obscaenvs at gmail.com
Sat Nov 2 18:29:54 UTC 2013


In the docs for GHC 7.6.3, e.g. at [1], it is said that one can use
LiberalTypeSynonyms as so:

`type Discard a = forall b. Show b => a -> b -> (a, String)`

This is, however, not possible without RankNTypes which is stated in a
tutorial at FPComplete [2] and, of course, GHC 7.6.3 itself says so when
trying to compile something with the above definition for Discard:
`
Illegal polymorphic or qualified type:
      forall b. Show b => a -> b -> (a, String)
    Perhaps you intended to use -XRankNTypes or -XRank2Types
    In the type declaration for `Discard'
`

Maybe the GHC User Guide should be updated to reflect this?

/Fredrik

References:

[1]
http://www.bugthunk.net/ghc/docs/7.6.3/html/users_guide_repl/data-type-extensions.html#type-synonyms

[2]
https://www.fpcomplete.com/school/to-infinity-and-beyond/pick-of-the-week/guide-to-ghc-extensions/explicit-forall#interaction-with-liberaltypesynonyms


More information about the Haskell-Cafe mailing list