New Proposal: EasyMacros

New Proposal: EasyMacros

Hello list,

I want to propose a new way of writing template-haskell macros.
It is based on the idea, that syntax like this:
do {
x <- getLine;
putStrLn x;
}
should be parsed into:
$( do
[ [| x <- getLine |]
, [| putStrLn x |]
] )
Then a function (do :: NonEmpty ExpQ -> ExpQ) will be called
and executed.

Re: New Proposal: EasyMacros

This strikes me as a more powerful form of RebindableSyntax, blazing new territory. (Existing RebindableSyntax never use Template Haskell.)

I assume you've emailed the Haskell Prime list because you wish this to be considered for inclusion in the next version of the standard. However, an extension this large would need to be vetted by implementation in a compiler (assumedly, GHC) before we can consider inclusion in a standard. If you wish to pursue this, I recommend generating a groundswell of interest from the community and writing a more formal proposal detailing exactly how such macros should be desugared into Template Haskell. You give an example below, and that is helpful, but we would need a more formal description.

This is, certainly, an interesting idea and would allow for yet more flexible extensions to the language, all without changing the compiler.

Re: New Proposal: EasyMacros

Eek. Just realized that this went unanswered! Sorry!

Yes, a good next step is to email the Haskell-cafe list or to post on reddit.com/r/haskell. For the wiki page, I meant at the GHC developers' wiki, here: https://ghc.haskell.org/trac/ghc But it might be best to get feedback first.