If you use pointfree
on the code \b t f -> if b then t else f
, the answer you get is if'
.
Where is if'
defined?
It's worth mentioning that the if'
function exists in base
since version 4.7, but it's called bool
(in style with either
and maybe
).
bool :: a -> a -> Bool -> a
bool f _ False = f
bool _ t True = t
is defined in Data.Bool
.
According to Hayoo, it is defined in the following three packages:
if' :: Bool -> a -> a -> a
utility-ht - Data.Bool.HT
if-then-else
as function.
Example:
if' (even n) "even" $
if' (isPrime n) "prime" $
"boring"
plailude - Plailude
If True
then the first value, else the second.
CLASE - Data.Cursor.CLASE.Util
The two main search engines for Haskell that I know of are Hoogle and Hayoo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With