F#+ generic computation expressions and Nested Monads
See original GitHub issueHello!! First of All Thanks for this Beautiful library. I m new to FP so forgive me if i’m not writing idiomatic code. I m trying to wrap my head around F#+ generic computation expressions.
this is my understanding: U don’t need to create computation expressions for each monad, u can use generic computation expressions for all cases.
from Option to Async , but what about Async<Result<,>> ? does F#+ generic computation expressions will work with nested monads ?
this is sample code I’m trying to work with but I’m getting following error
his expression was expected to have type
‘Result<string,string>’
but here has type
‘string’
let p():Async<Result<string, string>> = async { return Error ""}
let m():Async<Result<string, string>> = monad{
let! (e:string) = p() //This expression was expected to have type 'Result<string,string>' but here has type 'string'
return e
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Computation Expressions - F# | Microsoft Learn
Computation expressions in F# provide a convenient syntax for writing computations that can be sequenced and combined using control flow ...
Read more >Computation Expressions in F# | autoforecast team's blog
Computation expression is a syntax to express computations with monads (as well as with monoids, monad transformers and applicative functors).
Read more >Nested monad binding in F# - Stack Overflow
Trying to wrap my mushy head around monads and binding ... the validation functions, but I trying to learn how to bind to...
Read more >Monads for free in F# - DEV Community
To make computation expressions easy to write, we use a small utility function that lifts a given value into the monad as a...
Read more >Is computation expression the same as monad?
Monad transformers are a generic way to convert one monad into another monad - F# computation expressions only really support directly ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@aammfe see if you find this video useful:
F# Online - Josef Starýchfojtů - FSharpPlus - Advanced FP concepts in F# https://www.youtube.com/watch?v=pxJCHJgG8ws
The abstractions have been implemented first in Haskell (as far as I know). There is a lot of fertile ground when it comes to functional programming and lisps. Prolog and logic programming should also be an interesting route.