[MLton-user] More Extended Basis Library

Geoffrey Alan Washburn geoffw at cis.upenn.edu
Sat Mar 3 17:15:11 PST 2007


Geoffrey Alan Washburn wrote:

> Another bit of code I have that might make sense in the extended basis 
> is my »ListTriple« signature and structure.  Is it basically just »zip« 
> and »unzip« for triples instead of pairs, but could be extended to match 
> »ListPair«.  However, maybe it would be better to write a »ZIP« 
> signature for sequences based upon »Fold« and the »PRODUCT« signature.

Somewhat tangentially related, do you think there would be much interest 
in signatures that talk about properties of a non-parameterized 
datatype?  For example, one could write a signature

   signature HAS_PRODUCTS
     type u
     include PRODUCT_TYPE where ('a, 'b) t = u
   end

but that isn't really what you would like.  In this situation you would 
like something more like

   signature HAS_PRODUCTS
     type t
     val fromTuple2 : t * t -> t
     ...
   end

However, I'm not sure offhand where there is a reasonable way to unify a 
»HAS_PRODUCTS« signature with the »PRODUCT_TYPE« signature without 
duplication.  »HAS_PRODUCTS« also seems more like a »concept« signature 
than a »data« signature.  Perhaps someone with more experience making 
clever use of the module system might have an idea.

In any event, go forward from there it would probably be useful to 
define signatures like HAS_UNIT and IS_CARTESIAN, etc.




More information about the MLton-user mailing list