Opened 4 years ago

Closed 4 years ago

#11417 closed bug (fixed)

Missing context in Generics example

Reported by: dfeuer Owned by: bgamari
Priority: high Milestone: 8.0.1
Component: Core Libraries Version: 7.10.3
Keywords: Cc: ekmett
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Documentation bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The Haddocks for GHC.Generics give an example of a default implementation using Generics:

class Encode a where
  encode :: a -> [Bool]
  default encode :: (Generic a) => a -> [Bool]
  encode x = encode' (from x)

The default signature is missing some context. It should read

  default encode :: (Generic a, Encode' (Rep a)) => a -> [Bool]

Change History (4)

comment:1 Changed 4 years ago by dfeuer

I've set a short milestone and high priority because this should be an extremely quick fix. I'd submit the patch myself, but my local copy of the source is outdated and I've forgotten some procedures.

comment:2 Changed 4 years ago by dfeuer

Owner: set to bgamari

comment:3 Changed 4 years ago by Ben Gamari <ben@…>

In 91dcc65/ghc:

GHC.Generics: Fix documentation

Fixes #11417.

comment:4 Changed 4 years ago by bgamari

Resolution: fixed
Status: newclosed

I've merged this into master and ghc-8.0.

Note: See TracTickets for help on using tickets.