Skip to content
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

Fix invalid unsafeCoerce usage #70

Closed

Conversation

iand675
Copy link

@iand675 iand675 commented Oct 14, 2016

js_listProps was improperly treating a JSArray as [JSString], which was causing crashes trying to use the FromJSVal instance for Value. @luite This seems like a fairly serious bug rather than just a nicety. Any chance this can get reviewed & merged ASAP?

@wuzzeb
Copy link

wuzzeb commented Dec 19, 2016

Unfortunately, while this is a temporary fix, it doesn't fix the underlying problem which is that there are two versions of the h$listProps function, one which returns a haskell value for which unsafeCoerce works perfectly fine in ghcjs-base's jsbits, and one which returns a javascript list located in shims which breaks the unsafeCoerce.

Since the order that ghcjs emits code is causing it to select the one from shims, your change to use fromListIO does work. But if ghcjs ever changes the order in which code is emitted, this will break again and have to go back to unsafeCoerce.

The solution is to rename one of the two versions of h$listProps. I would submit a pull, but I don't know exactly why the shims version of h$listProps even exists. Maybe the correct solution is to just delete the version of h$listProps inside shims? As far as I can see, nothing in shims itself requires h$listProps.

@hamishmack
Copy link
Member

This should have been fixed by ghcjs/shims#41

@hamishmack hamishmack closed this Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants