overeasy-0.2.0: A purely functional E-Graph library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Overeasy.Example

Description

An example using arithmetic expressions.

Synopsis

Documentation

data Arith Source #

Arithmetic expressions. ArithF is the base functor for this type.

Instances

Instances details
Generic Arith Source # 
Instance details

Defined in Overeasy.Example

Associated Types

type Rep Arith :: Type -> Type #

Methods

from :: Arith -> Rep Arith x #

to :: Rep Arith x -> Arith #

Show Arith Source # 
Instance details

Defined in Overeasy.Example

Methods

showsPrec :: Int -> Arith -> ShowS #

show :: Arith -> String #

showList :: [Arith] -> ShowS #

NFData Arith Source # 
Instance details

Defined in Overeasy.Example

Methods

rnf :: Arith -> () #

Eq Arith Source # 
Instance details

Defined in Overeasy.Example

Methods

(==) :: Arith -> Arith -> Bool #

(/=) :: Arith -> Arith -> Bool #

Hashable Arith Source # 
Instance details

Defined in Overeasy.Example

Methods

hashWithSalt :: Int -> Arith -> Int #

hash :: Arith -> Int #

Corecursive Arith Source # 
Instance details

Defined in Overeasy.Example

Methods

embed :: Base Arith Arith -> Arith #

ana :: (a -> Base Arith a) -> a -> Arith #

apo :: (a -> Base Arith (Either Arith a)) -> a -> Arith #

postpro :: Recursive Arith => (forall b. Base Arith b -> Base Arith b) -> (a -> Base Arith a) -> a -> Arith #

gpostpro :: (Recursive Arith, Monad m) => (forall b. m (Base Arith b) -> Base Arith (m b)) -> (forall c. Base Arith c -> Base Arith c) -> (a -> Base Arith (m a)) -> a -> Arith #

Recursive Arith Source # 
Instance details

Defined in Overeasy.Example

Methods

project :: Arith -> Base Arith Arith #

cata :: (Base Arith a -> a) -> Arith -> a #

para :: (Base Arith (Arith, a) -> a) -> Arith -> a #

gpara :: (Corecursive Arith, Comonad w) => (forall b. Base Arith (w b) -> w (Base Arith b)) -> (Base Arith (EnvT Arith w a) -> a) -> Arith -> a #

prepro :: Corecursive Arith => (forall b. Base Arith b -> Base Arith b) -> (Base Arith a -> a) -> Arith -> a #

gprepro :: (Corecursive Arith, Comonad w) => (forall b. Base Arith (w b) -> w (Base Arith b)) -> (forall c. Base Arith c -> Base Arith c) -> (Base Arith (w a) -> a) -> Arith -> a #

type Rep Arith Source # 
Instance details

Defined in Overeasy.Example

type Base Arith Source # 
Instance details

Defined in Overeasy.Example

data ArithF r Source #

Instances

Instances details
Foldable ArithF Source # 
Instance details

Defined in Overeasy.Example

Methods

fold :: Monoid m => ArithF m -> m #

foldMap :: Monoid m => (a -> m) -> ArithF a -> m #

foldMap' :: Monoid m => (a -> m) -> ArithF a -> m #

foldr :: (a -> b -> b) -> b -> ArithF a -> b #

foldr' :: (a -> b -> b) -> b -> ArithF a -> b #

foldl :: (b -> a -> b) -> b -> ArithF a -> b #

foldl' :: (b -> a -> b) -> b -> ArithF a -> b #

foldr1 :: (a -> a -> a) -> ArithF a -> a #

foldl1 :: (a -> a -> a) -> ArithF a -> a #

toList :: ArithF a -> [a] #

null :: ArithF a -> Bool #

length :: ArithF a -> Int #

elem :: Eq a => a -> ArithF a -> Bool #

maximum :: Ord a => ArithF a -> a #

minimum :: Ord a => ArithF a -> a #

sum :: Num a => ArithF a -> a #

product :: Num a => ArithF a -> a #

Traversable ArithF Source # 
Instance details

Defined in Overeasy.Example

Methods

traverse :: Applicative f => (a -> f b) -> ArithF a -> f (ArithF b) #

sequenceA :: Applicative f => ArithF (f a) -> f (ArithF a) #

mapM :: Monad m => (a -> m b) -> ArithF a -> m (ArithF b) #

sequence :: Monad m => ArithF (m a) -> m (ArithF a) #

Functor ArithF Source # 
Instance details

Defined in Overeasy.Example

Methods

fmap :: (a -> b) -> ArithF a -> ArithF b #

(<$) :: a -> ArithF b -> ArithF a #

Generic (ArithF a) Source # 
Instance details

Defined in Overeasy.Example

Associated Types

type Rep (ArithF a) :: Type -> Type #

Methods

from :: ArithF a -> Rep (ArithF a) x #

to :: Rep (ArithF a) x -> ArithF a #

Show a => Show (ArithF a) Source # 
Instance details

Defined in Overeasy.Example

Methods

showsPrec :: Int -> ArithF a -> ShowS #

show :: ArithF a -> String #

showList :: [ArithF a] -> ShowS #

NFData a => NFData (ArithF a) Source # 
Instance details

Defined in Overeasy.Example

Methods

rnf :: ArithF a -> () #

Eq a => Eq (ArithF a) Source # 
Instance details

Defined in Overeasy.Example

Methods

(==) :: ArithF a -> ArithF a -> Bool #

(/=) :: ArithF a -> ArithF a -> Bool #

Hashable a => Hashable (ArithF a) Source # 
Instance details

Defined in Overeasy.Example

Methods

hashWithSalt :: Int -> ArithF a -> Int #

hash :: ArithF a -> Int #

type Rep (ArithF a) Source # 
Instance details

Defined in Overeasy.Example

exampleGraph :: EGraph () ArithF Source #

Creates a simple e-graph with the equality `2 + 2 = 4`.

examplePat :: Pat ArithF String Source #

Creates a simple pattern to match nodes like `x + x`.

exampleMain :: IO () Source #

Build an e-graph, e-match on it, and print the result.