The Fay compiler is a simple way to build fairly comprehensible javascript code from Haskell source.

It occurs to me that it should be rather easy to modify Fay to emit perl code rather than javascript. This would allow contributing things like plugins to various perl programs, without writing perl.

Of course, the same idea could probably be used to compile Haskell to other languages like python, but perl seems particularly well suited as a second Fay target, since javascript and it have quite similar syntax and similar support for features like closures which Fay relies on.

I do not have time to work on this idea myself. It would be a good project for a beginning Haskell programmer. You probably don't even need to fully understand monads to do it! Essentially, look at Fay output examples, translate them from javascript to perl, and then much of the code changes in Fay would probably be in simple string generation code.

I will forward any bitcoins sent to the address 149eBtWS6i8cwQdPQJJ8hAGpDuEqNidyTj to whoever makes this. If it doesn't happen in 1 year, any donations will be forwarded to the EFF instead.

comment 1
It's funny you should write this today, as only two days again I was talking to one of the Fay authors about how difficult it might be to generate Emacs Lisp from Fay.
Comment by John
comment 2

Cool idea! I'd be happy to help if anyone wants to do this for elisp or perl (i use emacs, so elisp sounds awesome). I think this would work best as a separate package for maintenance purposes but I'd help out with making the changes needed in Fay to get that working.

It should be a matter of replacing the custom JS AST we're using for a perl AST and then generating code for that. Or maybe it could even use the JS AST and just print it differently? I forgot all my perl so I'm not sure if everything we're using can be translated on the printing level.

Comment by Adam