Looking here: <a href="http://blogs.msdn.com/dsyme/archive/2007/09/22/some-details-on-f-computation-expressions-aka-monadic-or-workflow-syntax.aspx">http://blogs.msdn.com/dsyme/archive/2007/09/22/some-details-on-f-computation-expressions-aka-monadic-or-workflow-syntax.aspx</a><div>
<br></div><div><a href="http://blogs.msdn.com/dsyme/archive/2007/09/22/some-details-on-f-computation-expressions-aka-monadic-or-workflow-syntax.aspx"></a>It appears at a quick glance that you can define return as a member of the builder object, and then use that builder to reuse your special return function.</div>
<div><br></div><div>I guess that means it takes more boilerplate to mix and match custom computational expressions, but maybe that's a good thing.</div><div><br>Jeremy<br>
<br><br><div class="gmail_quote">On Tue, Mar 16, 2010 at 4:03 PM, John Clements <span dir="ltr"><<a href="mailto:clements@brinckerhoff.org">clements@brinckerhoff.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Which is better? Haskell or F#?<br>
<br>
Wait, wait, no, that's not what I meant at all.<br>
<br>
I was reading up on F#'s computational expressions last night, and I'm impressed by their flexibility. I do see one teeny tiny thing that's missing, though.<br>
<br>
In particular, it looks like computation expressions (e.g.<br>
<br>
parse { let! e = token<br>
return e}<br>
<br>
Are a lot like Haskell's monads. In fact, in one way they're nicer; rather than just bind and return, you get a whole bunch of syntactic forms that you can redefine.<br>
<br>
But! If I understand correctly, these overridings happen only within the syntactic boundaries of the curly braces, right? So you couldn't abstract over those pieces in quite the same way.<br>
<br>
E.G:<br>
<br>
let myReturn x = return x;;<br>
<br>
parse { let! t = token<br>
myReturn t}<br>
<br>
... wouldn't work, right?<br>
<br>
Whereas Haskell gets it right:<br>
<br>
myReturn = return<br>
<br>
p = do t <- token<br>
myReturn t<br>
<br>
<br>
<br>
I haven't tried actually running any of this, mind you. Of course, Scheme can't do this, either; it's a consequence of Haskell's truly insane type system.<br>
<font color="#888888"><br>
<br>
John<br>
<br>
</font></blockquote></div><br></div>