DavidArno / SuccincT

Discriminated unions, pattern matching and partial applications for C#
MIT License
268 stars 15 forks source link

Generic ValueOrError #48

Open Odonno opened 6 years ago

Odonno commented 6 years ago

Is it possible to use ValueOrError<TValue> or even ValueOrError<TValue, TError>?

I mean, what if you want to get a value of a POCO object (as value) and return an Exception (as error)?

DeafLight commented 6 years ago

Could not agree more, this looks a lot like Vladimir Khorikov's Result object in his functional courses.

DavidArno commented 6 years ago

Interesting. I hadn't really thought of using ValueOrError like that, but it does make sense. So I'll add support for ValueOrError<TValue, TError>, I think.

DavidArno commented 4 years ago

Need to document this new type in the wiki now that v4 is released.