[Haskell-cafe] Re: type class question
Peter Padawitz
peter.padawitz at udo.edu
Mon Dec 10 07:48:28 EST 2007
Jules Bean wrote:
> Peter Padawitz wrote:
>
>> What is so bad about making compFoo part of the class? It reduces the
>> code (constraints can be avoided) and reflects the close connection
>> between a signature Sig (implemented by the class) and the
>> evaluation (compFoo) of Sig-terms in Sig-algebras.
>
>
> making it part of the class allows instances to override the
> implementation.
>
> Which in this case is a strange thing to do.
Sure, but this can only happen because Haskell does not check whether
the instances satisfy the equations in the class. The type class concept
would be "cleaner" if all methods (partially or totally) defined by
equations within the class were not allowed to be instantiated!
More information about the Haskell-Cafe
mailing list