[Haskell-cafe] automatically deriving Map and Filter on datatypes etc.

Edsko de Vries devriese at cs.tcd.ie
Thu Jun 5 05:20:21 EDT 2008


On Thu, Jun 05, 2008 at 10:39:16AM +0200, Thomas Davie wrote:
> Even deriving an instance of Functor seems rather implausable, what  
> should it do for
> 
> data Wierd a b = Nil | A a (Wierd a b) | B b (Wierd a b)
> 
> Should fmap's function argument operate on 'a's, 'b's, or both?

Generic Haskell can do all that. Read Ralf Hinze's "Generic Programs and
Proofs" for the theory:

http://www.informatik.uni-bonn.de/~ralf/publications/habilitation.pdf

Edsko


More information about the Haskell-Cafe mailing list