coercible-utils-0.1.0: Utility functions for Coercible types

Safe HaskellNone
LanguageHaskell2010

CoercibleUtils

Description

This module reexports the entire content of the `coercible-utils` package.

See the Newtype module for the newtype combinators.

Note: Most functions in this package take an argument that solely directs the type of the coercion. The value of this argument is ignored. In each case, this argument has a type that looks like a `to` b. As the name of the to type variable suggests, this will typically be a function from a to b. But leaving the type variable completely polymorphic and unconstrained lets the type signature communicate the fact that the argument is not used.

Synopsis

Documentation

(#.) :: Coercible b c => (b `to` c) -> (a -> b) -> a -> c infixr 9 Source #

Coercive left-composition.

>>> (All #. not) True
All {getAll = False}

The semantics with respect to bottoms are:

p #. ⊥ ≡ ⊥
p #. f ≡ p . f

(.#) :: Coercible a b => (b -> c) -> (a `to` b) -> a -> c infixr 9 Source #

Coercive right-composition.

>>> (stimes 2 .# Product) 3
Product {getProduct = 9}

The semantics with respect to bottoms are:

.# p ≡ ⊥
f .# p ≡ p . f