[Haskell-cafe] typeclass question

Jonathan Cast jonathanccast at fastmail.fm
Thu Sep 11 12:39:14 EDT 2008

On Thu, 2008-09-11 at 18:34 +0200, Johannes Waldmann wrote:
> >> if support for this simple shape of dependencies ( ... | a -> b )  ...
> > For backwards-compatibility reasons, 
> Yes.

This gives point, then, to my concerns about letting Haskell become a
practical language.  At some point, production systems always seem to be
end-of-lifed by backwards compatibility.

> > or because you think they're better than type families?
> Don't know (haven't used them).
> Concrete example: I have  this "class Partial p i b | p i -> b"
> http://dfa.imn.htwk-leipzig.de/cgi-bin/cvsweb/tool/src/Challenger/Partial.hs?rev=1.28
> What would type families buy me here?

I can't figure out what b is.  I could, of course, argue that it would
force you to come up with a name for `b', so people reading the code
could understand what it does.

> In my code, this class has tons of instances (I count 80).
> How much would I need to change them?

   instance Partial p i b where
=> instance Partial p i
     type B p i = b

And type signatures involving Partial would have to change.

>  Could this be automated?

To a certain extent.  Finding the places that need to change could be
automated, which is always the first step :)


More information about the Haskell-Cafe mailing list