Replies: 1 comment
-
using LanguageExt;
using static LanguageExt.Prelude;
static int MyFunction(int i) =>
InnerFunction(i).IfLeft(x => throw new Exception(x));
static Either<string, int> InnerFunction(int i) =>
i % 2 == 0 // assuming error should be on mod 2?
? Left("this is an error")
: Right(123); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
juchom
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I plan to introduce a bit of functional programming in a C# project and I want to introduce some simple monads at the beginning.
In this small sample how could I access the value of
Left
orRight
?Beta Was this translation helpful? Give feedback.
All reactions