distributors-0.3.0.0: Unifying Parsers, Printers & Grammars
Copyright(C) 2026 - Eitan Chatav
LicenseBSD-style (see the file LICENSE)
MaintainerEitan Chatav <eitan.chatav@gmail.com>
Stabilityprovisional
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Lens.Grammar.Boole

Description

See Boole, The Mathematical Analysis of Logic. Categorized token classes form a Boolean algebra.

Synopsis

BooleanAlgebra

class BooleanAlgebra b where Source #

A BooleanAlgebra, like Bool, supporting classical logical operations.

Minimal complete definition

Nothing

Methods

(>&&<) :: b -> b -> b Source #

conjunction

default (>&&<) :: (b ~ f bool, BooleanAlgebra bool, Applicative f) => b -> b -> b Source #

(>||<) :: b -> b -> b Source #

disjunction

default (>||<) :: (b ~ f bool, BooleanAlgebra bool, Applicative f) => b -> b -> b Source #

notB :: b -> b Source #

negation

default notB :: (b ~ f bool, BooleanAlgebra bool, Functor f) => b -> b Source #

fromBool :: Bool -> b Source #

inclusion

default fromBool :: (b ~ f bool, BooleanAlgebra bool, Applicative f) => Bool -> b Source #

Instances

Instances details
BooleanAlgebra Bool Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Categorized token => BooleanAlgebra (TokenTest token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

(>&&<) :: TokenTest token -> TokenTest token -> TokenTest token Source #

(>||<) :: TokenTest token -> TokenTest token -> TokenTest token Source #

notB :: TokenTest token -> TokenTest token Source #

fromBool :: Bool -> TokenTest token Source #

Categorized token => BooleanAlgebra (RegExam token (TokenTest token)) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

(>&&<) :: RegExam token (TokenTest token) -> RegExam token (TokenTest token) -> RegExam token (TokenTest token) Source #

(>||<) :: RegExam token (TokenTest token) -> RegExam token (TokenTest token) -> RegExam token (TokenTest token) Source #

notB :: RegExam token (TokenTest token) -> RegExam token (TokenTest token) Source #

fromBool :: Bool -> RegExam token (TokenTest token) Source #

BooleanAlgebra (x -> Bool) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

(>&&<) :: (x -> Bool) -> (x -> Bool) -> x -> Bool Source #

(>||<) :: (x -> Bool) -> (x -> Bool) -> x -> Bool Source #

notB :: (x -> Bool) -> x -> Bool Source #

fromBool :: Bool -> x -> Bool Source #

(Applicative f, BooleanAlgebra bool) => BooleanAlgebra (Ap f bool) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

(>&&<) :: Ap f bool -> Ap f bool -> Ap f bool Source #

(>||<) :: Ap f bool -> Ap f bool -> Ap f bool Source #

notB :: Ap f bool -> Ap f bool Source #

fromBool :: Bool -> Ap f bool Source #

andB :: (Foldable f, BooleanAlgebra b) => f b -> b Source #

cumulative conjunction

orB :: (Foldable f, BooleanAlgebra b) => f b -> b Source #

cumulative disjunction

allB :: (Foldable f, BooleanAlgebra b) => (a -> b) -> f a -> b Source #

universal

anyB :: (Foldable f, BooleanAlgebra b) => (a -> b) -> f a -> b Source #

existential

TokenAlgebra

class Tokenized token p => TokenAlgebra token p where Source #

TokenAlgebra extends Tokenized methods to support BooleanAlgebra operations in a tokenClass

Minimal complete definition

Nothing

Methods

tokenClass :: TokenTest token -> p Source #

Arguments of tokenClass can be constructed from Tokenized and BooleanAlgebra methods.

default tokenClass :: (p ~ q token token, Alternator q, Cochoice q) => TokenTest token -> p Source #

Instances

Instances details
TokenAlgebra Char RegBnf Source # 
Instance details

Defined in Control.Lens.Grammar

TokenAlgebra Char RegString Source # 
Instance details

Defined in Control.Lens.Grammar

(Ord rule, TokenAlgebra token rule) => TokenAlgebra token (Bnf rule) Source # 
Instance details

Defined in Control.Lens.Grammar.BackusNaur

Methods

tokenClass :: TokenTest token -> Bnf rule Source #

Categorized token => TokenAlgebra token (RegEx token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

tokenClass :: TokenTest token -> RegEx token Source #

Categorized token => TokenAlgebra token (token -> Bool) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

tokenClass :: TokenTest token -> token -> Bool Source #

TokenAlgebra a k => TokenAlgebra a (Grammor k a b) Source # 
Instance details

Defined in Data.Profunctor.Grammar

Methods

tokenClass :: TokenTest a -> Grammor k a b Source #

(Categorized a, a ~ Item s, IsList s, Cons s s a a, Snoc s s a a, Filterable m, Alternative m, Monad m) => TokenAlgebra a (Parsor s m a a) Source # 
Instance details

Defined in Data.Profunctor.Grammar

Methods

tokenClass :: TokenTest a -> Parsor s m a a Source #

(Categorized a, a ~ Item s, IsList s, Cons s s a a, Filterable m, Alternative m, Monad m) => TokenAlgebra a (Printor s m a a) Source # 
Instance details

Defined in Data.Profunctor.Grammar

Methods

tokenClass :: TokenTest a -> Printor s m a a Source #

newtype TokenTest token Source #

Constructors

TokenTest (RegExam token (TokenTest token)) 

Instances

Instances details
Categorized token => Tokenized token (TokenTest token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

anyToken :: TokenTest token Source #

token :: token -> TokenTest token Source #

oneOf :: Foldable f => f token -> TokenTest token Source #

notOneOf :: Foldable f => f token -> TokenTest token Source #

asIn :: Categorize token -> TokenTest token Source #

notAsIn :: Categorize token -> TokenTest token Source #

Generic (TokenTest token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Associated Types

type Rep (TokenTest token) :: Type -> Type #

Methods

from :: TokenTest token -> Rep (TokenTest token) x #

to :: Rep (TokenTest token) x -> TokenTest token #

(Categorized token, Read token, Read (Categorize token)) => Read (TokenTest token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

(Categorized token, Show token, Show (Categorize token)) => Show (TokenTest token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

showsPrec :: Int -> TokenTest token -> ShowS #

show :: TokenTest token -> String #

showList :: [TokenTest token] -> ShowS #

Categorized token => BooleanAlgebra (TokenTest token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

(>&&<) :: TokenTest token -> TokenTest token -> TokenTest token Source #

(>||<) :: TokenTest token -> TokenTest token -> TokenTest token Source #

notB :: TokenTest token -> TokenTest token Source #

fromBool :: Bool -> TokenTest token Source #

Categorized token => Eq (TokenTest token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

(==) :: TokenTest token -> TokenTest token -> Bool #

(/=) :: TokenTest token -> TokenTest token -> Bool #

Categorized token => Ord (TokenTest token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

compare :: TokenTest token -> TokenTest token -> Ordering #

(<) :: TokenTest token -> TokenTest token -> Bool #

(<=) :: TokenTest token -> TokenTest token -> Bool #

(>) :: TokenTest token -> TokenTest token -> Bool #

(>=) :: TokenTest token -> TokenTest token -> Bool #

max :: TokenTest token -> TokenTest token -> TokenTest token #

min :: TokenTest token -> TokenTest token -> TokenTest token #

Categorized token => BooleanAlgebra (RegExam token (TokenTest token)) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

Methods

(>&&<) :: RegExam token (TokenTest token) -> RegExam token (TokenTest token) -> RegExam token (TokenTest token) Source #

(>||<) :: RegExam token (TokenTest token) -> RegExam token (TokenTest token) -> RegExam token (TokenTest token) Source #

notB :: RegExam token (TokenTest token) -> RegExam token (TokenTest token) Source #

fromBool :: Bool -> RegExam token (TokenTest token) Source #

type Rep (TokenTest token) Source # 
Instance details

Defined in Control.Lens.Grammar.Boole

type Rep (TokenTest token) = D1 ('MetaData "TokenTest" "Control.Lens.Grammar.Boole" "distributors-0.3.0.0-inplace" 'True) (C1 ('MetaCons "TokenTest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RegExam token (TokenTest token)))))