[<<][haskell][>>][..]
Sat Jun 2 09:44:13 EDT 2018

Tagged s-expressions

Let's recap:

- Use of Free monad allows focus on the Functor, using combinators for
  iteration.

- Parsec makes parsing straightforward to produce the Free data
  structure.  Currently still using explict recursion, but probably
  possible to avoid using unfold.

- Functor with tag node, allows construction of paths and monadic
  iteration of paths in a Reader environment.

- List all paths matchin a certain parent path


The remaining problem is that paths are not unique in this specific
case.  How to make them unique?


Maybe uniqueness is not necessary if I can just "overwrite" the
last unique structure.  E.g. create something similar to a stack
trace.

[Net,Atom "SPI0_SCLK"]
[Net,Joined]
[Net,Joined,PortRef]
[Net,Joined,PortRef,Atom "A23"]
[Net,Joined,PortRef,InstanceRef]
[Net,Joined,PortRef,InstanceRef,Atom "U8"]
[Net,Joined,PortRef,InstanceRef]
[Net,Joined,PortRef]
[Net,Joined,PortRef]
[Net,Joined,PortRef,Atom "&16"]
[Net,Joined,PortRef,InstanceRef]
[Net,Joined,PortRef,InstanceRef,Atom "U9"]
[Net,Joined,PortRef,InstanceRef]
[Net,Joined,PortRef]

E.g. at [Net,Joined,PortRef,Atom "A23"], the last [Net,Atom
"SPI0_SCLK"] node should be available.

Really this is just a structural problem.  Essentially, the
information should be right there in the path, but instead we need to
go up, then down a bit.

It seems hacky to do it like that.  Better to make paths unique so
they can be used as keys.


Ok, generalize:

- Keep a state monad to make keys unique.
- The output is the map of paths to values, or the set of paths.

Is it necessary to preserve order?

It doesn't seem so.  The result is a relation.

So this is a generic tree -> relation(s) transformation.




[Reply][About]
[<<][haskell][>>][..]