Why is TH `newtype Q` documented as `data Q` on Hackage?

Viewed 64

Is this a documentation bug or something else?

1 Answers

It is not a bug. Haddock prints all abstract types as data. The thought is this: the type is being held abstract so that the library author can change the internal representation without the users knowing (or needing to). Since the library author might change between newtype and data, and the users are not supposed to know about this, both ways of creating a new type must be presented the same way in the haddocks.

Given that, the choice between using newtype for both or data for both seems clear to me: data is much more frequently used and more easily understood for beginners.

Related