[Haskell-cafe] typeclass question

Henning Thielemann lemming at henning-thielemann.de
Thu Sep 11 06:33:36 EDT 2008


On Thu, 11 Sep 2008, Tim Docker wrote:

> I have a typeclass related question that I have been puzzling over.
>
> In a library I am working on, I have a series of functions for
> converting values to Renderables:
>
> | labelToRenderable :: Label -> Renderable
> | legendToRenderable :: Legend -> Renderable
> | axisToRenderable :: Axis v -> Renderable
> | layoutToRenderable :: Layout x y -> Renderable
>
> These names are overloaded for convenience via a typeclass:

I think that type classes are not for keystroke reduction, but for writing 
generic algorithms. If there is no algorithm that becomes more generic by 
the use of a type class, I would not use a type class, but stick to 
labelToRenderable and friends.


More information about the Haskell-Cafe mailing list