[Haskell-cafe] type class design

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Sun Oct 31 17:43:08 EDT 2010

On 30 October 2010 22:44, Uwe Schmidt <uwe at fh-wedel.de> wrote:
>> Another possible argument: large type classes can look daunting for
>> both implementors and users, even if only one or two methods need to
>> be defined for a minimal instantiation (I'm tring to work out what to
>> do here myself, as I have some typeclasses that for efficiency reasons
>> it might be nice to have more methods in the class, but it makes it a
>> little overwhelming).
> But by putting just a small part of the interface into the class
> does not make the live of a user any simpler.
> The user usually has to know the whole interface of the module.
> Or am I missing something?

Well, if you have a small class then it's possible for you to split up
the different types of functions to be in different modules into more
logical sub-types, etc.

Also, I find the documentation for the list functions in the Prelude
and Data.List easier to read than the ones in ListLike [1], partially
because typical documentation for class methods is typically smaller
and more compact than the stand-alone functions.

[1]: http://hackage.haskell.org/package/ListLike

Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com

More information about the Haskell-Cafe mailing list