[TYPES] uses of higher-order/applicative functors in practice

Derek Dreyer dreyer at tti-c.org
Wed Feb 23 19:01:52 EST 2005

I am interested in compiling examples of real ML code where higher-order 
and/or applicative functors are used in essential ways.  In the same way 
that much of the literature on type theory for OOP reduces life to 
"points" and "colored points", much of the literature on type theory of 
module systems is motivated by the singularly useless "apply" functor. 
I would like to remedy this situation, if possible.

A "higher-order" functor is one that takes another functor as one of its 
arguments or returns another functor as a component in the result.  I am 
particularly interested in hearing about examples of the first kind 
(which takes another functor as an argument), because it is the first 
kind that causes more semantic difficulties.

An "applicative" functor has the property that it if you apply it twice 
to the same argument module, you get out result modules with equivalent 
abstract type components.  In O'Caml, all functors are applicative. 
This is in contrast to Standard ML, where all functors are "generative" 
in the sense that they produce distinct abstract types at each 
application.  Some dialects, like Moscow ML, support both kinds of functors.

I am keen to hear of examples in practice where the same (applicative) 
functor is applied to the same argument in different parts of the 
program, and it is important that the results have equivalent type 
components.  (Xavier Leroy sketches one such example in Section 2.4 of 
his POPL'95 paper on applicative functors.)

Please respond to me directly, and I will edit responses into another post.

Derek Dreyer

More information about the Types-list mailing list