
I'm -0.5 on ifThenElse (if it can be used with RebindableSyntax then
someone may want to use it, though I personally find the bool function
to be more than sufficient as I tend to find the "which branch do I
choose" argument to be the last when constructing function pipelines),
and -1 for the operator.
On 17 November 2016 at 13:43, winter
It seems this’s a very old request, see https://wiki.haskell.org/If-then-else. I’d like to see following:
ifThenElse :: Bool -> a -> a -> a ifThenElse True x _ = x ifThenElse False _ y = y
infixr 1 ? (?) :: Bool -> a -> a -> a (?) = ifThenElse
in Date.Bool module, it will have advantages that:
+ It’s more composable than syntax.
+ Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more consistent with (f . g $ x) style, and save key strokes.
+ In module with RebindableSyntax enabled, you can import ifThenElse to get default behavior.
Whether or not to be exported by Prelude is another question, but Data.Bool seems a good place to start with.
Cheers~
Winter
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com