on master help sign in
Control.Pipeline example usage
a6be726Louis Pilfold
libs/contrib/Control/Pipeline.idr+7−1
@@ -10,11 +10,17 @@ infixr 0 <|
10||| functions into a series of transformations, reading top
10||| functions into a series of transformations, reading top
11||| to bottom.
11||| to bottom.
12|||
12|||
13+||| ```idris example
13−||| [[1], [2], [3]] |> join |> map (* 2)
14+||| [[1], [2], [3]] |> join |> map (* 2)
15+||| ```
14(|>) : a -> (a -> b) -> b
16(|>) : a -> (a -> b) -> b
15a |> f = f a
17a |> f = f a
16
18
17
19
18||| Backwards pipeline style function application, similar to $.
20||| Backwards pipeline style function application, similar to $.
21+|||
22+||| ```idris example
23+||| unpack <| "hello" ++ "world"
24+||| ```
19(<|) : (a -> b) -> a -> b
25(<|) : (a -> b) -> a -> b
20f <| a = f a
26f <| a = f a