automatic derivation of map, foldl, etc...

Bert Thompson aet at cs.mu.OZ.AU
Wed Sep 23 13:09:25 AEST 1998


Lee,

Re: your previous posting on the automatic generation of higher-order
function such as map and foldl on data types.

Mark Jones presented something similar in a paper on his `constructor classes'.
However he uses
a) the Haskell typeclass system 
b) his constructor classes extension 
c) a monad for `map-ish' datatypes

Anyway, the point of this posting is that DJ's typeclass work in Haskell
may well allow you to do pretty much what you suggested with minimal work.
Mercury would need something like Haskell's `deriving' construct, as
Fergus mentioned.

You can get his constructor classes paper at:
	http://www.cs.nott.ac.uk/~mpj/fpca93.html
Also, you can see how it's implemented in the Gofer 2.30a constructor
classes prelude:
	munkora:/usr/local/apps/gofer2.30a/lib/Gofer/lib/cc.prelude
	(Grep for map, foldr and Monad.)

DJ, is this doable in Mercury?

Bert



More information about the developers mailing list