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

Language | Haskell2010 |

Combinators for monadic profunctors.

## Synopsis

- with :: forall cc p x a. ForallF cc p => (cc (p x) => a) -> a
- with' :: forall cc p x a. ForallF cc p => (cc (p x) => p x a) -> p x a
- withFunctor :: ForallF Functor p => (Functor (p x) => p x a) -> p x a
- withApplicative :: ForallF Applicative p => (Applicative (p x) => p x a) -> p x a
- withAlternative :: ForallF Alternative p => (Alternative (p x) => p x a) -> p x a
- withMonad :: ForallF Monad p => (Monad (p x) => p x a) -> p x a
- replicateP :: forall p x a. (Profunctor p, ForallF Applicative p) => Int -> p x a -> p [x] [a]
- replicateP_ :: (Profunctor p, Applicative (p [x])) => Int -> p x a -> p [x] [a]
- manyP :: forall p x a. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p [x] [a]
- manyP_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p [x] [a]
- someP :: forall p x a. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p [x] [a]
- someP_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p [x] [a]
- sepByP :: forall p x a b. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a]
- sepByP_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a]
- sepBy1P :: forall p x a b. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a]
- sepBy1P_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a]
- preByP :: forall p x a b. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a]
- preByP_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a]

# Basic combinators

withApplicative :: ForallF Applicative p => (Applicative (p x) => p x a) -> p x a Source #

A specialization of `with'`

for `Applicative`

, to avoid `TypeApplications`

where this is possible.

### Usage

In some context with a constraint

available:`ForallF`

`Applicative`

p

`withApplicative`

`$`

(...)`<$>`

(...)`<*>`

(...)

withAlternative :: ForallF Alternative p => (Alternative (p x) => p x a) -> p x a Source #

A specialization of `with'`

for `Alternative`

, to avoid `TypeApplications`

where this is possible.

### Usage

In some context with a constraint

available:`ForallF`

`Alternative`

p

`withAlternative`

`$`

(...)`<|>`

(...)

replicateP :: forall p x a. (Profunctor p, ForallF Applicative p) => Int -> p x a -> p [x] [a] Source #

Bidirectional generalization of `replicateM`

.

replicateP_ :: (Profunctor p, Applicative (p [x])) => Int -> p x a -> p [x] [a] Source #

manyP :: forall p x a. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p [x] [a] Source #

manyP_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p [x] [a] Source #

someP :: forall p x a. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p [x] [a] Source #

someP_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p [x] [a] Source #

sepByP :: forall p x a b. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a] Source #

sepByP_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a] Source #

sepBy1P :: forall p x a b. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a] Source #

sepBy1P_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a] Source #

preByP :: forall p x a b. (Profunctor p, ForallF Alternative p) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a] Source #

preByP_ :: (Profunctor p, Alternative (p [x])) => (([x] -> Bool) -> p [x] ()) -> p x a -> p () b -> p [x] [a] Source #