-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Write more understandable Haskell. -- -- Flow provides operators for writing more understandable Haskell. @package flow @version 1.0.13 -- | Flow provides operators for writing more understandable Haskell. It is -- an alternative to some common idioms like ($) for function -- application and (.) for function composition. -- -- Flow is designed to be imported unqualified. It does not export -- anything that conflicts with the base package. -- --
-- >>> import Flow ---- --
-- >>> 3 |> succ |> recip |> negate -- -0.25 ---- -- Or use it anywhere you would use (&). -- --
-- \ x -> (x |> f) == f x ---- --
-- \ x -> (x |> f |> g) == g (f x) --(|>) :: a -> (a -> b) -> b infixl 0 |> -- | Right-associative apply operator. Read as "apply backward" or -- "pipe from". Use this to create long chains of computation that -- suggest which direction things move in. You may prefer this operator -- over (|>) for IO actions since it puts the last -- function first. -- --
-- >>> print <| negate <| recip <| succ <| 3 -- -0.25 ---- -- Or use it anywhere you would use ($). -- -- Note that (<|) and (|>) have the same precedence, -- so they cannot be used together. -- --
-- >>> -- This doesn't work! -- -- >>> -- print <| 3 |> succ |> recip |> negate ---- --
-- \ x -> (f <| x) == f x ---- --
-- \ x -> (g <| f <| x) == g (f x) --(<|) :: (a -> b) -> a -> b infixr 0 <| -- | Function application. This function usually isn't necessary, but it -- can be more readable than some alternatives when used with -- higher-order functions like map. -- --
-- >>> map (apply 2) [succ, recip, negate] -- [3.0,0.5,-2.0] ---- -- In general you should prefer using an explicit lambda or operator -- section. -- --
-- >>> map (\ f -> 2 |> f) [succ, recip, negate] -- [3.0,0.5,-2.0] -- -- >>> map (2 |>) [succ, recip, negate] -- [3.0,0.5,-2.0] -- -- >>> map (<| 2) [succ, recip, negate] -- [3.0,0.5,-2.0] ---- --
-- \ x -> apply x f == f x --apply :: a -> (a -> b) -> b -- | Left-associative compose operator. Read as "compose forward" or -- "and then". Use this to create long chains of computation that suggest -- which direction things move in. -- --
-- >>> let f = succ .> recip .> negate -- -- >>> f 3 -- -0.25 ---- -- Or use it anywhere you would use (>>>). -- --
-- \ x -> (f .> g) x == g (f x) ---- --
-- \ x -> (f .> g .> h) x == h (g (f x)) --(.>) :: (a -> b) -> (b -> c) -> (a -> c) infixl 9 .> -- | Right-associative compose operator. Read as "compose backward" -- or "but first". Use this to create long chains of computation that -- suggest which direction things move in. You may prefer this operator -- over (.>) for IO actions since it puts the last -- function first. -- --
-- >>> let f = print <. negate <. recip <. succ -- -- >>> f 3 -- -0.25 ---- -- Or use it anywhere you would use (.). -- -- Note that (<.) and (.>) have the same precedence, -- so they cannot be used together. -- --
-- >>> -- This doesn't work! -- -- >>> -- print <. succ .> recip .> negate ---- --
-- \ x -> (g <. f) x == g (f x) ---- --
-- \ x -> (h <. g <. f) x == h (g (f x)) --(<.) :: (b -> c) -> (a -> b) -> (a -> c) infixr 9 <. -- | Function composition. This function usually isn't necessary, but it -- can be more readable than some alternatives when used with -- higher-order functions like map. -- --
-- >>> let fs = map (compose succ) [recip, negate] -- -- >>> map (apply 3) fs -- [0.25,-4.0] ---- -- In general you should prefer using an explicit lambda or operator -- section. -- --
-- >>> map (\ f -> f 3) (map (\ f -> succ .> f) [recip, negate]) -- [0.25,-4.0] -- -- >>> map (\ f -> f 3) (map (succ .>) [recip, negate]) -- [0.25,-4.0] -- -- >>> map (\ f -> f 3) (map (<. succ) [recip, negate]) -- [0.25,-4.0] ---- --
-- \ x -> compose f g x == g (f x) --compose :: (a -> b) -> (b -> c) -> (a -> c) -- | Left-associative apply' operator. Read as "strict apply -- forward" or "strict pipe info". Use this to create long chains of -- computation that suggest which direction things move in. -- --
-- >>> 3 !> succ !> recip !> negate -- -0.25 ---- -- The difference between this and (|>) is that this evaluates -- its argument before passing it to the function. -- --
-- >>> undefined |> const True -- True -- -- >>> undefined !> const True -- *** Exception: Prelude.undefined -- ... ---- --
-- \ x -> (x !> f) == seq x (f x) ---- --
-- \ x -> (x !> f !> g) == let y = seq x (f x) in seq y (g y) --(!>) :: a -> (a -> b) -> b infixl 0 !> -- | Right-associative apply' operator. Read as "strict apply -- backward" or "strict pipe from". Use this to create long chains of -- computation that suggest which direction things move in. You may -- prefer this operator over (!>) for IO actions since -- it puts the last function first. -- --
-- >>> print <! negate <! recip <! succ <! 3 -- -0.25 ---- -- The difference between this and (<|) is that this evaluates -- its argument before passing it to the function. -- --
-- >>> const True <| undefined -- True -- -- >>> const True <! undefined -- *** Exception: Prelude.undefined -- ... ---- -- Note that (<!) and (!>) have the same precedence, -- so they cannot be used together. -- --
-- >>> -- This doesn't work! -- -- >>> -- print <! 3 !> succ !> recip !> negate ---- --
-- \ x -> (f <! x) == seq x (f x) ---- --
-- \ x -> (g <! f <! x) == let y = seq x (f x) in seq y (g y) --( b) -> a -> b infixr 0 map. -- --
-- >>> map (apply' 2) [succ, recip, negate] -- [3.0,0.5,-2.0] ---- -- The different between this and apply is that this evaluates its -- argument before passing it to the function. -- --
-- >>> apply undefined (const True) -- True -- -- >>> apply' undefined (const True) -- *** Exception: Prelude.undefined -- ... ---- -- In general you should prefer using an explicit lambda or operator -- section. -- --
-- >>> map (\ f -> 2 !> f) [succ, recip, negate] -- [3.0,0.5,-2.0] -- -- >>> map (2 !>) [succ, recip, negate] -- [3.0,0.5,-2.0] -- -- >>> map (<! 2) [succ, recip, negate] -- [3.0,0.5,-2.0] ---- --
-- \ x -> apply' x f == seq x (f x) --apply' :: a -> (a -> b) -> b