-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lift decls js backend #3821
Lift decls js backend #3821
Conversation
… with js numbers(doubles)
Nifty! A couple of questions, as I don't have time to dig into code just right now:
|
Thanks for the PR! I will start a review, it's going to take a while. Others shouldn't hesitate to take a look too :-) |
|
Can you add a commit that updates the CHANGELOG? |
I looked at the Travis outcomes:
|
mapMapListKeys f (t:r) x = mapMapListKeys f r $ Map.adjust f t x | ||
|
||
|
||
extract_globs :: Map Name LDecl -> LDecl -> [Name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to camelcase, here and the other underscored names in the file
src/IRTS/JavaScript/Codegen.hs
Outdated
} | ||
|
||
|
||
get_include :: FilePath -> IO Text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change these names to camelcase
src/IRTS/JavaScript/AST.hs
Outdated
, "}\n\n" | ||
] | ||
|
||
js_aux_defs = T.concat [throw2, force] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to camelcase
I have pushed some changes to address these problems. Regarding the CHANGELOG, I need to create a new Header "New in ...", right? What version? |
Just put it on the top under a Tool Updates header and edwin will fill in version when he releases.
… 17 maj 2017 kl. 10:38 skrev Rui Barreiro ***@***.***>:
I have pushed some changes to address these problems. Regarding the CHANGELOG, I need to create a new Header "New in ...", right? What version?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I'll merge this tomorrow unless there are objections. @edwinb any comments? |
Thanks for the contribution! |
This is great! @be5invis I think I remember you may have had some custom optimizations for a version of this backend. Could you please consider backporting the improvements here? |
@ahmadsalim There are some, like uncurrying, data type specialization, custom rewriting rules, etc. |
@ahmadsalim The differences are:
|
@be5invis That sounds great! |
@ahmadsalim I'd like to open another PR. |
@be5invis Yeah, that is what I meant :). But I think there has been some updates to this backend that fixes some issues, and it would be nice if your work incorporated the changes. |
@ahmadsalim The compiler part and the FFI/primitive part are, well, pretty separated. |
@be5invis I see, in any case you are welcome to submit a new PR. |
@ahmadsalim I'd like to add the ES codegen entirely into Idris first and move the FFI/primitive thing into ES... |
@be5invis I see, I was not aware on the degree things changed. I think a suggestion could be that you fork the latest version of Idris, add your changes there, move the FFI/primitives and then make the PR if possible. Do you agree? |
@ahmadsalim I'll do that. |
@ahmadsalim The current version already has uncurry (though... looks not beautiful 😞)
|
Good news?... Maybe... |
Regarding ES6 in practice, depending on the features the closure compiler can convert ES6 to ES5. But you might have some trouble with the CI. I was using "const" and it failed the tests. |
@be5invis I think the optimizations sound good. |
Also, i was remembered about babel. |
@be5invis I gave a quick look to repo and I liked what you did in JsAST.hs, JsName.hs Regarding the rewriting, do you think you can do it creating less complexity on the cgBody function, maybe using uniplate and some replace rule with LForeign, what do you think? If it is not possible we can discuss further. I would not like to make cgBody more complex, it is already a bit hard to read. What do you think? |
I also prefer your solution to uncurry. |
Just one question, I moved the lambdas to the partial application functions, because in-line it raised problems with the tail call optim, I was creating new lambdas using the variables in the loop, so I was changing the lambdas by changing the variable in the loop. How did you addressed this? |
@be5invis One more question, you changed the all uses of javascript switch statement to if? |
@rbarreiro For data type specialization. |
But you changed it for constructors identified by integers also?
Em 23/05/2017 13:55, "Belleve Invis" <[email protected]> escreveu:
… @rbarreiro <https:/rbarreiro> For data type specialization.
In idris-codegen-es, nullary data construction would be specialized into a
*number*, and built-in types like True and False would be mapped into
JavaScript true and false. So, yes, it need to be changed into if.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3821 (comment)>,
or mute the thread
<https:/notifications/unsubscribe-auth/AAM9NsHA8jdEJApwqRV2aPLtrVZgdm_Sks5r8tcjgaJpZM4Nc1y0>
.
|
I have made a new js backend based on the liftDecls.
It is passing all the tests. And works much better with foreign functions that take functions as arguments,
This test https:/rbarreiro/idrisjs/blob/master/tests/t8.idr is not working as expected with the current backend.
I also prefer the javascript generated directly from lifstDecls to the one produced by the current backend.
Can you please review it?