This repository has been archived by the owner on Nov 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gkaracha
suggested changes
May 14, 2020
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.
I added some comment suggestions to document the more intricate parts of the PR.
Optionally, I think I'd also add a simple test:
import Asterius.Types
import Data.Coerce
import System.Environment
foreign import javascript "console.log($1)" js_print :: JSVal -> IO ()
js_print_string :: String -> IO ()
js_print_string s = js_print (coerce (toJSString s))
main :: IO ()
main = getArgs >>= print
(expected output: ["extra","flags"]
)
Co-authored-by: George Karachalias <[email protected]>
@gkaracha Go ahead with the test then; remember to pull the weeds in the code snippet you pasted. |
TerrorJack
commented
May 14, 2020
gkaracha
approved these changes
May 14, 2020
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.
The test indeed prints ["extra","flags"]
as expected (see the very end of https://buildkite.com/tweag-1/asterius/builds/566#3daf7c98-89ea-4c20-8f8f-61f15b099545). This one is good to go.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #634.
This PR fixes
getArgs
fornode
. Say we compiletest.hs
and runnode test.mjs extra flags
,getArgs
will properly return["extra", "flags"]
.The current implementation is just enough to support #640. Limitations compared to native
getArgs
:setProgArgv
.+RTS ...
flags. See https://gitlab.haskell.org/ghc/ghc/-/blob/ghc-8.8/rts/RtsFlags.c#L612 for complete logic to handle them, which IMO is an unnecessary complexity to add for now.getFullArgs
.