hegg-0.4.0.0: Fast equality saturation in Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Equality.Graph.Lens

Description

Hand-rolled lenses on e-graphs and e-classes which come in quite handy, are heavily used in Graph, and are the only exported way of editing the structure of the e-graph. If you want to write some complex Analysis you'll probably need these.

Synopsis

Documentation

type Lens' s a = forall f. Functor f => (a -> f a) -> s -> f s Source #

A Lens' as defined in other lenses libraries

type Traversal s t a b = forall f. Applicative f => (a -> f b) -> s -> f t Source #

_class :: ClassId -> Lens' (EGraph a l) (EClass a l) Source #

Lens for the e-class with the given id in an e-graph

Calls error when the e-class doesn't exist

_memo :: Lens' (EGraph a l) (NodeMap l ClassId) Source #

Lens for the memo of e-nodes in an e-graph, that is, a mapping from e-nodes to the e-class they're represented in

_classes :: Traversal (EGraph a l) (EGraph b l) (EClass a l) (EClass b l) Source #

Traversal for the existing classes in an e-graph

_iclasses :: Traversal (EGraph a l) (EGraph b l) (ClassId, EClass a l) (EClass b l) Source #

Traversal for the existing classes in an e-graph

_data :: Lens' (EClass domain l) domain Source #

Lens for the Domain of an e-class

_parents :: Lens' (EClass a l) (SList (ClassId, ENode l)) Source #

Lens for the parent e-classes of an e-class

_nodes :: Lens' (EClass a l) (Set (ENode l)) Source #

Lens for the e-nodes in an e-class

(^.) :: s -> Lens' s a -> a infixl 8 Source #

Like view but with the arguments flipped

(.~) :: Lens' s a -> a -> s -> s infixr 4 Source #

Synonym for set

(%~) :: Lens' s a -> (a -> a) -> s -> s infixr 4 Source #

Synonym for over

view :: Lens' s a -> s -> a Source #

Applies a getter to a value

set :: Lens' s a -> a -> s -> s Source #

Applies a setter to a value

over :: Lens' s a -> (a -> a) -> s -> s Source #

Applies a function to the target

allOf :: Traversal s t a b -> (a -> Bool) -> s -> Bool Source #

Returns True if every target of a Traversable satisfies a predicate.