|
definition: |
ap :: Monad m => m (a -> b) -> m a -> m b ap m1 m2 = do x1 <- m1 x2 <- m2 return (x1 x2) |
|
demand: |
argument 1 |
|
deterministic: |
deterministic operation |
|
documentation: |
| Promotes function application to a monad.
For instance,
> pure not `ap` Just True
Just False
This is useful to promote application of functions with larger arities
to a monad, as 'liftM2' for arity `2`. For instance,
> pure (\x y z -> x + y * z) `ap` Just 7 `ap` Just 5 `ap` Just 7
Just 42
|
|
failfree: |
(_, _, _) |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_,_,_) |-> _}
|
|
name: |
ap |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
Monad a => a (b -> c) -> a b -> a c |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
yes |
|
totally-defined: |
reducible on all ground data terms |