
On 17 Feb 2008, at 1:12 AM, Colin Paul Adams wrote:
"apfelmus" == apfelmus
writes: apfelmus> Colin Paul Adams wrote:
Left? Right?
Hardly descriptive terms. Sounds like a sinister language to me.
apfelmus> The mnemonics is that Right x is "right" in the sense of apfelmus> correct. So, the error case has to be Left err .
As I said, this is sinister
You do know what `sinister' means, no?
(i.e. regarding left-handed people as evil).
Sheesh, it's just a mnemonic...
And left is not the opposite of correct. That would be incorrect.
No, Left is the opposite of Right. Right is the constructor modified by fmap (due to the design of Haskell type classes); therefore return = Right. Therefore any computation in Either that is not the result of a return is an application of Left.
Also, it is not clear to me that a failure to read a file (for instance) is incorrect behaviour.
Then don't think of Left as `incorrect behavior'. Left isn't incorrect, or Parsec's parse function wouldn't return it on parse errors.
If the file doesn't exist, then I think it ought to be considered correct behaviour to fail to read the file.
So Success and Failure seem to be much better. Certainly they make the program far more readable to my eyes.
But the program succeeded in doing what I expected it to do when if failed... jcc Besides, these decisions were made 15 years ago, they're not going to change now...