[Haskell-cafe] Lambda-case / lambda-if
Ketil Malde
ketil at malde.org
Tue Oct 5 15:28:25 EDT 2010
Donn Cave <donn at avvanta.com> writes:
> I think you're not the first to ask. Just out of curiosity, or is
> there a use for these variations?
Just that they seem to be natural generalizations. If it's just the
single form of paramtrizing the condition, I think it's better served by
a regular function, 'bool' or (??) or whatever.
> The reason for the initially proposed construct seems clear enough
> to me, it's very much like `case'.
> getargs >>= if then beTrue else beFalse . (==) ["-t"]
Isn't this equivalent, and only slightly more cumbersome?
getArgs >>= case of {True -> beTrue; False -> beFalse} . (==) ["-t"]
(And of course,
getArgs >>= case of ["-t"] -> beTrue; _ -> beFalse
is probably clearer anyway.)
-k
--
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe
mailing list