Changes between Version 3 and Version 4 of DerivingInstances


Ignore:
Timestamp:
Apr 15, 2008 1:20:38 AM (6 years ago)
Author:
john@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DerivingInstances

    v3 v4  
    3737http://haskell.org/haskellwiki/GHC/Stand-alone_deriving_declarations contains a great discussion of some of these ideas. (NB. Section 3 is misleading: leaving the clauses out of an instance declaration ''does not'' leave all the methods undefined; rather it gives the default methods of the class). 
    3838 
     39As there are only a few fixed methods/classes that can be derived, we may choose not to have any special syntax for the few derived methods, but just put a comment in the code: 
     40{{{ 
     41class Eq a where 
     42  (==) :: a -> a -> Bool 
     43  (/=) :: a -> a -> Bool 
     44  -- (==) has a magic way of be derived for datatypes  
     45  x /= y = not (x == y) 
     46}}} 
    3947 
    4048 
     49