Comments (3)
Done here: dotnet/fsharp#7384
from fsharpplus.
This is a consequence of another issue: type inference fails when liftM
is implemented as map
.
At the same time that issue is a consequence of an F# issue, since after doing some tests like changing the definition like this:
static member inline Lift (x:'``Monad<'T>``) =
if false then ListT (x >>= (result << List.singleton)) else ListT (map List.singleton x)
and then trying to call with the repro code it looks like type inference fails depending on the execution path (switch to true
and it compiles fine).
This is clearly an F# bug, compilation shouldn't fail depending on the execution path.
TODO:
- Find a minimal repro
- Report it as a bug in the F# compiler project, then reference this issue and close it
- If no one there is interested in solving it, try to fix it
In the meantime the best compromise is to re-re-introduce liftM
this might lead to a slightly less optimised code for those cases where the map
operation is more efficient but at least will work which is a minimal requirement.
If more efficient code is required it's always possible to replace the generic code with a more specific implementation, in the repro it will be:
let x = ListT (map List.singleton (State.put initialState))
from fsharpplus.
Reopening as this is still an issue
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.