Unisay / purescript-lua

Purescript compiler back-end for Lua
GNU General Public License v3.0
56 stars 2 forks source link

`purescript-ref` doesn't compile due to foreign exports mismatching format #29

Closed Renegatto closed 2 months ago

Renegatto commented 3 months ago

On the one side it does expect that, on the other side it does not wrap their exports in the parentheses, violating it's own expectations.

[info] Build succeeded.
PS Lua: compiling ...
Linker error:
Error parsing foreign file "/home/user/purescript-lua-template/.spago/refs/v6.0.1/src/Effect/Ref.lua":
/home/user/purescript-lua-template/.spago/refs/v6.0.1/src/Effect/Ref.lua:2:10:
  |
2 |   _new = function(val) return function() return {value = val} end end,
  |          ^
unexpected 'f'
expecting '(' or white space

Wrapping value in the parentheses would indeed work:

   _new = (function(val) return function() return {value = val} end end),
Renegatto commented 3 months ago

It seems to be right there: https://github.com/Unisay/purescript-lua/blob/bef2ba667f395705bf3102fa17e7e22af8f3b694/lib/Language/PureScript/Backend/Lua/Linker/Foreign.hs#L95-L96

Renegatto commented 3 months ago

It does not really misexpect this: https://github.com/Unisay/purescript-lua/blob/bef2ba667f395705bf3102fa17e7e22af8f3b694/lib/Language/PureScript/Backend/Lua/Linker/Foreign.hs#L46

That probably means that the dependency (in this case Ref library) foreign code should be fixed.

Unisay commented 2 months ago

The foreign code in the purescript-lua-ref has been fixed, please update your package set and close this issue if the problem is gone, thanks!