*.hs -> STG, STG -> js

28 views
Skip to first unread message

zzz...@gmail.com

unread,
Aug 24, 2016, 8:09:16 PM8/24/16
to haste-compiler
I'm trying to read the Haste source.


However, I don't see where it's called in the haste sources.

I've tried gripping for "::.*Stg" in the haste source but I can't find a clear layer where se do hs -> STG, and another where we do STG -> JS.

Where in the Haste-Compiler pipeline do we get STG?

Thanks!

Anton Ekblad

unread,
Aug 25, 2016, 7:32:34 AM8/25/16
to haste-compiler
The HS -> STG transformation happens entirely in ghc-simple. If you look at [1], you'll see an `Intermediate` instance for lists of STG bindings. This instance is then used by `compileFold` [2], which takes each module being compiled, converts it to some `Intermediate` type (in this particular case, that's STG), and applies a user-provided function to that intermediate data. This function is called from [3], where the STG-to-JS code generator in [4] is the previously mentioned user-provided function.

The idea behind this arrangement is that users of ghc-simple shouldn't need to care about how they get their hands on the STG (or Core, or whatever) bindings - they should ideally just need to specify a code generator for their preferred input format, and that's it.

Reply all
Reply to author
Forward
0 new messages