[MLton] Extending the SML Basis library (Library project)

Matthew Fluet fluet at cs.cornell.edu
Tue Oct 10 08:32:51 PDT 2006


> type ('a, 'b) iso = ('a -> 'b) * ('b -> 'a)
> type ('a, 'b) emb = ('a -> 'b) * ('b -> 'a option)

Honestly, I'm not a huge fan of the iso/emb types and functions.  But, as 
a minor suggestion, I would revise the types to:

  type ('a, 'b) iso = {to: 'a -> 'b, from: 'b -> 'a}
  type ('a, 'b) emb = {to: 'a -> 'b, from: 'b -> 'a option}

Then I can write:

   #to Char.int

and have a reminder of the direction of the coercion.



More information about the MLton mailing list