Safe Haskell | None |
---|

Internal representation of automata nodes.

- type ID = Int
- type Sym = Int
- data Node a b
- onSym :: Unbox b => Sym -> Node a b -> Maybe b
- trans :: Unbox b => Node a b -> [(Sym, b)]
- edges :: Unbox b => Node a b -> [b]
- subst :: Unbox b => Sym -> b -> Node a b -> Node a b
- toGeneric :: Node a -> Node a (Edge ())
- type Edge a = (ID, a)
- to :: Edge a -> ID
- label :: Edge a -> a
- annotate :: a -> Edge b -> Edge a
- labeled :: a -> ID -> Edge a

# Basic types

# Node

Two nodes (states) belong to the same equivalence class (and, consequently, they must be represented as one node in the graph) iff they are equal with respect to their values and outgoing edges.

Since `Leaf`

nodes are distinguished from `Branch`

nodes, two values
equal with respect to `==`

function are always kept in one `Leaf`

node in the graph. It doesn't change the fact that to all `Branch`

nodes one value is assigned through the epsilon transition.

Invariant: the `eps`

identifier always points to the `Leaf`

node.
Edges in the `edgeMap`

, on the other hand, point to `Branch`

nodes.

subst :: Unbox b => Sym -> b -> Node a b -> Node a bSource

Substitue edge determined by a given symbol.