Ok, I might have jumped the gun and gutted out the do block. After learning about Monads in F# I think I am going to add them back to RoyML. I think they are a great way of managing continuations (CPS) instead of passing lambdas to the next actions. I have to weigh the pros and cons of the approach. I still have to study it more.
Reference:
Page 78 - Imperative to Functional Programming Succinctly - The example is a logger "monad" (Haskell people will complain because there is IO behind the scenes, but here we are not pure, its alright).
Upon return, the do block should get a new syntax, preferably a copy of the one used by F#, mixed with the original approach by Roy.
let logger = Logger.make ()
let loggedWorkflow () = logger {
a <- 5 // Bind and compute expression.
b <- 6 // Bind and compute expression.
c <- a + b // Bind and compute expression.
return c // Return c.
}
Ok, I might have jumped the gun and gutted out the do block. After learning about Monads in F# I think I am going to add them back to RoyML. I think they are a great way of managing continuations (CPS) instead of passing lambdas to the next actions. I have to weigh the pros and cons of the approach. I still have to study it more.
Reference:
Page 78 - Imperative to Functional Programming Succinctly - The example is a logger "monad" (Haskell people will complain because there is IO behind the scenes, but here we are not pure, its alright).
Upon return, the do block should get a new syntax, preferably a copy of the one used by F#, mixed with the original approach by Roy.