flow-er-1.0.3: More directional operators

Control.Flower.Apply.Lazy

Description

Synopsis

• (<|) :: (a -> b) -> a -> b
• (|>) :: a -> (a -> b) -> b
• (|<) :: (a -> b) -> a -> b
• (>|) :: a -> (a -> b) -> b

# Documentation

(<|) :: (a -> b) -> a -> b infixr 0 Source #

Left-flowing application, equivalent to 'prelude.$'. Read as "backwards application", "pipe from", or "pull from". >>> (f <| x) == f x True >>> (g <| f <| x) == g (f x) True This operator can be chained together to show the dataflow through a series of functions >>> negate <| succ <| 3 :: Int -4 (|>) :: a -> (a -> b) -> b infixl 0 Source # Right-flowing application, equivalent to 'prelude.$'.

Read as "forwards application" or "pipe into".

>>> (x |> f) == f x
True
>>> (x |> f |> g) == g (f x)
True

This operator can be chained together to show the dataflow through a series of functions

>>> 3 |> succ |> negate :: Int
-4

(|<) :: (a -> b) -> a -> b infixl 0 Source #

Left-flowing, left-associative application

Read as "pipe into the result of". It may seem odd in trivial cases, but is useful for functions that take more than one argument, as it will partially apply arguments one at a time.

>>> (f |< x) == f x
True
>>> (h |< y |< x) == ((h <| y) <| x)
True

Can be chained together to show the dataflow through a series of functions

>>> (+) |< 3 |< 5 :: Int
8

(>|) :: a -> (a -> b) -> b infixr 0 Source #

Right-flowing, right-associative application

Read as "pipe from the result of", or "pull from the result from". It may seem odd in trivial cases, but is useful for functions that take more than one argument.

>>> (x >| f) == f x
True
>>> (x >| y >| h) == (x |> (y |> h))
True

Can be chained together to show the dataflow through a series of functions

>>> 3 >| 5 >| (+)
8