Skip to content

Invalid example in ScopedTypeVariables documentation

Summary

In GHC user's guide, the last section of the ScopedTypeVariables explanation contains this example:

class D a where
  m :: [a] -> a

instance D [a] where
  m :: [a] -> [a]
  m = reverse

The preceding text claims that "the example will be accepted without explicitly enabling ScopedTypeVariables" but in fact the example can't compile with any combination of extensions.

Proposed improvements or changes

This instance would compile and fit in the context:

instance D [a] where
  m :: [[a]] -> [a]
  m = concat
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information