:: Bool -> a -> a -> a -package:numhask
if-then-else as function.
Example:
if' (even n) "even" $
if' (isPrime n) "prime" $
"boring"
The same as
if', but the name is chosen such that it can be
used for GHC-7.0's rebindable if-then-else syntax.
for support of if .. then .. else
Because of RebindableSyntax, this is necessary to enable you to use
if-then-else expressions. No need to call it directly.
Definition of
ifThenElse for use with RebindableSyntax
This is the
if-then-else operator, With it you can write
xxx ? yyy $ zzz instead of
if xxx then yyy else zzz.
Following may or may not be cleaner to you ; )
isFoo <- checkFoo
isFoo ? foo
$ bar
Hang on the
True case of
bool.
onTrue b f t = bool f t b
Hang on the
False case of
bool.
onFalse b t f = bool f t b
Same as
bool, except the
Bool comes before the case
functions.
Equivalent type signature:
boolL :: forall r. Analysis Bool r
The implementation is just:
boolL = gcase
A simple conditional operator
Fold left for n-ary tuples
>>> foldlT (-) 0 (4,3,2,1)
-10
Fold right for n-ary tuples
>>> foldrT (-) 0 (4,3,2,1)
2
balanceL p l r returns a balanced tree for the sequence l
++ [p] ++ r.
It assumes that l and r are close to being balanced,
and that only l may contain too many elements.
balanceR p l r returns a balanced tree for the sequence l
++ [p] ++ r.
It assumes that l and r are close to being balanced,
and that only r may contain too many elements.