简体   繁体   中英

Purescript inside Haskell code

I want to use a PureScript in the program code to generate text of JavaScript from it. For example, I use Julius (from Yesod) to directly insert a javascript. I want to use the same PureScript .Maybe there are such solutions or libraries? Thank you!

When I have done something similar, I've kept the Purescript source in separate files, and combined the Haskell & Purescript parts later (during the build or at runtime). I think this is the easiest way, and you can keep using existing Purescript tools.

I had my web server read the JS output from purs at runtime. Another option would be to use file-embed to include the JS text when compiling the Haskell code. One reason to prefer file-embed is if you need to have a single executable file to deploy.

Finally, I have a Makefile that builds the Purescript code, then the Haskell code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM