I’m experimenting with a monadic visual functional programming language in Haskell. Instead of writing my own type checker, I’d like to use PureScript’s type checker as a library. It has all features I need, especially row polymorphism. My idea is to do something like this:
- Preload some PureScript modules.
- Let an end user create or modify a program, represented internally using my own AST.
- Convert this internal AST to PureScript’s AST as my “main module”.
- Run PureScript’s type checker to get errors out, show them to the end user.
- Loop over (2) to (4).
Do you think this is feasible? I could use some pointers in the code which functions to use. I.e.
TypeChecker.typeCheckModuleclearly type checks a module. But how to run monad
mto get all errors and warnings?
- How to keep the preloaded modules in memory and only recheck my generated AST? Could/Should I use the IDE functionality to preload and reload modules? The IDE interface suggests it only works with file names, not ASTs.
- How to parse simple expressions like “sin pi * 4” into PureScript’s AST?
An alternative would be to generate PureScript source files and use the IDE as a library, or run
purs in IDE mode, listening to JSON output. More ideas are welcome!