Hello everyone!
My question is: is there a way in Haskell to implement transparent syntax extensions from inside the language?
What I mean is I’d like to be able to (somehow) define a new syntax object of arbitrary form (with some kind of a macro, or smth), and transparently use it later in code, without messing with the compiler.
I know about quotations from Template Haskell which allow for arbitrary syntax inside via manual parsing of their contents, but core difference from what I want to achieve is that you must use these quotation around this code, so it visually stands out from the code around it.
AND if I want to extend syntax from some quotations OR reuse some of the definitions from them, I have to have access to their guts (parsing functions must be available from my code), which is also a strong downside of this solution which I’d like to avoid.
I believe there could be some mechanism for what I want, similar to syntax-case from Scheme, or syntax-parse from Racket (both of which are actually not powerful enough too, but you could get the idea), but couldn’t find anything on the internet.
Any help would be appreciated!