Some might remember I'm attempting to transpile-PureScript-without-forking-purs. Irrelevant side-bar:
First attempt was to do so via --dump-coreimp (#3117) however I've actually given up on that approach (ditch that PR if you like!) and now prefer to work with the existing --dump-corefn. (With the former I would have gotten some of purs later Optimizer passes "for free", but I decided against re-processing and transforming an-IR-that-is-essentially-JS --- too fickle/messy, too many special-cases, future maintenance nightmare etc.)
What I'd like to propose here for CoreFn is to fill in the (currently-ignored-via-_) type information argument in annToJSON right here: https://github.com/purescript/purescript/blob/0.12.0-dev/src/Language/PureScript/CoreFn/ToJSON.hs#L48
Are there any objections? I'm more than eager to prepare this PR (already works well in my fork) but would like to gather opinions here first, maybe this violates some design goals of CoreFn or something?
Alternatively, could also introduce a second flag so you'd do either --dump-corefn (slim old format) or --dump-corefn --dump-types (same corefn but sporting extended-with-type-infos annotations). Update: I guess this is more desirable because I just implemented all this in my local fork and the corefn.json files really blow up in size --- it's understandable if these type-infos in-you-alls-opinion shouldn't be included by-default.
Any of these 2 would really help to avoid having to do a lot of from-scratch type-inferencing for anyone aiming to use corefn.json files for actual transpilation purposes (rather than troubleshooting / inspection / study etc) targeting static-typed languages. (Sure, one still needs to map these "PS-native" type-annotations to one's target environment, but better than inferring them from scratch. Why duplicate all the work purs just did a few moments prior?)
The type info would actually be already readily there in-memory and pre-computed right when CoreFn is being dumped --- just it's being _-ignored for now.
Some might remember I'm attempting to transpile-PureScript-without-forking-purs. Irrelevant side-bar:
What I'd like to propose here for CoreFn is to fill in the (currently-ignored-via-
_) type information argument inannToJSONright here: https://github.com/purescript/purescript/blob/0.12.0-dev/src/Language/PureScript/CoreFn/ToJSON.hs#L48Are there any objections? I'm more than eager to prepare this PR (already works well in my fork) but would like to gather opinions here first, maybe this violates some design goals of CoreFn or something?
Alternatively, could also introduce a second flag so you'd do either
--dump-corefn(slim old format) or--dump-corefn --dump-types(same corefn but sporting extended-with-type-infos annotations). Update: I guess this is more desirable because I just implemented all this in my local fork and thecorefn.jsonfiles really blow up in size --- it's understandable if these type-infos in-you-alls-opinion shouldn't be included by-default.Any of these 2 would really help to avoid having to do a lot of from-scratch type-inferencing for anyone aiming to use
corefn.jsonfiles for actual transpilation purposes (rather than troubleshooting / inspection / study etc) targeting static-typed languages. (Sure, one still needs to map these "PS-native" type-annotations to one's target environment, but better than inferring them from scratch. Why duplicate all the workpursjust did a few moments prior?)The type info would actually be already readily there in-memory and pre-computed right when CoreFn is being dumped --- just it's being
_-ignored for now.