Deriving Functor

Ross Paterson ross at soi.city.ac.uk
Sun Mar 11 08:10:39 EDT 2007


On Thu, Mar 08, 2007 at 09:00:51PM +0100, Twan van Laarhoven wrote:
> I would like to propose to add a way to automatically derive instances 
> of Functor. From looking at existing code, it seems that almost all 
> Functor instances I see are derivable using the algorithm presented 
> here, resulting in less boilerplate code. This proposal is compatible 
> with Haskell98 (and therefore also with Haskell').

I don't know if you've seen Ralf Hinze's "Polytypic values possess
polykinded types", but the map example there is relevant.  (Also to the
semantics of newtype deriving that you posted a while ago.)

	http://www.informatik.uni-bonn.de/~ralf/publications/SCP.ps.gz

Even if you handle contrapositive arguments (like the first argument
of ->), there will still be things like

	newtype Endo a = Endo (a -> a)



More information about the Haskell-prime mailing list