On Jul 26, 2006, at 6:44 PM, Sebastian Sylvan wrote:
For example ...
if :: Bool -> a -> a -> a
if True t _ = t
if False _ e = e
-- example usage
myAbs x = if (x < 0) (negate x) x
I suppose there might also be a case for flipping the arguments about
like this:
if :: a -> a -> Bool -> a
if t _ True = t
if _ e False = e
This way it would follow foldr more closely, in recognition that the
conditional is essentially the fold/cata/eliminator/... for booleans.
But argument order is a pretty trivial thing, and I think the committee
made the right choice with if-then-else as a language construct.
-- Fritz
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe