pointless-haskell-0.0.2: Pointless Haskell library





Pointless Haskell: point-free programming with recursion patterns as hylomorphisms

This module defines many standard combinators used for point-free programming.


Terminal object

_L :: aSource

The bottom value for any type. It is many times used just for type annotations.

data One Source

The final object. The only possible value of type One is _L.


bang :: a -> OneSource

Creates a point to the terminal object.

pnt :: a -> One -> aSource

Converts elements into points.


(/\) :: (a -> b) -> (a -> c) -> a -> (b, c)Source

The infix split combinator.

(><) :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)Source


inl :: a -> Either a bSource

Injects a value to the left of a sum.

inr :: b -> Either a bSource

Injects a value to the right of a sum.

(\/) :: (b -> a) -> (c -> a) -> Either b c -> aSource

The infix either combinator.

(-|-) :: (a -> b) -> (c -> d) -> Either a c -> Either b dSource

The infix sum combinator.

(<>) :: (a -> b) -> (c -> d) -> Either a c -> Either b dSource

Alias for the infix sum combinator.


app :: (a -> b, a) -> bSource

The application combinator.

lexp :: (a -> b) -> (b -> c) -> a -> cSource

The left exponentiation combinator.

rexp :: (b -> c) -> (a -> b) -> a -> cSource

The right exponentiation combinator.

(!) :: a -> b -> aSource

The infix combinator for a constant point.


grd :: (a -> Bool) -> a -> Either a aSource

Guard combinator that operates on Haskell booleans.

(?) :: (a -> Bool) -> a -> Either a aSource

Infix guarc combinator that simulates the postfix syntax.

Point-free definitions of uncurried versions of the basic combinators

split :: (a -> b, a -> c) -> a -> (b, c)Source

The uncurried split combinator.

eithr :: (a -> c, b -> c) -> Either a b -> cSource

The uncurried either combinator.

comp :: (b -> c, a -> b) -> a -> cSource

The uncurried composition combinator.

Point-free isomorphic combinators

swap :: (a, b) -> (b, a)Source

Swap the elements of a product.

coswap :: Either a b -> Either b aSource

Swap the elements of a sum.

distl :: (Either a b, c) -> Either (a, c) (b, c)Source

Distribute products over the left of sums.

undistl :: Either (a, c) (b, c) -> (Either a b, c)Source

Distribute sums over the left of products.

distr :: (c, Either a b) -> Either (c, a) (c, b)Source

Distribute products over the right of sums.

undistr :: Either (c, a) (c, b) -> (c, Either a b)Source

Distribute sums over the right of products.

assocl :: (a, (b, c)) -> ((a, b), c)Source

Associate nested products to the left.

assocr :: ((a, b), c) -> (a, (b, c))Source

Associates nested products to the right.

coassocl :: Either a (Either b c) -> Either (Either a b) cSource

Associates nested sums to the left.

coassocr :: Either (Either a b) c -> Either a (Either b c)Source

Associates nested sums to the right.