Likewise, I’d really like to able to create instances of Functor, Foldable, Traversable, etc. for the Declaration type, which seems to necessitate another type parameter. Threading that through may be a huge pain in the ass, though.
@jspahrsummers There is no one answer to this question. It depends how you use the attributes. Eg, what is their lifetime? Short? Then, a separate Map may be a good idea. Similar to the lifetime of the AST? Probably best to make them fields in AST nodes.
@jspahrsummers Another option is to define a “pre” type, which has recursive occurrences replaced by a type parameter and to tie that with varying knots. We use that in Accelerate: http://bit.ly/13YWbek (PreAcc is the open AST type.)
@tacticalgrace I wanted to avoid type parameters on _everything_ in a Declaration, but I don’t know why I thought that might be needed in the first place. Besides that, it seemed like a little bit of a hack.
@jspahrsummers The separation of nodes/leaves is an orthogonal aspect. The advantage of the functorial notation is that you can extend the data type with both attributes and new AST nodes. Very flexible. + @maxpow4h
@co_dan@maxpow4h Yeah, I just liked the split of nodes and leaves, though @tacticalgrace has correctly pointed out that aspect is orthogonal to the issue of adding a type variable/using a recursive functor.