Commit 2e80c823 authored by Camil Staps's avatar Camil Staps 🐧

Make on (Data.Func) a macro to avoid heavy heap usage

parent 3ebf02c1
Pipeline #39669 passed with stage
in 1 minute and 58 seconds
......@@ -63,8 +63,10 @@ fix :: !(a -> a) -> a
*
* Typical usage: `sortBy (on (<) toInt) :: [a] -> [a] | toInt a`
* Or infix: `sortBy ((<) `on` toInt) :: [a] -> [a] | toInt a`
*
* @type (b b -> c) (a -> b) -> (a a -> c)
*/
on :: (b b -> c) (a -> b) -> (a a -> c)
on f g :== \x y -> f (g x) (g y)
/**
* Infix version of {{`on`}}.
......
......@@ -45,9 +45,6 @@ mapSt f [x:xs] st
fix :: !(a -> a) -> a
fix f = let x = f x in x
on :: (b b -> c) (a -> b) -> (a a -> c)
on f g = \x y -> f (g x) (g y)
hyperstrict :: !.a -> .a
hyperstrict a = code {
push_a 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment