not-in-base-0.1.1: Useful utility functions that only depend on base.

NIB.Pointfree

Synopsis

Documentation

fst3 :: (a, b, c) -> aSource

snd3 :: (a, b, c) -> bSource

trd3 :: (a, b, c) -> cSource

lambdify :: (x -> y -> z) -> (t -> x) -> (t -> y) -> t -> zSource

Lambdifies a function. See '(||*)' and '(&&*)' for uses of lambdify. | Used in order to make operators capable of operating on functions that later on | are supplied some value that all functions operate on.

 (+*) = lambdify (+)
 fourTwo = (*4) +* (*2)
 42 == fourTwo 7

(||*) :: (a -> Bool) -> (a -> Bool) -> a -> BoolSource

Lambdifies '(||)'.

 isBlankOrCommaChecker = (==' ') ||* (==',')
 isBlankOrComma = isBlankOrCommaChecker 'j'

(&&*) :: (a -> Bool) -> (a -> Bool) -> a -> BoolSource

Lambdifies '(&&)'.

 isInRangeChecker = (>9) &&* (<30)
 isInRange = isInRangeChecker 17

(^..) :: (c -> d) -> (a -> b -> c) -> a -> b -> dSource

2-point-free operator. Similar to ., but where | the second function takes two (2) arguments instead of one (1).

 multAndSquare (^2) .^.. (*)
 36 == multAndSqare 2 3

(^...) :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> eSource

3-point-free operator. See '(^..)'.

(..%) :: (a -> b -> c) -> (a, b) -> cSource

Split a 2-tuple x into a 2-stack and pass it to f. | The same as uncurry.

(..%..) :: (c -> d -> e) -> (a -> b -> (c, d)) -> a -> b -> eSource

(...%) :: (a -> b -> c -> d) -> (a, b, c) -> dSource

Split a 3-tuple x into a 3-stack and pass it to f.

(>>*) :: Monad m => m a -> (a -> b) -> m bSource

Pipes a monadic return through a non-monadic transformation function. | liftM with arguments flipped.

 readIO >>* toUpper

(..@) :: (a -> b, a -> c) -> a -> (b, c)Source

gives `(9, 21)`, i.e. `(2 + 9, 3 * 7)`.

(...@) :: (a -> b, a -> c, a -> d) -> a -> (b, c, d)Source

Same as ..@, but with a 3-tuple.