@@ -46,7 +46,7 @@ which happen to be radians.
4646@docs fst, snd
4747
4848# Higher-Order Helpers
49−@docs id, always, (<|), (|>), (.), flip, curry, uncurry
49+@docs id, always, (<|), (|>), (<<), (>>), flip, curry, uncurry
5050
5151-}
5252
@@ -301,21 +301,32 @@ isInfinite = Native.Basics.isInfinite
301301
302302-- Function Helpers
303303
304−{-| Function composition. For example, the following code checks if the square
305−root of a number is odd:
304+{-| Function composition, passing results along in the suggested direction. For
305+example, the following code checks if the square root of a number is odd:
306306
307− not . isEven . sqrt
307+ not << isEven << sqrt
308308
309309You can think of this operator as equivalent to the following:
310310
311− (f . g) == (\x -> f (g x))
311+ (g << f) == (\x -> g (f x))
312312
313−So our example is expanding things out to this:
313+So our example expands out to something like this:
314314
315− \number -> not (isEven (sqrt number))
315+ \n -> not (isEven (sqrt n))
316316-}
317−(.) : (b -> c) -> (a -> b) -> (a -> c)
318−(.) f g x = f (g x)
317+(<<) : (b -> c) -> (a -> b) -> (a -> c)
318+(<<) g f x = g (f x)
319+
320+{-| Function composition, passing results along in the suggested direction. For
321+example, the following code checks if the square root of a number is odd:
322+
323+ sqrt >> isEven >> not
324+
325+This direction of function composition seems less pleasant than `(<<)` which
326+reads nicely in expressions like: `filter (not << isRegistered) students`
327+-}
328+(>>) : (a -> b) -> (b -> c) -> (a -> c)
329+(>>) f g x = g (f x)
319330
320331{-| Forward function application `x |> f == f x`. This function is useful
321332for avoiding parenthesis and writing code in a more natural way.
@@ -344,7 +355,8 @@ This can also be written as:
344355(<|) : (a -> b) -> a -> b
345356f <| x = f x
346357
347−infixr 9 .
358+infixr 9 <<
359+infixl 9 >>
348360infixr 0 <|
349361infixl 0 |>
350362