smlmlton

How to use smlnj-lib in mlton


I'm compiling an SML source file with reference to IntBinarySet using MLton. The code runs well using SML/NJ, however, when compiled using MLton, it complains Undefined structure IntBinarySet. Do I need to import the smlnj-lib somehow? (I can use IntBinarySet directly in SML/NJ without use-ing or importing anything)

To be specific, my source file intset.sml is as follows.

fun newSet () = IntBinarySet.empty

and MLton complains:

Error: intset.sml 1.17.
  Undefined structure IntBinarySet.
compilation aborted: parseAndElaborate reported errors

Solution

  • MLton has a good page about smlnj-lib in MLton.

    From your limited information, I assume that you are not importing smlnj-lib in your .mlb file?

    ORD_SET is part of the utility library. Thus your problem should be fixed, having a reference to:

    $(SML_LIB)/smlnj-lib/Util/smlnj-lib.mlb