| Copyright | (c) Håkon Robbestad Gylterud Year |
|---|---|
| License | BSD-3-Clause |
| Maintainer | lyesveasp@openbastille.org |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Control.Applicative.Logic
Description
This library contains a generalisation of local functions such as "any" and "all" to Applicative and Alternative functors.
Synopsis
- any :: (Alternative f, Foldable t) => (a -> f b) -> t a -> f b
- or :: (Alternative f, Foldable t) => t (f a) -> f a
- all :: (Applicative f, Monoid b, Foldable t) => (a -> f b) -> t a -> f b
- and :: (Applicative f, Monoid a, Foldable t) => t (f a) -> f a
- (&&) :: (Applicative f, Monoid a) => f a -> f a -> f a
- convert :: (Alternative f, Foldable t) => t a -> f a
- class Foldable t => Searchable t
- search :: (Searchable t, Alternative f, Monoid b) => (a -> f b) -> t a -> f b
Documentation
any :: (Alternative f, Foldable t) => (a -> f b) -> t a -> f b Source #
Generalized version of any. It takes a predicate that returns
generalised truth values in an Alternative functor and applies it disjunctively to
a foldable structure. I.e. it applies the predicate and folds with |.
or :: (Alternative f, Foldable t) => t (f a) -> f a Source #
Generalized version of the boolean or to foldable structures of Alternative functorial values.
It combines the elements using the alternative choice operator (<|>).
and :: (Applicative f, Monoid a, Foldable t) => t (f a) -> f a Source #
Generalized version of the boolean and to foldable structures of
Applicative functor applied to monoids. It combines the elements using the
monoidal concatenation (<>).
(&&) :: (Applicative f, Monoid a) => f a -> f a -> f a Source #
Generalized version of the boolean && operator for Applicative functors applied to monoids.
It sequences and combines two applicative values using the monoidal operation (<>).
convert :: (Alternative f, Foldable t) => t a -> f a Source #
Converts a foldable structure into an Alternative functor, where each element is lifted into the
functor using pure and then combined using the alternative choice operator (<|>).
class Foldable t => Searchable t Source #
Searchable class represents structures that can be searched using a predicate.
An instance may use all or any to iterate over parts of its structure depending
on wether the substrcutres are conjunctive or disjunctive.
Minimal complete definition
Instances
| Searchable Maybe Source # |
|
Defined in Control.Applicative.Logic | |
search :: (Searchable t, Alternative f, Monoid b) => (a -> f b) -> t a -> f b Source #
Search a structure using a predicate