[Haskell-cafe] Type classes vr.s functions

Brian Hurt bhurt at spnz.org
Sat Dec 20 20:20:21 EST 2008

So, style question for people, if I can.  I have a certain problem-
basically, I have a bunch of functions which need a special function,
of type a -> Foo say.  And a bunch of other functions which can define
that function on some type of interest, and then what to call the first
batch of functions.  I can do this either by defining a type class,
something like:
class Fooable a where
     toFoo :: a -> Foo
or I can simply have all the functions which need a toFoo take an extra
agrument.  Performance really isn't that important here, so it's really
a matter of style- which approach would people prefer in this case?


More information about the Haskell-Cafe mailing list