[MLton-user] Extended Basis Library: Suggested change to the MONADP
signature
Geoffrey Alan Washburn
geoffw at cis.upenn.edu
Sun Apr 1 11:00:54 PDT 2007
In any event, I just finally got around to trying to revise my code
so that I can change the definition of MONADP's zero from
val zero : errval -> 'a monad
to
val zero : 'a monad
and it occurred to me that with the value restriction my version might
actually be the better choice. As it stands it is only possible to
define zero in terms of values. Which is mostly okay, except that the
usual eta-expansion trick cannot be applied unless your monad is
implemented as a functional type.
Therefore I am thinking that it might be good to change the MONAP_CORE
signature to be
signature MONADP_CORE = sig
include MONAD_CORE
type errval
val zero : errval -> 'a monad
val <|> : 'a monad BinOp.t
end
and in those cases that where you have no interesting error values one
could just use MONADP_CORE with type errval = unit. Of course, this
does mean that in such a case you have to write the aesthetically less
pleasing zero () all over your code.
--
[Geoff Washburn|geoffw at cis.upenn.edu|http://www.cis.upenn.edu/~geoffw/]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton-user/attachments/20070401/cc0a9791/attachment.html
More information about the MLton-user
mailing list