Comments (2)
I will look into this after I get the applicative work done.
from fstoolkit.errorhandling.
Chet and I did a livestream of this: https://www.twitch.tv/videos/625998302
Here are some of the initial results:
The result CE's original stack trace.
System.Exception: I'm a failure
at ResultCETests.failureFunc[a]() in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 282
at [email protected](Int32 _arg2) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 288
at FsToolkit.ErrorHandling.ResultCE.ResultBuilder.Bind[T,TError,U](FSharpResult`2 result, FSharpFunc`2 binder) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/ResultCE.fs:line 21
at [email protected](Int32 _arg1) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 287
at FsToolkit.ErrorHandling.ResultCE.ResultBuilder.Bind[T,TError,U](FSharpResult`2 result, FSharpFunc`2 binder) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/ResultCE.fs:line 21
at [email protected](Unit unitVar) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 286
at FsToolkit.ErrorHandling.ResultCE.ResultBuilder.Run[T,TError](FSharpFunc`2 generator) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/ResultCE.fs:line 31
at ResultCETests.iDoCalls[a]() in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 285
at ResultCETests.ResultCE stack [email protected](Unit unitVar0) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 295
at [email protected](Unit unitVar)
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 398
at <StartupCode$FSharp-Core>[email protected](AsyncActivation`1 ctxt) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1666
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 109
As you can see we're spending a lot of time in the CE builder itself. With some inlining we've gotten to this stack trace:
System.Exception: I'm a failure
at ResultCETests.failureFunc[a]() in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 282
at [email protected](Int32 _arg2) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 288
at [email protected](Int32 _arg1) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 287
at [email protected](Unit unitVar) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 286
at ResultCETests.iDoCalls[a]() in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 285
at ResultCETests.ResultCE stack [email protected](Unit unitVar0) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/ResultCE.fs:line 295
at [email protected](Unit unitVar)
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 398
Which shows a vast improvement to clarify of where the error is coming from and removing the needless stackframes.
AsyncResult original stacktrace:
System.Exception: I'm a failure
at [email protected](Unit unitVar) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 422
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 398
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/Async.fs:line 8
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/Async.fs:line 8
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/AsyncResultCE.fs:line 29
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/AsyncResultCE.fs:line 46
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/AsyncResultCE.fs:line 29
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/AsyncResultCE.fs:line 46
at AsyncResultCETests.AsyncResultCE stack [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 435
at <StartupCode$FSharp-Core>[email protected](AsyncActivation`1 ctxt) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1666
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 109
AsyncResult improved stacktrace:
System.Exception: I'm a failure
at [email protected](Unit unitVar) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 422
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 398
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 428
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 428
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 427
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 427
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 426
at [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 426
at AsyncResultCETests.AsyncResultCE stack [email protected](AsyncActivation`1 ctxt) in /Users/jimmybyrd/Documents/GitHub/FsToolkit.ErrorHandling/tests/FsToolkit.ErrorHandling.Tests/AsyncResultCE.fs:line 435
at <StartupCode$FSharp-Core>[email protected](AsyncActivation`1 ctxt) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 1666
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 109
There's not a lot of gains in this scenario but it does make the error more clear in the sense we're not spending time in the CE builder, but it doesn't reduce the stackframes.
Given this I'm going to go ahead and inline all Bind/ReturnFrom/BindReturn/MergeSources methods and possibly any module level functions like AsyncResult.bind
from fstoolkit.errorhandling.
Related Issues (20)
- FSharp.Core version warning (net7.0) HOT 14
- Make Result.defaultWith accept error, or remove it HOT 2
- Overload issues with TaskResult on generic functions HOT 2
- Add Option.ofPair HOT 5
- Add asyncValidation CE, or make asyncResult (and result?) CEs work with 'and!' HOT 4
- Can we reinstate `TaskResult.foldResult` and the like? HOT 4
- Add Light/Dark Theme Toggle to Gitbook Docs
- Support ValueOption in FsToolkit.Errorhandling.asyncOption HOT 3
- Support TaskValidation to match AsyncValidation HOT 2
- Binding Async<'T option * 'T option> to AsyncValidation is having overload errors HOT 1
- Common Language Runtime detected an invalid program HOT 2
- TaskOption/TaskResult defaultValue and defaultWith
- Support requireValueSome and requireValueNone in Result, TaskResult and AsyncResult
- Async/Job/Task wrapped result + require functions helpers
- feat(Seq): Add sequenceResultA HOT 6
- Readme video unavailable HOT 1
- usage with npgsql HOT 7
- TaskResultOption compatibility with TaskResult and friends HOT 4
- TaskResult `return! Error ()` results in a compiler error: "Type constraint mismatch". The type 'TaskResultCode<,'b,> is not compatible with type 'TaskResultCode<unit,string,'a>' HOT 2
- Consider using other name for Option.filter 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 fstoolkit.errorhandling.