# beuke.org

## A personal blog about computer science topics.

Pronounceable Names for Common Haskell Operators
Posted on Aug 14 2018 ~ 2 min read

(Just a) small collection of Haskell operators with some funny names for them. Haskell tutorials and discussions can sometimes be very dry, so lets “Put the fun back into computing” (distrowatch).

## TIE fighter <*>

Package Module Description
base Control.Applicative Sequential application.

Definition:
(<*>) :: f (a -> b) -> f a -> f b
(<*>) = liftA2 id

Example:

Other names: ap, apply

## Wedge-shaped Imperial Star Destroyer <|>

Package Module Description
base Control.Applicative Associative binary operation.

Definition:
(<|>) :: f a -> f a -> f a
(<|>) = (++)

Example:

Other names: or, alternative

## TIE bomber <**>

Package Module Description
base Control.Applicative A variant of <*> with arguments reversed.

Definition:
(<**>) :: f a -> f (a -> b) -> f b
(<**>) = liftA2 (\a f -> f a)

Example:

## Right fish >=>

Package Module Description

Definition:
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
f >=> g = \x -> f x >>= g

Example:

## Left fish

Package Module Description
base Control.Monad (>=>), with arguments flipped.

(<=<) :: Monad m=> (b -> m c) -> (a -> m b) -> (a -> m c)
(<=<)=flip (>=>)

Example:

## Right pipe >>>

Package Module Description
base Control.Category Left-to-right composition.

(>>>) :: cat a b -> cat b c -> cat a c
f >>> g = g . f

Example:

## Left pipe .

Package Module Description
base Prelude Right-to-left composition.

Definition:
(.) :: (b -> c) -> (a -> b) -> a -> c
(.) f g = \x -> f (g x)

Example:

# Operators and shenanigans without funny names, yet

Notation Signature Description
>>= (>>=) :: Monad m => m a -> (a -> m b) -> m b bind
>> (>>) :: Monad m => m a -> m b -> m b then
-> to
<-< /td> bind
<$> (<$>) :: Functor f => (a -> b) -> f a -> f b fmap
<$< /td> (<$) :: Functor f=> a -> f b -> f a map-replace by
!! (!!) :: [a] -> Int -> a index
! strict
++ (++) :: [a] -> [a] -> [a] concat
[] ([]) :: [a] empty list
: (😃 :: a -> [a] -> [a] cons
:: of type
| lambda
@ as
~ lazy