[MLton] Structures inside a function?

Matthew Fluet fluet@cs.cornell.edu
Fri, 21 Jan 2005 13:34:55 -0500 (EST)


> > I suspect that you really want a whole family of functors:
> > 
> > functor GroupOps (structure G : GROUP) = ...
> > functor GroupOpsPercent (structure G : GROUP) = ...
> > functor GroupOpsDollar (structure G : GROUP) = ...
> > functor GroupOpsHash (structure G : GROUP) = ...
> > 
> > If you are in a situation where you are only working with one group and 
> > the usual definitions of the arithmetic ops are unnecessary, use GroupOps.
> > If you are in a situation where you are working with multiple groups,
> > use GroupOpsPercent and GroupOpsDollar to get two sets of (distinguished) 
> > functions.
> 
> Neat!

This is still Wesley's idea, extrapolating from the name of his functor 
and his further comments:

> The list of functions in my example is small, but in the case of rings or
> polynomials gets quite large. The binding is designed so you can use many
> different groups with multiplication at once. eg: *%, *$, ...