Giter VIP home page Giter VIP logo

Comments (5)

gusty avatar gusty commented on June 5, 2024 1

That's fine. One more detail: I see you're using a strict monad.plus, by writing monad.plus', but not sure if you read this section of the docs.

There it states:

For layered monads (monad transformers) the general rule is: the monad is strict unless at least one of its constituent types is lazy, in that case the whole monad becomes lazy.

Following. there is a small snippet that helps you when in doubt whether the monad is strict or not.

In your sample, both ReaderT and State are lazy, so even if this version of SeqT is strict (unlike the ideal implementation I mentioned in my previous comment), the whole combination should be a lazy one.

from fsharpplus.

harrisse avatar harrisse commented on June 5, 2024

Actually c) only compiled because I didn't try to consume the results even though intellisense can seemingly detect the types that read_success_c and state_success_c are supposed to be. I'm going to guess this is just a misunderstanding on my end of how to combine Seq and State or that that use case is not supported.

from fsharpplus.

harrisse avatar harrisse commented on June 5, 2024

Going to close this for now until I can make a more concrete repro case / better understand SeqT.

from fsharpplus.

gusty avatar gusty commented on June 5, 2024

Just fyi, SeqT and ListT as they are right now don't provide an interesting effect to the inner monad.

A proper SeqT implementation, when combined with Async should derive async sequences, similarly a proper ListT combined with Lazy should automatically derive a lazy list.

I have a ListT on the drafts since almost 2 years, the problem is that due lack of higher kinds, it requires so many type level equations that the compiler slows down a lot, even for trivial cases.

I hope to be able to solve those issues either with a new version of the compiler and/or with v2 of this library with a significant change in the Invoker mechanism.

from fsharpplus.

harrisse avatar harrisse commented on June 5, 2024

Thanks, I am mainly looking for the syntactic sugar to return multiple elements (or ()) which SeqT seems to provide well enough. I was able to solve my problem with SeqT.lift ask and State.get |> ReaderT.lift |> SeqT.lift for ask and get respectively.

from fsharpplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.