kleene-0: Kleene algebra

Safe HaskellTrustworthy
LanguageHaskell2010

Kleene.Equiv

Synopsis

Documentation

newtype Equiv r c Source #

Regular-expressions for which == is equivalent.

>>> let re1 = star "a" <> "a" :: RE Char
>>> let re2 = "a" <> star "a" :: RE Char
>>> re1 == re2
False
>>> Equiv re1 == Equiv re2
True

Equiv is also a PartialOrd (but not Ord!)

>>> Equiv "a" `leq` Equiv (star "a" :: RE Char)
True

Not all regular expessions are comparable:

>>> let reA = Equiv "a" :: Equiv RE Char
>>> let reB = Equiv "b" :: Equiv RE Char
>>> (leq reA reB, leq reB reA)
(False,False)

Constructors

Equiv (r c) 

Instances

Complement c (r c) => Complement c (Equiv r c) Source # 

Methods

complement :: Equiv r c -> Equiv r c Source #

Equivalent c (r c) => Equivalent c (Equiv r c) Source # 

Methods

equivalent :: Equiv r c -> Equiv r c -> Bool Source #

Match c (r c) => Match c (Equiv r c) Source # 

Methods

match :: Equiv r c -> [c] -> Bool Source #

Derivate c (r c) => Derivate c (Equiv r c) Source # 

Methods

nullable :: Equiv r c -> Bool Source #

derivate :: c -> Equiv r c -> Equiv r c Source #

Kleene c (r c) => Kleene c (Equiv r c) Source # 

Methods

empty :: Equiv r c Source #

eps :: Equiv r c Source #

char :: c -> Equiv r c Source #

appends :: [Equiv r c] -> Equiv r c Source #

unions :: [Equiv r c] -> Equiv r c Source #

star :: Equiv r c -> Equiv r c Source #

Equivalent c (r c) => Eq (Equiv r c) Source # 

Methods

(==) :: Equiv r c -> Equiv r c -> Bool #

(/=) :: Equiv r c -> Equiv r c -> Bool #

Show (r c) => Show (Equiv r c) Source # 

Methods

showsPrec :: Int -> Equiv r c -> ShowS #

show :: Equiv r c -> String #

showList :: [Equiv r c] -> ShowS #

Semigroup (r c) => Semigroup (Equiv r c) Source # 

Methods

(<>) :: Equiv r c -> Equiv r c -> Equiv r c #

sconcat :: NonEmpty (Equiv r c) -> Equiv r c #

stimes :: Integral b => b -> Equiv r c -> Equiv r c #

Monoid (r c) => Monoid (Equiv r c) Source # 

Methods

mempty :: Equiv r c #

mappend :: Equiv r c -> Equiv r c -> Equiv r c #

mconcat :: [Equiv r c] -> Equiv r c #

JoinSemiLattice (r c) => JoinSemiLattice (Equiv r c) Source # 

Methods

(\/) :: Equiv r c -> Equiv r c -> Equiv r c #

join :: Equiv r c -> Equiv r c -> Equiv r c #

BoundedJoinSemiLattice (r c) => BoundedJoinSemiLattice (Equiv r c) Source # 

Methods

bottom :: Equiv r c #

(JoinSemiLattice (r c), Equivalent c (r c)) => PartialOrd (Equiv r c) Source #

\(a \preceq b := a \lor b = b \)

Methods

leq :: Equiv r c -> Equiv r c -> Bool #

comparable :: Equiv r c -> Equiv r c -> Bool #

Pretty (r c) => Pretty (Equiv r c) Source # 

Methods

pretty :: Equiv r c -> String Source #

prettyS :: Equiv r c -> ShowS Source #

>>> import Kleene.RE (RE)