Comment by nesarkvechnep
15 hours ago
Thank you for the lecture but I didn’t mean that. I meant `Either String String` is possible in Haskell and not in C# because… C# is strongly-typed.
15 hours ago
Thank you for the lecture but I didn’t mean that. I meant `Either String String` is possible in Haskell and not in C# because… C# is strongly-typed.
You're welcome! Knowing is half the battle.
That Haskell snippet is just syntax sugar for Left(string) | Right(string), which is trivial in any language with unions.
Not clear why it would be an improvement over just naming the alternatives something meaningful, but if you're wedded to Left and Right, go for it.