@@ -46,7 +46,7 @@ which happen to be radians.
46@docs fst, snd
46@docs fst, snd
48# Higher-Order Helpers
48# Higher-Order Helpers
49−@docs identity, always, (<|), (|>), (.), flip, curry, uncurry
49+@docs identity, always, (<|), (|>), (<<), (>>), flip, curry, uncurry
@@ -316,21 +316,32 @@ isInfinite = Native.Basics.isInfinite
317-- Function Helpers
317-- Function Helpers
319+{-| Function composition, passing results along in the suggested direction. For
319−{-| Function composition. For example, the following code checks if the square
320+example, the following code checks if the square root of a number is odd:
320−root of a number is odd:
322− not . isEven . sqrt
322+ not << isEven << sqrt
324You can think of this operator as equivalent to the following:
324You can think of this operator as equivalent to the following:
326− (f . g) == (\x -> f (g x))
326+ (g << f) == (\x -> g (f x))
328−So our example is expanding things out to this:
328+So our example expands out to something like this:
330− \number -> not (isEven (sqrt number))
330+ \n -> not (isEven (sqrt n))
332−(.) : (b -> c) -> (a -> b) -> (a -> c)
332+(<<) : (b -> c) -> (a -> b) -> (a -> c)
335+{-| Function composition, passing results along in the suggested direction. For
336+example, the following code checks if the square root of a number is odd:
338+ sqrt >> isEven >> not
340+This direction of function composition seems less pleasant than `(<<)` which
341+reads nicely in expressions like: `filter (not << isRegistered) students`
343+(>>) : (a -> b) -> (b -> c) -> (a -> c)
333−(.) f g x = f (g x)
344+(>>) f g x = g (f x)
335{-| Forward function application `x |> f == f x`. This function is useful
346{-| Forward function application `x |> f == f x`. This function is useful
336for avoiding parenthesis and writing code in a more natural way.
347for avoiding parenthesis and writing code in a more natural way.
@@ -359,7 +370,8 @@ This can also be written as:
359(<|) : (a -> b) -> a -> b
370(<|) : (a -> b) -> a -> b
360f <| x = f x
371f <| x = f x
362−infixr 9 .
373+infixr 9 <<
363infixr 0 <|
375infixr 0 <|
364infixl 0 |>
376infixl 0 |>