As far as I can tell, this is because

1
2
  do! e
  ...

is just shorthand for

1
2
  let! (_:unit) = e
  ...

Therefore, you should never end a block with just a do! - this would be equivalent to a let! binding without a body. However, the F# compiler seems to give you added flexibility by implicitly inserting a return () in the do! case to make the syntax work (although the spec doesn't seem to call out this behavior).

You might get better results by trying

1
2
  do! e
  ()

which will use your Zero method instead of Return.

By on 1/8/2011 10:13 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