[Haskell-cafe] Re: Haddock: Documentation of instances with un-documentable type arguments

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Wed Aug 25 07:36:05 EDT 2010


> Perhaps Haddock could exclude class instance reporting [...]

Instances are global, and cannot be hidden.
You cannot prevent their use, so you might as well document them.

Otherwise you'll have users complaining when they assume
the instance isn't there, and write their own,
and then see the error message, but don't find the explanation
in the documentation.

(rant follows)

Yes, globality is bad. - One could wish for (e.g.)
"let foo :: [Foo] = sort bar where instance Ord Foo where ..."
Of course this is not Haskell, and that's why there is sortBy etc,
where the extra argument corresponds to the dictionary
of the type class. Presumably this could be hidden as an
implicit parameter, so I guess local instances could be made to work.
And local types as well? Sometimes I want them.

Heretically speaking, since Java has this (local types),
1. there must be a reason, and 2. there is a way to implement it
(well, at least something like "it").

J.W.



More information about the Haskell-Cafe mailing list