Conversation

An /r/haskell thread made me realize Hackett has an opportunity to avoid the mess that led to ExceptT in Haskell, but I don’t actually know which name for the transformer is the best. In an ideal world, what do you all think would be ideal?
  • EitherT
    63.6%
  • ErrorT
    22%
  • ExceptT
    14.4%
118 votesFinal results
5
7
Do NOT do this. It's an anti-pattern: it assumes the side you bind on is an "okay" result and the other is an error, which is not always the case.
2
1
The opposite can also be seen as an antipattern: Result is a Functor, but Either shouldn't be (Result could be a newtype wrapper around Either, though). If needed a different newtype wrapper could have a left biased Functor instance as well
1
1
It could be two functors, it's just very unclear which. 'Right' was chosen due to silly mnemonic reasons for error handling. An hypothetical lang might allow you to bind either path with equal ease, but it would still be of use to have a type that is marked for passing errors.
2
There's no "silly mnemonics" involved at all, and no arbitrary choices. Left a because a is on the left in Either a b, Right b as it's on the right.
1
I think here you're confusing one specific use case with a simple, general type. It's "monads are not burritos, monads are not containers, ..." all over again.
1
Show replies