[MLton] Structures inside a function?

Stephen Weeks MLton@mlton.org
Fri, 21 Jan 2005 08:21:29 -0800


> 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!