Skip to content

Prettify output of `copar debug print-functor`

The output of copar debug print-functor prints a nice representation of the parsed functor expression. While helpful, it could be less ugly.

Current Output

E.g the output of copar debug print-functor "D({f,n}xPX)"

is currently

Functor
  1
  (Distribution
     (Functor
        2
        (AbsorbingPolynomial
           (Polynomial
              (Sum
                 [ Product
                     [ Const (ExplicitSet [ "f" , "n" ])
                     , Identity (Absorbed (Powerset Variable))
                     ]
                 ])))))

It's nice to know where the "layers" in the functor expression are (i.e. every occurrence of Functor), it's also nice to see that AbsorbingPolynomial is used instead of Polynomial, but the internal details of AbsorbingPolynomial are obscuring the presentation.

Idea

Maybe something along the lines of:

D
└ {f, n}x (Absorbed P )
                     └ X

(not sure about the tree representation, maybe it needs to be graphical or a different sort of utf8-tree...)

Edited by Hans-Peter Deifel