Comments (30)
from taskbuilder.fs.
Hi, just to reiterate everything:
- In theory there were breaking changes between TaskBuilder.fs 1.0.1 and the versions after (1.1 and now 1.2-rc).
- Giraffe has a dependency on the the TaskBuilder.fs NuGet package.
- Updating Giraffe to the latest 1.2-rc build of TaskBuilder.fs fixes the errors for @forki because there is no conflict between the old and the new namespaces of TaskBuilder.fs.
- However, a project which references Giraffe doesn't require an explicit reference to TaskBuilder.fs anymore, unless it wants to use a higher version and do some assembly redirects.
As @forki suggested if we coordinate the release of TaskBuilder.fs and Giraffe in the future then such breaking conflicts can be avoided for end users, but I also believe that perhaps it would have been better to version TaskBuilder.fs accordingly to the breaking changes (e.g. from 1.x.x to 2.x.x) and then it would have been more obvious (and expected) that an additional reference to a higher major version of TaskBuilder.fs might have caused issues with Giraffe if Giraffe hasn't been updated yet.
Am I missing something?
So my final question is what is the ETA for TaskBuilder.fs 1.2 stable?
from taskbuilder.fs.
Is this after applying my PR #14 ?
from taskbuilder.fs.
from taskbuilder.fs.
Ah ok, since you posted in the other issue I though it was related to my fix.
Anyway I can have a look, can you manage to get a minimal repro? If I find a solution we can add it as a test.
from taskbuilder.fs.
from taskbuilder.fs.
let t = task { return Some "x" }
let getX = task {
let! r = t
if r = None then
return! failwithf "Could not find x"
else
return r
}
from taskbuilder.fs.
I found a way to solve it in my PR but good luck with the original code ;)
If you want I can include another commit with this test and its fix.
from taskbuilder.fs.
yes please. it's a regression and hurts us badly.
from taskbuilder.fs.
I will be checking out Gustavo's PR this week to get F# 4.0 compat back. Sounds like it should be possible to fix with that code.
In the meantime here is a quick fix for this regression applied to the existing codebase:
https://www.nuget.org/packages/TaskBuilder.fs/1.1.1
Just out of curiosity, is there any reason you use return!
instead of return
here?
from taskbuilder.fs.
from taskbuilder.fs.
I also think return
makes more sense and am curious to hear @dsyme explanations.
Anyway I updated my PR with the fix. If you can pull it and test your code please let me know.
from taskbuilder.fs.
from taskbuilder.fs.
Just out of curiosity, is there any reason you use return! instead of return here?
You can do either - either way the failwith will fail to return either "return" type unit
or Task<unit>
or whatever.
from taskbuilder.fs.
from taskbuilder.fs.
Just FYI, 1.2.0 rc is available now.
This has Gustavo's changes for 4.0 compability. It should behave the same way both in terms of type inference and runtime performance, and seems to from my testing, but I don't have a big codebase to check against.
@forki would you be willing to try it out and see how it works with your code?
from taskbuilder.fs.
The module/namespace 'FSharp.Control.Tasks.TaskBuilder' from compilation unit 'TaskBuilder.fs' did not contain the namespace, module or type 'ContextInsensitiveTaskBuilder'
from taskbuilder.fs.
so basically whole projet breaks again. what do I need to do? and can you please write that into release notes
from taskbuilder.fs.
Yes, this is a minor issue, easy to fix, there were some refactoring in the namespaces/modules.
Looking at the code the way it is right now you won't find ContextInsensitiveTaskBuilder
anywhere, you will find that builder like this:
FSharp.Control.Tasks.ContextInsensitive.TaskBuilder
Now, there are 2 ways to fix it, either you fix your code, or we can have a look at the taksbuilder and see if we can fix the taskbuilder code.
But I wonder why are you referencing that builder class? The only thing you need to reference is the builder instance:
FSharp.Control.Tasks.ContextInsensitive.task
or ideally:
open FSharp.Control.Tasks.ContextInsensitive
let x = task { ...
from taskbuilder.fs.
In the RC, there is no longer a separate class for ContextInsensitiveTaskBuilder
. There's just one TaskBuilder
type and different extension methods on that type depending which module you open.
In what context are you referring to the task builder type by name? You could "fix" it by referring to FSharp.Control.Tasks.TaskBuilder.TaskBuilder
but right now that isn't a great option as that module is marked obsolete (just to hide it from intellisense while still being able to use it from inline code). We might have to refactor and add type aliases to keep code that referred to the type name ContextInsensitiveTaskBuilder
working.
from taskbuilder.fs.
I'm lost. What namespace do I need to open to get old behavior?
from taskbuilder.fs.
@forki. See the last snippet in my previous comment.
from taskbuilder.fs.
I still get that error everywhere. Is it related to giraffe? Do they need to update first?
from taskbuilder.fs.
I'm not sure if this is your case but if you are using TaskBuilder.fs in your project and at the same time your project uses another project that uses TaskBuilder (like Giraffe) you might run into problems, since the namespaces are the same.
I think ideally libraries using TaskBuilder shouldn't re-export TaskBuilder to avoid this.
from taskbuilder.fs.
/cc @dustinmoris
from taskbuilder.fs.
@gusty Could you elaborate what you mean? How can I not expose the task CE after referencing TaskBuilder.fs?
from taskbuilder.fs.
Honestly I don't know, I just said "ideally", but I know that in some scenarios this is problematic, it happened to me with other libraries.
To answer your question I need to know more details, specifically how it is included in Giraffe, I haven't look at it.
But if you are copying the code, you can simply change the namespaces or mark it as internal, this will allow the users of Giraffe to use their own taskbuilders at possible different versions.
In the readme it states:
This is public domain code. I encourage you to simply copy TaskBuilder.fs into your own project and use it as you see fit. It is not necessary to credit me or include any legal notice with your copy of the code.
I guess it's also fine to change the namespaces, but I know it's not an elegant solution.
from taskbuilder.fs.
I think newer versions of Giraffe use TaskBuilder from NuGet, right?
from taskbuilder.fs.
@rspeele not sure why you closed it, but I can now confirm that a simultaneous update of taskbuilder and giraffe indeed works. so can you and @dustinmoris please somehow sync?
from taskbuilder.fs.
I opened a new issue for planning the release. #18
from taskbuilder.fs.
Related Issues (20)
- Please elaborate a bit on "Tail calls are not optimized" HOT 2
- Async overload bind HOT 8
- Issue with plain Task and do! HOT 1
- TaskResultBuilder ? HOT 3
- TaskBuilder 2 release HOT 5
- Could not load type 'BindI' from assembly 'TaskBuilder.fs HOT 3
- Caching bool tasks HOT 2
- add support of specifying TaskScheduler HOT 4
- The type 'Threading.Tasks.Task' is not compatible with the type 'Threading.Tasks.Task<'a>' HOT 7
- Using ValueTask instead of Task HOT 1
- Intended way to call async and ignore result HOT 2
- Possible incorporation into FSHarp.Core HOT 9
- Easy way to get result synchronously? HOT 5
- Support for netstandard2.0 HOT 11
- Code is not sufficiently generic
- Question on ContextInsensitive tasks HOT 41
- Non-generic Tasks HOT 6
- What is the purpose of this if it exists in FSharpx.Extras ? HOT 3
- Dispose is not called in task CE HOT 3
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 taskbuilder.fs.