{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Primus.Extra (
on1,
on2,
comparing1,
(.@),
) where
on1 ::
forall f a a' b c.
(b -> b -> c) ->
(forall x. f x -> b) ->
f a ->
f a' ->
c
on1 :: (b -> b -> c) -> (forall (x :: k). f x -> b) -> f a -> f a' -> c
on1 b -> b -> c
f forall (x :: k). f x -> b
g f a
fa f a'
fa' = b -> b -> c
f (f a -> b
forall (x :: k). f x -> b
g f a
fa) (f a' -> b
forall (x :: k). f x -> b
g f a'
fa')
on2 ::
forall f a a' a2 a2' b c.
(b -> b -> c) ->
(forall x y. f x y -> b) ->
f a a2 ->
f a' a2' ->
c
on2 :: (b -> b -> c)
-> (forall (x :: k) (y :: k). f x y -> b)
-> f a a2
-> f a' a2'
-> c
on2 b -> b -> c
f forall (x :: k) (y :: k). f x y -> b
g f a a2
fa f a' a2'
fa' = b -> b -> c
f (f a a2 -> b
forall (x :: k) (y :: k). f x y -> b
g f a a2
fa) (f a' a2' -> b
forall (x :: k) (y :: k). f x y -> b
g f a' a2'
fa')
comparing1 ::
forall f a a' b.
Ord b =>
(forall x. f x -> b) ->
f a ->
f a' ->
Ordering
comparing1 :: (forall (x :: k). f x -> b) -> f a -> f a' -> Ordering
comparing1 forall (x :: k). f x -> b
g f a
fa f a'
fa' = b -> b -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (f a -> b
forall (x :: k). f x -> b
g f a
fa) (f a' -> b
forall (x :: k). f x -> b
g f a'
fa')
(.@) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
.@ :: (c -> d) -> (a -> b -> c) -> a -> b -> d
(.@) = ((b -> c) -> b -> d) -> (a -> b -> c) -> a -> b -> d
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) (((b -> c) -> b -> d) -> (a -> b -> c) -> a -> b -> d)
-> ((c -> d) -> (b -> c) -> b -> d)
-> (c -> d)
-> (a -> b -> c)
-> a
-> b
-> d
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (c -> d) -> (b -> c) -> b -> d
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.)
infixr 8 .@