flow-er-1.0.3: More directional operators

Safe HaskellSafe
LanguageHaskell2010

Control.Flower.Apply.Strict

Description

 

Synopsis

Documentation

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

Right-flowing strict application, equivalent to 'prelude.$'.

Read as "forward strict application" or "strict 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 -> (a -> b) -> b infixl 0 Source #

Left-flowing strict application, equivalent to 'prelude.$'.

Read as "backwards strict application", "strict pipe from", or "strict 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 -> b) -> a -> b infixl 1 Source #

Left-flowing, left-associative strict application

Read as "strictly 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 1 Source #

Right-flowing, right-associative strict application

Read as "strictly pipe from the result of", or "strictly 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