Safe Haskell | None |
---|---|

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
- (.@) :: (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
- (-.) :: (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
- (<=*<) :: 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)
- (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- (&) :: 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

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

As an example:

λ:> ((*2) .* (+)) 1 3 4 16

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

*Since: 1.0.0.0*

# Precomposition

(.@@@) :: (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*

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

Deprecated: Use .@@ instead

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

Deprecated: Use .@@@ instead

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

Deprecated: Use .@@@@ instead

# 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, we could use this to rewrite

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

to

between .$ (char '"')

*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

# Reëxports from base

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

Left-to-right composition of Kleisli arrows.

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'`

argument, hence
the recursion is reintroduced.