[Haskell-cafe] typeclass question
iavor.diatchki at gmail.com
Thu Sep 11 13:01:50 EDT 2008
Your example seems like a perfect fit for functional dependencies.
On Thu, Sep 11, 2008 at 3:36 AM, Tim Docker <twd2 at dockerz.net> wrote:
> Well, it's a library that others might use, so I would prefer to avoid
> using language extensions, especially functional deps which I don't
> understand, and which seem to have an uncertain future.
I completely agree with you that it is a good idea to stick to
Haskell'98 when you can, especially in library code, so you'll have to
decide if you really want to use the class. As for not understanding
functional dependencies, it sounds like you are not giving yourself
enough credit. Your previous comment basically contains the
definition of a functional dependency:
| But the above is, I think, too general for my needs. I don't want
| to be able to generate Renderables of different type b for a single input
| type a.
This is all there is to a fun. dep., from a programmer's
perspective---it adds a constraint on the instances one can declare
for a given multi-parameter type class.
Hope this helps,
More information about the Haskell-Cafe