on

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.
An ON clause, useful to describe how two tables are related. Cross joins and tuple-joins do not need an on clause, but InnerJoin and the various outer joins do. Database.Esqueleto.Experimental in version 4.0.0.0 of the library. The Experimental module has a dramatically improved means for introducing tables and entities that provides more power and less potential for runtime errors. If you don't include an on clause (or include too many!) then a runtime exception will be thrown. As an example, consider this simple join:
select $
from $ \(foo `InnerJoin` bar) -> do
on (foo ^. FooId ==. bar ^. BarFooId)
...
We need to specify the clause for joining the two columns together. If we had this:
select $
from $ \(foo `CrossJoin` bar) -> do
...
Then we can safely omit the on clause, because the cross join will make pairs of all records possible. You can do multiple on clauses in a query. This query joins three tables, and has two on clauses:
select $
from $ \(foo `InnerJoin` bar `InnerJoin` baz) -> do
on (baz ^. BazId ==. bar ^. BarBazId)
on (foo ^. FooId ==. bar ^. BarFooId)
...
Old versions of esqueleto required that you provide the on clauses in reverse order. This restriction has been lifted - you can now provide on clauses in any order, and the SQL should work itself out. The above query is now totally equivalent to this:
select $
from $ \(foo `InnerJoin` bar `InnerJoin` baz) -> do
on (foo ^. FooId ==. bar ^. BarFooId)
on (baz ^. BazId ==. bar ^. BarBazId)
...
An ON clause that describes how two tables are related. This should be used as an infix operator after a JOIN. For example,
select $
from $ table @Person
`innerJoin` table @BlogPost
`on` (\(p :& bP) ->
p ^. PersonId ==. bP ^. BlogPostAuthorId)
(*) `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)
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)
Connect the given signal to a signal handler.
The composition of two AD modes is an AD mode in its own right
Lift a binary function to the domain of a projection.

Example

>>> :kind! Eval (((&&) `On` Fst) '( 'True, 'Nothing) '( 'False, 'Just '()))
Eval (((&&) `On` Fst) '( 'True, 'Nothing) '( 'False, 'Just '())) :: Bool
= 'False
Activate setting
Vega event stream selector that triggers a selection, or the empty string (which sets the property to false).
Ontario
Like finally, but only performs the final action if there was an exception raised by the computation.
A more concise version of complement zeroBits.
>>> complement (zeroBits :: Word) == (oneBits :: Word)
True
>>> complement (oneBits :: Word) == (zeroBits :: Word)
True

Note

The constraint on oneBits is arguably too strong. However, as some types (such as Natural) have undefined complement, this is the only safe choice.