ecta-1.0.0.3
Safe HaskellNone
LanguageHaskell2010

Data.ECTA.Internal.ECTA.Enumeration

Synopsis

Documentation

firstExpandableUVar :: EnumerateM ExpandableUVarResult Source #

naiveDenotation :: Node -> [Term] Source #

Inefficient enumeration

For ECTAs with Mu nodes may produce an infinite list or may loop indefinitely, depending on the ECTAs. For example, for

createMu $ \r -> Node [Edge "f" [r], Edge "a" []]

it will produce

[ Term "a" []
, Term "f" [Term "a" []]
, Term "f" [Term "f" [Term "a" []]]
, ...
]

This happens to work currently because non-recursive edges are interned before recursive edges.

TODO: It would be much nicer if this did fair enumeration. It would avoid the beforementioned dependency on interning order, and it would give better enumeration for examples such as

Node [Edge "h" [
    createMu $ \r -> Node [Edge "f" [r], Edge "a" []]
  , createMu $ \r -> Node [Edge "g" [r], Edge "b" []]
  ]]

This will currently produce

[ Term "h" [Term "a" [], Term "b" []]
, Term "h" [Term "a" [], Term "g" [Term "b" []]]
, Term "h" [Term "a" [], Term "g" [Term "g" [Term "b" []]]]
, ..
]

where it always unfolds the second argument to h, never the first.