
4 Oct
2010
4 Oct
'10
11:04 a.m.
Quoth Ketil Malde
Max Bolingbroke
writes: ... Prelude> (if then "Haskell" else "Cafe") False "Cafe"
Presumably, this extends to
Prelude> (if False then else "Cafe") "Haskell" "Cafe"
and
Prelude> (if then "Haskell" else) False "Cafe" "Cafe"
as well?
I think you're not the first to ask. Just out of curiosity, or is there a use for these variations? The reason for the initially proposed construct seems clear enough to me, it's very much like `case'. The difference is that of course it's limited to True & False, so would naturally be used more with more `composition', e.g. getargs >>= if then beTrue else beFalse . (==) ["-t"] ... and thus will quickly become unreadable with less trivial components. Donn