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

Matthew Fluet fluet at tti-c.org
Wed Apr 1 14:27:41 PST 2009


On Mon, 23 Mar 2009, Risto Saarelma wrote:
> 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?

There was a missing type constraint in the implementation of the Basis 
Library.  If you would like to fix a local install, apply the patch from:
   http://mlton.org/cgi-bin/viewsvn.cgi?view=rev&rev=7029
to
   /usr/local/lib/mlton/sml/basis/libs/basis-extra/top-level/basis.sig

-Matthew



More information about the MLton-user mailing list