Polymorphism in the Prelude

adam vogt vogt.adam at gmail.com
Tue Jun 24 16:41:26 UTC 2014

On Tue, Jun 24, 2014 at 6:42 AM, Mateusz Kowalczyk
<fuuzetsu at fuuzetsu.co.uk> wrote:
> If this isn't what you meant then I'd be interested to hear. A much
> easier way of course is to simply document some example instances. I
> think pipes does something like this as you can see at [1]. The downside
> of course is that it's not automated, has to be manually kept up to date
> and the implementer might not have thought about a particular instance
> you want to see.
> [1]: https://hackage.haskell.org/package/pipes-4.1.2/docs/Pipes.html#v:for

As far as keeping things "manually up to date", it is possible to use
doctest to show and confirm things like:

>>> let f  x y = (x :: Int) + y
>>> :t f
f :: Int -> Int -> Int

But different ghc versions print types differently (type variable
names change, constraints come out in a different order, etc.), so
keeping the output up-to-date might be the same effort as manually
checking type signatures like the ones in the Pipes documentation.

More information about the Libraries mailing list