[Haskell-cafe] Re: type class question

Jules Bean jules at jellybean.co.uk
Mon Dec 10 06:34:32 EST 2007

Try again without missing out the list...

Peter Padawitz wrote:
 > Jules Bean wrote:
 >> Incidentally, I question why the "compFoo" are methods. Why not just 
make them polymorphic functions? They don't look like you expect 
instances to change them. The code continues to compile if I make them 
functions and amend their signatures as required.
 > I put compFoo into the class for the same reason why /= is part of 
the class Eq: both functions are unique as soon as the others have been 

I believe you misunderstand the reason.

/= is part of Eq in case a particular instance has a particularly 
efficient way to implement /=, rather than using not and (==).

"Being unique as soon as the others are implemented" is not a reason not 
to make it a method.

compBlock :: (Java block command intE boolE) => Block -> block
compBlock = block_ . map compCommand

still retains that property.


More information about the Haskell-Cafe mailing list