[MLton] export-filter-like technique

Stephen Weeks sweeks at sweeks.com
Mon Oct 23 09:47:05 PDT 2006


I saw the following technique used in the extended basis in lieu of
using an MLB export filter.

  local
     ...
  in
     public/export.sml
     public/export-mlton.sml
  end

where, e.g. public/export.sml, looks like

  type ('a, 'b) emb = ('a, 'b) emb
  type ('a, 'b) iso = ('a, 'b) iso

  signature ARRAY = ARRAY
  signature CHAR = CHAR
  ...

  structure Array : ARRAY = Array
  structure Char : CHAR = Char
  ...

It seems like a nice technique because it allows one to write specs if
one wants, and neatly sidesteps our discussion about extending MLBs
for val and type exports.  It's more wordy than export filters, but as
a practical matter I'm not sure it matters at all, since the amount of
work to write down the exports of a library are very small relative to
the total amount of work that goes into a library.



More information about the MLton mailing list