on package:first-class-families

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
Append elements to two lists. Used in the definition of Unzip.
Conjunction of a list of constraints.
Type-level second. Apply a function along the second parameter of a bifunctor. This is generally equivalent to Map.

Example

>>> :kind! Eval (Second ((+) 1) '("a",3))
Eval (Second ((+) 1) '("a",3)) :: (Symbol, Nat)
= '("a", 4)
Concatenate a collection of elements from a monoid.

Example

For example, fold a list of lists.
Concat :: [[a]] -> Exp [a]
>>> :kind! Eval (Concat ( '[ '[1,2], '[3,4], '[5,6]]))
Eval (Concat ( '[ '[1,2], '[3,4], '[5,6]])) :: [Nat]
= '[1, 2, 3, 4, 5, 6]

>>> :kind! Eval (Concat ( '[ '[Int, Maybe Int], '[Maybe String, Either Double Int]]))
Eval (Concat ( '[ '[Int, Maybe Int], '[Maybe String, Either Double Int]])) :: [*]
= '[Int, Maybe Int, Maybe String, Either Double Int]
Map a function and concatenate the results. This is FoldMap specialized to the list monoid.
Semigroups and monoids.
Common data types: tuples, Either, Maybe.
Simple combinators for functions.
Append an element to a list.

Example

>>> :kind! Eval (Cons 1 '[2, 3])
Eval (Cons 1 '[2, 3]) :: [Nat]
= '[1, 2, 3]

>>> :kind! Eval (Cons Int '[Char, Maybe Double])
Eval (Cons Int '[Char, Maybe Double]) :: [*]
= '[Int, Char, Maybe Double]
Split a list into one where all elements satisfy a predicate, and a second where no elements satisfy it.

Example

>>> :kind! Eval (Partition ((>=) 35) '[ 20, 30, 40, 50])
Eval (Partition ((>=) 35) '[ 20, 30, 40, 50]) :: ([Nat], [Nat])
= '( '[20, 30], '[40, 50])