Comments (5)
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.
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.
Going to close this for now until I can make a more concrete repro case / better understand SeqT.
from fsharpplus.
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.
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)
- `(>>=)` should be constrained with `Map` HOT 8
- New Validation type HOT 2
- Array.replace takes in seq for its two first values instead of arrays
- Adjust package info with icon and license elements
- Add more static member operators like >=> HOT 1
- `String.take 0 s` throws IndexOutOfRangeException HOT 2
- Traverse Lens Documentation Needs more Examples HOT 1
- Documentation table of contents is missing list of namespaces HOT 3
- Proposal: A set of modules for list and tree zippers HOT 1
- Upload packages built on main branch onto GitHub NuGet feed
- Int32.TryParse and F#+ tryParse give different results HOT 6
- Fable 4 support HOT 3
- Type inference issue with applicative2 HOT 1
- [API Proposal] String.(try)FindLastSliceIndex HOT 3
- Clean up preprocessor directives
- Drop net45, net6, Fable3 from F#+ 2 release
- net45 not compatible with updated F# typeprovider
- Naming convention for (non-generic) Sequence-like overloaded methods
- Adjust async/task/value task tests to work on net6 and on release branch
- Cannot destructure ask when using ReaderT HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharpplus.