
Gentle GHC users I'm thinking of removing the "Derivable type classes" stuff from GHC. It's described in a paper that Ralph Hinze and I wrote http://research.microsoft.com/~simonpj/Papers/derive.htm and in the GHC user manual at http://www.haskell.org/ghc/docs/latest/html/users_guide/generic-classes. html But it's quite complicated to implement, it's incomplete (needs constructor-name stuff, and better lifting), and it sometimes gives huge types in the intermediate language (because of the encoding into tuples). So the benefit-to-cost ratio seems poor. Instead, I'm planning to implement the "Scrap your boilerplate" ideas for generic programming, described in another paper http://research.microsoft.com/~simonpj/papers/hmap/ The plan would be to automatically derive classes 'Typable' and 'Term' for every data type, and make TypeReps a bit more efficient and clean. Now, I could add the latter without removing the former, but GHC is big and fat enough already. So this message is really to ask is anyone actually using the derivable-type-class stuff? does anyone mind if they die Speak now or forever hold your peace. Simon Just to remind you, derivable type classes let you write definitions like class Eq t where (==), (/=) :: t -> t -> Bool -- generic default method (==){1} Unit Unit = True (==){a + b} (Inl x1) (Inl x2) = x1 == x2 (==){a + b} (Inr y1) (Inr y2) = y1 == y2 (==){a + b} _ _ = False (==){a * b} (x1 :*: y1) (x2 :*: y2) = x1 == x2 && y1 == y2
participants (1)
-
Simon Peyton-Jones