<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffee" text="#000000">
Vesa Karvonen wrote:<br>
<blockquote
cite="mid:9e43b9a0704040722k3857b197redaef5ef5e9c24d7@mail.gmail.com"
type="cite">Hmm... Does value restriction really become an issue? I
mean, when you
<br>
implement zero, the monad type should be concrete and you will be able
to
<br>
make zero a value. Value restriction becomes an issue when the type is
<br>
abstract, but that shouldn't be the case here.
<br>
</blockquote>
If you are defining a MONADP from scratch, no I don't think it can
ever be a problem. However, if you are interested in writing monad
transformers, say <br>
<tt><br>
functor MkErrorMonad (M : MONAD_CORE) :> MONADP_CORE =<br>
struct<br>
type 'a monad = ('a option) M.monad<br>
fun return x = M.return (SOME x)<br>
fun op >>= (aM, f) =<br>
M.>>= (aM, fn SOME a => M.>>= (f a, return) | NONE
=> M.return NONE)<br>
val zero = return NONE<br>
fun op <|> (aM, bM) =<br>
M.>>= (aM, fn SOME a => return a | NONE => bM)<br>
end</tt><br>
<br>
You'll run into problems. It may be conceivable that the above could
be rewritten with <br>
<br>
<tt> type 'a monad = 'a M.monad option<br>
</tt><br>
but it is either not possible to write bind for this type or my brain
has called it a day already.<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
[Geoff Washburn|<a class="moz-txt-link-abbreviated" href="mailto:geoffw@cis.upenn.edu">geoffw@cis.upenn.edu</a>|<a class="moz-txt-link-freetext" href="http://www.cis.upenn.edu/~geoffw/">http://www.cis.upenn.edu/~geoffw/</a>]
</pre>
</body>
</html>