Re: [Haskell-cafe] Difference between class and instance contexts

2011-08-03 Thread Miguel Mitrofanov
Try :t (foo 2, moo 2) On 3 Aug 2011, at 23:31, Patrick Browne wrote: > Below are examples of using the sub-class context at class level and at > instance level. > In this simple case they seem to give the same results > In general, are there certain situations in which one or the other is > p

Re: [Haskell-cafe] Difference between class and instance contexts

2011-08-03 Thread Chris Smith
On Aug 3, 2011 1:33 PM, "Patrick Browne" wrote: > instance Class Integer => SubClass Integer where >moo a = foo a Since you've just written the Class instance for Integer, the superclass context is actually irrelevant there. You may as well just write instance SubClass Integer where moo

[Haskell-cafe] Difference between class and instance contexts

2011-08-03 Thread Patrick Browne
Below are examples of using the sub-class context at class level and at instance level. In this simple case they seem to give the same resultsIn general, are there certain situations in which one or the other is preferred? Patmodule CLASS where-- class and sub-classclass Class a where foo :: a -> a