[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Error handling in Mirage - request for comments!

On 4 February 2015 at 17:51, Leo White <lpw25@xxxxxxxxx> wrote:
> It seems to me that:
>   exception Error : 'a * (formatter -> 'a -> unit) -> exn
> should do the trick, allowing you to wrap up the error and its printer
> as an exception. (Note using existential variables directly in exceptions
> like this requires 4.02, for earlier versions you must nest a GADT within
> the exception).

There's a simpler solution than either an existential or a nested GADT
here: simply eliminate the type variable altogether:

    exception Error of (formatter -> unit)

A function of this type is just as convenient to use with
Format.printf etc., since you can use '%t' instead of '%a'.

MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.