Comments (3)
It's not possible to have SRTP with module functions. But I don't see why you would need that, because there's no SRTP involved in the current definition of the operators (they simply alias Result.bind
etc.). So AFAIK your example should work correctly already (apart from the fact that you're calling the tryCreate
functions with two parameters when your definition of them only accepts one parameter).
In other words: The right-hand side of the operator is a simple Result<_,_>
value, not a type with a tryCreate
function. The fact that the documentation currently uses static members called TryCreate
is purely coincidental; it could just as well use functions such as you describe.
(Do let me know if I'm wrong; I don't have full knowledge of this library, but this fits with what I can observe.)
from fstoolkit.errorhandling.
@cmeeren I see your point, after looking into it a bit more, I noticed that I am not bound to using member TryCreate
There are other ways to accomplish the same thing =)
Thanks for quick response =)
from fstoolkit.errorhandling.
Thanks, @cmeeren for jumping in.
@AlbertoDePena, The rationale behind the current implementation is based on this example https://demystifyfp.gitbook.io/fstoolkit-errorhandling/index/trycreate#example-1 in the documentation.
The overall idea was inspired by clojure.spec where each attribute type will have its own validation logic in the form a static member TryCreate
and then compose these attributes to form different entities. By using the Result.tryCreate
, we can leverage this individual attribute level validation across any entities.
from fstoolkit.errorhandling.
Related Issues (20)
- Task to AsyncResult transition wraps `Exception` into the `AggregateException` HOT 8
- Seq.sequenceResultM returns a list instead of a seq HOT 1
- TaskResult.ofTask? HOT 2
- Use ListCollector on List operations to improve perf HOT 4
- List.traverseValidationA' should be private? HOT 1
- Add explicit type parameters to ignore functions HOT 5
- Move TaskResult (and friends) to core FsToolkit.ErrorHandling package HOT 9
- TaskResultCE breaks with a bind in branching such as if HOT 2
- List.traverseResultA and friends have x @ y on the error branch, this could potentially blow up HOT 5
- Add Option.maybe
- Task wrapped result + option helpers HOT 1
- Worried about the Diamond dependency problem HOT 6
- Documentation for Validation operators mentions Bind (>>=), but the library doesn't implement it HOT 1
- Should List.sequenceValidationA preserve order? HOT 2
- 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
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.