applicative-logic-0.1.0.2: Generalized logic operations for Applicative and Alternative functors
Copyright(c) Håkon Robbestad Gylterud Year
LicenseBSD-3-Clause
Maintainerlyesveasp@openbastille.org
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Applicative.Logic

Description

This library contains a generalisation of local functions such as "any" and "all" to Applicative and Alternative functors.

Synopsis

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 (<|>).

all :: (Applicative f, Monoid b, Foldable t) => (a -> f b) -> t a -> f b Source #

Generalized version of all. It takes a predicate that gives generalized truth values in an Applicative functor on a Monoid and applies it conjunctively to a foldable structure. I.e. it applies the predicate and folds with an applicative lifting of monoidal concatenation (<>).

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

search

Instances

Instances details
Searchable Maybe Source #

Maybe instance of Searchable.

Instance details

Defined in Control.Applicative.Logic

Methods

search :: (Alternative f, Monoid b) => (a -> f b) -> Maybe a -> f b Source #

search :: (Searchable t, Alternative f, Monoid b) => (a -> f b) -> t a -> f b Source #

Search a structure using a predicate