In short, no.

You can't abstract over type constructors in F#, i.e. you can't express the fact that the m in your signature can be any monadic type. You would have to give a concrete type (Option, Seq,...)

You can of course write a sequence function for a specific computation expression, but you're going to have to copy and modify it for every different kind of computation expression.

Computation expressions in F# are more like syntactic sugar, they're not first class.

Kurt

By on 12/15/2008 4:06 AM ()

I was trying to use the ^a construct and member as well as new constraint but no luck there.

By on 12/15/2008 6:39 PM ()

Found this blog and seems that Cale Gibbard's comment sums it up nicely. And I believe that applies to C#'s LINQ too which is very similar to F#'s computation expression.

Nice syntax sugar but lacks the power of what monad in Haskell can do.<!--</cite>-->

[link:blog.matthewdoig.com]

Well after reading those blogs by Matthew, I would say that I incline to his feeling that F# is still tilt more towards the C# side than the functional side be it ocaml or haskell.

By on 12/17/2008 12:54 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper