on -package:esqueleto is:exact
base Data.Function,
protolude Protolude,
relude Relude.Function,
rio RIO.Prelude,
base-prelude BasePrelude,
classy-prelude ClassyPrelude,
composition-prelude Control.Composition,
universum Universum.Function,
Cabal-syntax Distribution.Compat.Prelude,
numhask NumHask.Prelude,
foundation Foundation,
rebase Rebase.Prelude,
stack Stack.Prelude,
incipit-base Incipit.Base,
cabal-install-solver Distribution.Solver.Compat.Prelude,
loc Data.Loc.Internal.Prelude,
termonad Termonad.Prelude on b u x y runs the binary function
b
on the results of applying unary function
u to two
arguments
x and
y. From the opposite perspective, it
transforms two inputs and combines the outputs.
((+) `on` f) x y = f x + f y
Typical usage:
sortBy (compare `on`
fst).
Algebraic properties:
(*) `on` id = (*) -- (if (*) ∉ {⊥, const
⊥})
((*) `on` f) `on` g = (*) `on` (f . g)
flip on f . flip on g = flip on (g .
f)
Perform an action in response to a signal.
Use it like this:
on obj sig $ do
...
or if the signal handler takes any arguments:
on obj sig $ \args -> do
...
Connect a signal to a signal handler.
Build an attribute from a foreground color and a background color.
Intended to be used infix.
(*) `on` f = \x y -> f x * f y.
Typical usage:
sortBy (compare `on`
fst).
Algebraic properties:
Apply an implication to a predicate in the implicit context. The
(a ~~ n) parameter is not actually used; it's type is used to
help select a specific fact from the context.
@ -- A safe
head function, using an implicitly-passed safety
proof. head :: Fact (IsCons xs) => ([a] ~~ xs) -> a head xs =
Prelude.head (the xs)
- - Reverse, and a lemma. reverse :: ([a] ~~ xs) -> ([a] ~~
Reverse xs) revConsLemma :: Proof (IsCons xs) -> Proof (IsCons
(Reverse xs))
- - Implement a safe last function. last :: Fact (IsCons xs)
=> ([a] ~~ xs) -> a last xs = note (revConsLemma on xs) $
head (reverse xs)