Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.Function related functions.
Synopsis
- type UOp t = t -> t
- type BinOp t = t -> t -> t
- recur_n :: Integral n => n -> (t -> t) -> t -> t
- const2 :: a -> b -> c -> a
- predicate_and :: (t -> Bool) -> (t -> Bool) -> t -> Bool
- predicate_all :: [t -> Bool] -> t -> Bool
- predicate_or :: (t -> Bool) -> (t -> Bool) -> t -> Bool
- predicate_any :: [t -> Bool] -> t -> Bool
- eq_on :: Eq t => (u -> t) -> u -> u -> Bool
- fmap2 :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
- fmap3 :: (Functor f, Functor g, Functor h) => (a -> b) -> f (g (h a)) -> f (g (h b))
- fmap4 :: (Functor f, Functor g, Functor h, Functor i) => (a -> b) -> f (g (h (i a))) -> f (g (h (i b)))
- fmap5 :: (Functor f, Functor g, Functor h, Functor i, Functor j) => (a -> b) -> f (g (h (i (j a)))) -> f (g (h (i (j b))))
- fmap6 :: (Functor f, Functor g, Functor h, Functor i, Functor j, Functor k) => (a -> b) -> f (g (h (i (j (k a))))) -> f (g (h (i (j (k b)))))
- (.:) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
- (.::) :: (Functor f, Functor g, Functor h) => (a -> b) -> f (g (h a)) -> f (g (h b))
- (.:::) :: (Functor f, Functor g, Functor h, Functor i) => (a -> b) -> f (g (h (i a))) -> f (g (h (i b)))
- (.::::) :: (Functor f, Functor g, Functor h, Functor i, Functor j) => (a -> b) -> f (g (h (i (j a)))) -> f (g (h (i (j b))))
- (.:::::) :: (Functor f, Functor g, Functor h, Functor i, Functor j, Functor k) => (a -> b) -> f (g (h (i (j (k a))))) -> f (g (h (i (j (k b)))))
- bimap1f :: Bifunctor p => (a -> b) -> p a a -> p b b
- bimap1 :: (t -> u) -> (t, t) -> (u, u)
Documentation
recur_n :: Integral n => n -> (t -> t) -> t -> t Source #
Iterate the function f n times, the inital value is x.
recur_n 5 (* 2) 1 == 32 take (5 + 1) (iterate (* 2) 1) == [1,2,4,8,16,32]
Predicate composition.
predicate_and :: (t -> Bool) -> (t -> Bool) -> t -> Bool Source #
&&
of predicates, ie. do predicates f and g both hold at x.
predicate_all :: [t -> Bool] -> t -> Bool Source #
List variant of predicate_and
, ie. foldr1
let r = [False,False,True,False,True,False] map (predicate_all [(> 0),(< 5),even]) [0..5] == r
predicate_any :: [t -> Bool] -> t -> Bool Source #
any
of predicates, ie. logical or of list of predicates.
let r = [True,False,True,False,True,True] map (predicate_any [(== 0),(== 5),even]) [0..5] == r
Function composition.
fmap3 :: (Functor f, Functor g, Functor h) => (a -> b) -> f (g (h a)) -> f (g (h b)) Source #
fmap of fmap2, ie. (t -> d) -> (a -> b -> c -> t) -> a -> b -> c -> d
.
fmap4 :: (Functor f, Functor g, Functor h, Functor i) => (a -> b) -> f (g (h (i a))) -> f (g (h (i b))) Source #
fmap of fmap3.
fmap5 :: (Functor f, Functor g, Functor h, Functor i, Functor j) => (a -> b) -> f (g (h (i (j a)))) -> f (g (h (i (j b)))) Source #
fmap of fmap4
fmap6 :: (Functor f, Functor g, Functor h, Functor i, Functor j, Functor k) => (a -> b) -> f (g (h (i (j (k a))))) -> f (g (h (i (j (k b))))) Source #
fmap of fmap5
(.:) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b) infixr 8 Source #
Operator name for fmap2.
(.::) :: (Functor f, Functor g, Functor h) => (a -> b) -> f (g (h a)) -> f (g (h b)) infixr 8 Source #
Operator name for fmap3.
(.:::) :: (Functor f, Functor g, Functor h, Functor i) => (a -> b) -> f (g (h (i a))) -> f (g (h (i b))) infixr 8 Source #
Operator name for fmap4.
(.::::) :: (Functor f, Functor g, Functor h, Functor i, Functor j) => (a -> b) -> f (g (h (i (j a)))) -> f (g (h (i (j b)))) infixr 8 Source #
Operator name for fmap5.
(.:::::) :: (Functor f, Functor g, Functor h, Functor i, Functor j, Functor k) => (a -> b) -> f (g (h (i (j (k a))))) -> f (g (h (i (j (k b))))) infixr 8 Source #
Operator name for fmap6.