How to work with corefn? How to generate JS from it?

justinw [1 day ago]
is there an obvious link for where to work with corefn

paulyoung [10 hours ago]
@justinw @gabejohnson @chexxor my purescript-corefn or pureswift projects might be of some help but it’s only what I’ve figured out and/or reverse engineered.

The JSON format is different between 0.11.7 and 0.12

There was a suggestion to change the format to use records instead of arrays but that’s not happened AFAIK

paulyoung [10 hours ago]

i mean like just going from corefn json to JS output

That’s https://github.com/purescript/purescript/blob/v0.12.0/src/Language/PureScript/CoreFn/FromJSON.hs#L110
then https://github.com/purescript/purescript/blob/v0.12.0/src/Language/PureScript/CodeGen/JS.hs#L53

paulyoung [10 hours ago]
purescript-corefn is a port of the former, pureswift (still WIP) is similar to the latter

justinw [10 hours ago]
hm, is this exposed at all in purs_
module from json and module to js (edited)

paulyoung [9 hours ago]
If you mean purs the command line tool, I don’t think so

justinw [9 hours ago]
hmm, i guess maybe i should just wrap it in a small thing

paulyoung [9 hours ago]
Actually, I think some flags were added about the JS output but I don’t think it’s exactly what you need

paulyoung [9 hours ago]

justinw [9 hours ago]
right, that’s just about being able to specify sourcemaps output right?

paulyoung [9 hours ago]
I think you can basically ask for JSON or JS (e.g. for PureSwift I only want JSON and never JS) but there’s nothing to say JSON -> JS

3 Likes