[MLton-user] Type error with the exit status from MLton.Process.reap

Risto Saarelma risto.saarelma at ssh.com
Mon Mar 23 01:49:07 PST 2009


Hi

I'm trying to read the exit status of a process run with MLton.Process. I use
this code:


open MLton.Process

val () =
    let
        val proc = MLton.Process.create {
                   args = [],
                   env = NONE,
                   path = "/usr/bin/ls",
                   stderr = Param.pipe,
                   stdin = Param.null,
                   stdout = Param.pipe}
        val exitStatus = reap proc

    in
        case exitStatus of
            Posix.Process.W_EXITSTATUS st => print "Error code.\n"
          | _ => print "Something else.\n"
    end


Using MLton 20070826, I get the following error:

$ mlton proctest.sml
Error: proctest.sml 15.9.
  Case object and rules disagree.
    object type:  [?.PosixProcess.exit_status]
    rules expect: [Unix.exit_status]
    in: case exitStatus of (Posix.Process  ...  "Something else.\n")
compilation aborted: parseAndElaborate reported errors

MLton.Process.reap is supposed to return a value of type
Posix.Process.exit_status, and the actual Posix.Process.exit_status is
apparently just an alias for Unix.exit_status. So why am I getting the type
error?

Risto Saarelma



More information about the MLton-user mailing list