[Haskell-cafe] Re: Decoupling type classes (e.g. Applicative)?
uzytkownik2 at gmail.com
Wed Nov 3 21:30:34 EDT 2010
On Tue, 2010-11-02 at 21:57 -0400, Brandon S Allbery KF8NH wrote:
> On 10/29/10 09:35 , Dominique Devriese wrote:
> > * Only introduce a dependency from type class A to type class B if all
> > functions in type class B can be implemented in terms of the
> > functions in type class A or if type class A is empty.
> Er? Eq a => Ord a makes perfect sense in context but violates this law.
x == y = case x `compare` y of EQ -> True; _ -> False
Or using (==) inside definition:
(==) = ((== EQ) .) . compare
Class A - Ord, B - Eq.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 836 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20101103/8fb9ff76/attachment.bin
More information about the Haskell-Cafe