question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

F#+ generic computation expressions and Nested Monads

See original GitHub issue

Hello!! 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:closed
  • Created 3 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
wilsoncgcommented, Aug 27, 2020

@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

1reaction
wallymathieucommented, Aug 27, 2020

so all routes to learn FP goes through haskell ?

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found