ghcjs / ghcjs-base

base library for GHCJS for JavaScript interaction and marshalling, used by higher level libraries like JSC
MIT License
45 stars 67 forks source link

ReferenceError: h$closeWebSocket is not defined #47

Closed agocorona closed 7 years ago

agocorona commented 8 years ago

Here is the program and the error:

https://gist.github.com/agocorona/c1765b72ec915a53489f

luite commented 8 years ago

I think this works ok with the latest commit of ghcjs-base

agocorona commented 8 years ago

I have tried it again. Unregistered ghcjs-base, cloned the last commit, compiled and it still produce the same error....

I'm using windows by the way. GHCJS version 0.2.0 (GHC 7.10.2)

agocorona commented 8 years ago

Trying other things. It may be triggered by another error in my server app....

agocorona commented 8 years ago

It appears in chrome, but not in edge/explorer. I also have some problems with the protocol in the server side. So I will close this until I have a more clear case

manyoo commented 8 years ago

I'm reporting here the same problem. I investigated the generated files. In the ghcjs-base installation directory, the generated libHSghcjs-base-0.2.0.0-*-js_a file has the code in jsbits/websocket.js. But the generated lib.js for my app doesn't have the h$openWebSocket, h$closeWebSocket functions from websocket.js! But all code in other jsbits files like jsbits/array.js, jsbits/jsstring.js are all included in the lib.js. Why only the websocket.js code is excluded in the result? It's really weird.

manyoo commented 8 years ago

I tried reinstalling ghcjs-base with the newest version several times and it doesn't help. At last, deleting .ghcjs directory and run 'ghcjs-boot' again solved the problem by installing the latest version in the global directory. It seems when compiling packages, ghcjs is using the ghcjs-base package in the global directory but not the newer user .ghcjs directory. Is this a problem?

hamishmack commented 7 years ago

Looks like this is fixed.