Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell98 |

## Synopsis

- (.*) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
- (.**) :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
- (.***) :: (e -> f) -> (a -> b -> c -> d -> e) -> a -> b -> c -> d -> f
- (.****) :: (f -> g) -> (a -> b -> c -> d -> e -> f) -> a -> b -> c -> d -> e -> g
- (.*****) :: (g -> h) -> (a -> b -> c -> d -> e -> f -> g) -> a -> b -> c -> d -> e -> f -> h
- (.******) :: (h -> i) -> (a -> b -> c -> d -> e -> f -> g -> h) -> a -> b -> c -> d -> e -> f -> g -> i
- (-.) :: (a -> b) -> (b -> c) -> a -> c
- (.@) :: (b -> c) -> (a -> c -> d) -> a -> b -> d
- (.@@) :: (c -> d) -> (a -> b -> d -> e) -> a -> b -> c -> e
- (.@@@) :: (d -> e) -> (a -> b -> c -> e -> f) -> a -> b -> c -> d -> f
- (.@@@@) :: (e -> f) -> (a -> b -> c -> d -> f -> g) -> a -> b -> c -> d -> e -> g
- (.@@@@@) :: (f -> g) -> (a -> b -> c -> d -> e -> g -> h) -> a -> b -> c -> d -> e -> f -> h
- (<=*<) :: Monad m => (c -> m d) -> (a -> b -> m c) -> a -> b -> m d
- (<=**<) :: Monad m => (d -> m e) -> (a -> b -> c -> m d) -> a -> b -> c -> m e
- (>=**>) :: Monad m => (a -> b -> c -> m d) -> (d -> m e) -> a -> b -> c -> m e
- (>=*>) :: Monad m => (a -> b -> m c) -> (c -> m d) -> a -> b -> m d
- (<-=*<) :: Monad m => (b -> m c) -> (a -> c -> m d) -> a -> b -> m d
- (>-=*>) :: Monad m => (a -> c -> m d) -> (b -> m c) -> a -> b -> m d
- (<-=**<) :: Monad m => (c -> m d) -> (a -> b -> d -> m e) -> a -> b -> c -> m e
- (>-=**>) :: Monad m => (a -> b -> d -> m e) -> (c -> m d) -> a -> b -> c -> m e
- between :: (c -> d) -> (a -> b) -> (b -> c) -> a -> d
- (~@~) :: (c -> d) -> (a -> b) -> (b -> c) -> a -> d
- betweenM :: Monad m => (c -> m d) -> (a -> m b) -> (b -> m c) -> a -> m d
- (<~@~<) :: Monad m => (c -> m d) -> (a -> m b) -> (b -> m c) -> a -> m d
- (-$) :: (a -> b -> c) -> b -> a -> c
- bisequence' :: (Traversable t, Applicative f) => t (a -> b -> f c) -> a -> b -> t (f c)
- (.$) :: Monad m => m (m a) -> m a
- axe :: (Traversable t, Applicative f) => t (a -> f ()) -> a -> f ()
- biaxe :: (Traversable t, Applicative f) => t (a -> b -> f ()) -> a -> b -> f ()
- thread :: Foldable t => t (a -> a) -> a -> a
- threadM :: (Monad m, Foldable t, Applicative m) => t (a -> m a) -> a -> m a
- both :: (a -> b) -> (a, a) -> (b, b)
- dup :: a -> (a, a)
- (+>) :: (a -> b) -> (a, a) -> (b, b)
- (&:) :: (b -> b -> c) -> (a -> b) -> a -> a -> c
- (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- (<**>) :: Applicative f => f a -> f (a -> b) -> f b
- (&) :: a -> (a -> b) -> b
- (<&>) :: Functor f => f a -> (a -> b) -> f b
- fix :: (a -> a) -> a
- on :: (b -> b -> c) -> (a -> b) -> a -> a -> c

# Postcomposition

(.****) :: (f -> g) -> (a -> b -> c -> d -> e -> f) -> a -> b -> c -> d -> e -> g infixr 8 Source #

*Since: 1.0.0.0*

(.*****) :: (g -> h) -> (a -> b -> c -> d -> e -> f -> g) -> a -> b -> c -> d -> e -> f -> h infixr 8 Source #

*Since: 2.0.5.0*

(.******) :: (h -> i) -> (a -> b -> c -> d -> e -> f -> g -> h) -> a -> b -> c -> d -> e -> f -> g -> i infixr 8 Source #

*Since: 2.0.5.0*

# Precomposition

(-.) :: (a -> b) -> (b -> c) -> a -> c infixr 8 Source #

Backwards function composition. This is a specialization of `<&>`

, but it
has a different fixity.

(.@@@) :: (d -> e) -> (a -> b -> c -> e -> f) -> a -> b -> c -> d -> f infixr 8 Source #

*Since: 2.0.3.0*

(.@@@@) :: (e -> f) -> (a -> b -> c -> d -> f -> g) -> a -> b -> c -> d -> e -> g infixr 8 Source #

*Since: 2.0.3.0*

(.@@@@@) :: (f -> g) -> (a -> b -> c -> d -> e -> g -> h) -> a -> b -> c -> d -> e -> f -> h infixr 8 Source #

*Since: 3.0.0.0*

# Monadic postcomposition

(<=**<) :: Monad m => (d -> m e) -> (a -> b -> c -> m d) -> a -> b -> c -> m e infixr 1 Source #

The bleeding fish operator

*Since: 1.5.2.0*

(>=**>) :: Monad m => (a -> b -> c -> m d) -> (d -> m e) -> a -> b -> c -> m e infixr 1 Source #

*Since: 1.5.2.0*

(>=*>) :: Monad m => (a -> b -> m c) -> (c -> m d) -> a -> b -> m d infixr 1 Source #

Compare `>=>`

.

*Since: 1.5.2.0*

# Monadic precomposition

(<-=*<) :: Monad m => (b -> m c) -> (a -> c -> m d) -> a -> b -> m d infixr 1 Source #

*Since: 1.5.2.0*

(>-=*>) :: Monad m => (a -> c -> m d) -> (b -> m c) -> a -> b -> m d infixr 1 Source #

*Since: 1.5.2.0*

(<-=**<) :: Monad m => (c -> m d) -> (a -> b -> d -> m e) -> a -> b -> c -> m e infixr 1 Source #

*Since: 1.5.2.0*

(>-=**>) :: Monad m => (a -> b -> d -> m e) -> (c -> m d) -> a -> b -> c -> m e infixr 1 Source #

*Since: 1.5.2.0*

# Between combinators

between :: (c -> d) -> (a -> b) -> (b -> c) -> a -> d Source #

Can be used to rewrite

\g -> f . g . h

to

between f h

*Since: 1.5.3.0*

# Fancy function application

(-$) :: (a -> b -> c) -> b -> a -> c infixl 8 Source #

Backwards function application. This is an infix synonym for `flip`

# Monadic helpers

bisequence' :: (Traversable t, Applicative f) => t (a -> b -> f c) -> a -> b -> t (f c) Source #

(.$) :: Monad m => m (m a) -> m a infixl 3 Source #

Infix version of `join`

As an example, one could use this to rewrite

between (char '"') (char '"')

to

between .$ (char '"')

Or

fromEither :: Either a a -> a fromEither = either id id

to

fromEither :: Either a a -> a fromEither = either .$ id

*Since: 2.0.2.0*

# Monadic actions

axe :: (Traversable t, Applicative f) => t (a -> f ()) -> a -> f () Source #

biaxe :: (Traversable t, Applicative f) => t (a -> b -> f ()) -> a -> b -> f () Source #

# Composition with lists of functions

# Tuple helpers

# J inspired

(&:) :: (b -> b -> c) -> (a -> b) -> a -> a -> c infixl 0 Source #

Pronounced 'appose'. Synonym for `on`

*Since: 3.0.0.0*

# Reëxports from base

(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 #

Left-to-right composition of Kleisli arrows.

'`(bs `

' can be understood as the `>=>`

cs) a`do`

expression

do b <- bs a cs b

(<**>) :: Applicative f => f a -> f (a -> b) -> f b infixl 4 #

is the least fixed point of the function `fix`

f`f`

,
i.e. the least defined `x`

such that `f x = x`

.

For example, we can write the factorial function using direct recursion as

`>>>`

120`let fac n = if n <= 1 then 1 else n * fac (n-1) in fac 5`

This uses the fact that Haskell’s `let`

introduces recursive bindings. We can
rewrite this definition using `fix`

,

`>>>`

120`fix (\rec n -> if n <= 1 then 1 else n * rec (n-1)) 5`

Instead of making a recursive call, we introduce a dummy parameter `rec`

;
when used within `fix`

, this parameter then refers to `fix`

’s argument, hence
the recursion is reintroduced.