Add ifThenElse and (?) to Data.Bool

Yitzchak Gale gale at
Thu Nov 17 10:14:44 UTC 2016

Edward Kmett wrote:
> I'm pretty strongly -1 on adding (?)...
> we already have established combinators...
> more inessential
> complexity to newcomers to the language.

I'm not so worried about that if it's not in the Prelude.
I doubt that this would get wide usage. And if it does,
then maybe that is better use of the namespace
real estate.

I am 0 on (?). I probably would never use it.

I am -1 on ifThenElse. We already have bool. Some
of our developers use it all the time and it's fine.
It's not like "map" and "for" which have common
idioms where parameter order really matters. Other
than that, we shouldn't litter the libraries with flipped
versions of everything.

Anyway, bool is the natural parameter order in Haskell.
I'll make more explicit what others have already said, with
this analogy:

maybe (if it fails) (if it succeeds) (input data)
either (if it fails) (if it succeeds) (input data)
foldl (if it's null) (if it's not null) (input data)
foldr (if it's null) (if it's not null) (input data)

Whereas Haskell's if-then-else syntax is awkward. Some
people (not me) even say it should never be used at all.

And so

bool (if it fails) (if it succeeds) (input data)

makes the most sense.


More information about the Libraries mailing list