Purescript-codegen org

I’m not sure if it is not to early to announce this thing but I want to ask some questions and… invite any interested PureScripters to this open project!

This idea was initiated by some discussion under purescript-react-basic-mui codegen thread and some questions related to purescript-read-dts. During discussion we (@jvliwanag, @flip101 and me) have decided to extract some pieces and libs to create some free space for the experimentation but also to build some fully working libs related to PS codegen in PS :slightly_smiling_face:

My first question is related to recursion schemes and AST representation.

Currently our AST (which was just extracted from mui codegen) for PS codegen is written using matryoshka. It contains mutually recursive RowF and TypeF but we are able to handle this “somehow” so we can fold Mu TypeF nicely. This representation seems to work fine in the context of algebras for printing, imports collecting etc. Additionally we don’t plan to implement any formatting / pretty printing because we want to use purty.

It seems that in the PS compiler similar structures are represented and folded without the help of recursion schemes.
Could you please write your opinion why and when do you think it is beneficial to use recursion schemes and if you think that AST for PS codegen is a good place to use it?

2 Likes