Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- type Lens' s a = forall (f :: Type -> Type). Functor f => (a -> f a) -> s -> f s
- type Lens s t a b = forall (f :: Type -> Type). Functor f => (a -> f b) -> s -> f t
- type Traversal s t a b = forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t
- _class :: forall a (l :: Type -> Type). ClassId -> Lens' (EGraph a l) (EClass a l)
- _memo :: forall a (l :: Type -> Type) f. Functor f => (NodeMap l ClassId -> f (NodeMap l ClassId)) -> EGraph a l -> f (EGraph a l)
- _classes :: forall a (l :: Type -> Type) b f. Applicative f => (EClass a l -> f (EClass b l)) -> EGraph a l -> f (EGraph b l)
- _iclasses :: forall a (l :: Type -> Type) b f. Applicative f => ((ClassId, EClass a l) -> f (EClass b l)) -> EGraph a l -> f (EGraph b l)
- _data :: forall domain (l :: Type -> Type) domain' f. Functor f => (domain -> f domain') -> EClass domain l -> f (EClass domain' l)
- _parents :: forall a (l :: Type -> Type) f. Functor f => (SList (ClassId, ENode l) -> f (SList (ClassId, ENode l))) -> EClass a l -> f (EClass a l)
- _nodes :: forall a (l :: Type -> Type) f. Functor f => (Set (ENode l) -> f (Set (ENode l))) -> EClass a l -> f (EClass a l)
- (^.) :: s -> Lens' s a -> a
- (.~) :: Lens' s a -> a -> s -> s
- (%~) :: ASetter s t a b -> (a -> b) -> s -> t
- view :: Lens' s a -> s -> a
- set :: Lens' s a -> a -> s -> s
- over :: ASetter s t a b -> (a -> b) -> s -> t
- traverseOf :: Traversal s t a b -> forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t
- allOf :: Traversal s t a b -> (a -> Bool) -> s -> Bool
- type ASetter s t a b = (a -> Identity b) -> s -> Identity t
Documentation
type Lens' s a = forall (f :: Type -> Type). Functor f => (a -> f a) -> s -> f s Source #
A Lens'
as defined in lens
type Lens s t a b = forall (f :: Type -> Type). Functor f => (a -> f b) -> s -> f t Source #
A Lens
as defined in lens
type Traversal s t a b = forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t Source #
A Traversal
as defined in lens
_class :: forall a (l :: Type -> Type). ClassId -> Lens' (EGraph a l) (EClass a l) Source #
Lens for the e-class at the representative of the given id in an e-graph
Calls error
when the e-class doesn't exist
_memo :: forall a (l :: Type -> Type) f. Functor f => (NodeMap l ClassId -> f (NodeMap l ClassId)) -> EGraph a l -> f (EGraph a l) 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 :: forall a (l :: Type -> Type) b f. Applicative f => (EClass a l -> f (EClass b l)) -> EGraph a l -> f (EGraph b l) Source #
Traversal for the existing classes in an e-graph
_iclasses :: forall a (l :: Type -> Type) b f. Applicative f => ((ClassId, EClass a l) -> f (EClass b l)) -> EGraph a l -> f (EGraph b l) Source #
Traversal for the existing classes in an e-graph
_data :: forall domain (l :: Type -> Type) domain' f. Functor f => (domain -> f domain') -> EClass domain l -> f (EClass domain' l) Source #
Lens for the Domain
of an e-class
_parents :: forall a (l :: Type -> Type) f. Functor f => (SList (ClassId, ENode l) -> f (SList (ClassId, ENode l))) -> EClass a l -> f (EClass a l) Source #
Lens for the parent e-classes of an e-class
_nodes :: forall a (l :: Type -> Type) f. Functor f => (Set (ENode l) -> f (Set (ENode l))) -> EClass a l -> f (EClass a l) Source #
Lens for the e-nodes in an e-class
traverseOf :: Traversal s t a b -> forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t Source #
allOf :: Traversal s t a b -> (a -> Bool) -> s -> Bool Source #
Returns True if every target of a Traversable satisfies a predicate.