purescript-native
purescript-native copied to clipboard
Add identifier
spago init -> set psgo backend -> spago build failed with error message about $ char code. added it in. maybe some sort of locale issue? i'm in LA area using Ubuntu 20.04 in wsl of windows.
Are you building psgo
yourself? If so, how (stack, cabal; what commit are you working off of)? If not, which binary are you using/where are you getting it from?
I had a similar issue when I was first working on https://github.com/andyarvanitis/purescript-native/pull/76, but I was also trying to sort out version issues (golang
's (the branch, that is) package.yaml
and psgo.cabal
doesn't include version constraints for PureScript — there are a few required changes to the codebase to get it working with 0.14.x (something I want to get into a PR after testing my other PR more and hopefully getting it merged)).
I'm not sure the specific cause, but I've run into the same issue, and I can also say that doing nix builds (and, IIRC, regular stack builds too?) from https://github.com/jjthiessen/purescript-native/tree/add-flakes seems to work/avoid the issue.
That being said, I did have to do something akin to this PR in my earlier experimentation to get psgo
compiling and seemingly working with 0.14.x (along with other changes), so something like this might be necessary in any case.
Hi. I am a beginner at nix so I used stack to build psgo from source
I think I'm going to have to try reproducing this again to see if I can figure out the cause. I'm too curious now :)
On Tue., Apr. 19, 2022, 19:06 Jonathan Lim, @.***> wrote:
Hi. I am a beginner at nix so I used stack to build psgo from source
— Reply to this email directly, view it on GitHub https://github.com/andyarvanitis/purescript-native/pull/77#issuecomment-1103375891, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK27GODBCSEBMIGB27TDH3VF5RDHANCNFSM5TTSEE4Q . You are receiving this because you commented.Message ID: @.***>
Oh. I was gonna try it from scratch on a digital ocean instance this weekend. Not sure if something was off with using wsl Ubuntu instead of regular Ubuntu
I'll try to provide more detail when I do that. Like go version. Purescript version. Ubuntu version.
I'll work on it now but I don't have much time.
hi, i duplicated the issue with some manual fresh installs: spago init -> spago backend="psgo" -> spago run -> error message: [info] Build succeeded. psgo: 36 CallStack (from HasCallStack): error, called at src/CodeGen/IL/Common.hs:63:21 in psgo-0.1.0.0-IgBukhCIbVQBRCfK92QQye:CodeGen.IL.Common [error] Backend "psgo" exited with error:1 Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-107-generic x86_64) installed libtinfo-dev git clone https://github.com/andyarvanitis/purescript-native.git stack - Version 2.7.5, Git revision ba147e6f59b2da75b1beb98b1888cce97f7032b1 x86_64 hpack-0.34.4 node - v18.0.0 purs - 0.14.9 spago - 0.20.7 go version - go1.18.1 linux/amd64
hopefully i will try the nix this weekend sometime but i'm a beginner at nix. maybe there's something different in the versions.
I wasn't able to reproduce the issue earlier with either Stack or Nix builds because I was using PureScript 0.13.8 for both building and using psgo
.
That is, all of the following should work:
- On
add-flakes
:- Using the nix flake directly
-
stack --nix build
-
nix-shell stack.nix stack --no-nix --system-ghc build
- On
golang
:-
stack --nix build
-
nix-shell stack.nix stack --no-nix --system-ghc build
-
When I encountered this originally, I was experimenting with 0.14.x compatibility (for building and running).
The error is because you're using purs
0.14.x.
psgo
doesn't support PureScript 0.14.x yet (at build time or runtime).
Since psgo
is compiled against 0.13.8, it will build fine (if you tried to bump the PureScript version to 0.14.x in the stack.yaml
it would fail).
However, psgo
is executed against the CoreFn output from whatever version of purs
you have available.
Below is a comparison of the contents of output/Effect.Class/corefn.json
for a build using 0.13.8 vs 0.14.5 (notice the $
in identifiers in the 0.14.5 CoreFn output).
{
"moduleName": [
"Effect",
"Class"
],
"imports": [
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
},
"moduleName": [
"Control",
"Category"
]
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
4,
1
],
"end": [
4,
35
]
}
},
"moduleName": [
"Control",
"Monad"
]
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
},
"moduleName": [
"Effect"
]
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
},
"moduleName": [
"Effect",
"Class"
]
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
},
"moduleName": [
"Prim"
]
}
],
"builtWith": "0.13.8",
"modulePath": ".spago/effect/v2.0.1/src/Effect/Class.purs",
"exports": [
"liftEffect",
"MonadEffect",
"monadEffectEffect"
],
"decls": [
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
15,
1
],
"end": [
16,
42
]
}
},
"identifier": "MonadEffect",
"expression": {
"annotation": {
"meta": {
"metaType": "IsTypeClassConstructor"
},
"sourceSpan": {
"start": [
15,
1
],
"end": [
16,
42
]
}
},
"body": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
15,
1
],
"end": [
16,
42
]
}
},
"body": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
15,
1
],
"end": [
16,
42
]
}
},
"value": {
"literalType": "ObjectLiteral",
"value": [
[
"Monad0",
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
15,
1
],
"end": [
16,
42
]
}
},
"value": {
"moduleName": null,
"identifier": "Monad0"
},
"type": "Var"
}
],
[
"liftEffect",
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
15,
1
],
"end": [
16,
42
]
}
},
"value": {
"moduleName": null,
"identifier": "liftEffect"
},
"type": "Var"
}
]
]
},
"type": "Literal"
},
"argument": "liftEffect",
"type": "Abs"
},
"argument": "Monad0",
"type": "Abs"
},
"bindType": "NonRec"
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"identifier": "monadEffectEffect",
"expression": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"argument": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
19,
16
],
"end": [
19,
24
]
}
},
"argument": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
0,
0
],
"end": [
0,
0
]
}
},
"value": {
"moduleName": [
"Control",
"Category"
],
"identifier": "categoryFn"
},
"type": "Var"
},
"type": "App",
"abstraction": {
"annotation": {
"meta": {
"metaType": "IsForeign"
},
"sourceSpan": {
"start": [
19,
16
],
"end": [
19,
24
]
}
},
"value": {
"moduleName": [
"Control",
"Category"
],
"identifier": "identity"
},
"type": "Var"
}
},
"type": "App",
"abstraction": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"argument": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"body": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
0,
0
],
"end": [
0,
0
]
}
},
"value": {
"moduleName": [
"Effect"
],
"identifier": "monadEffect"
},
"type": "Var"
},
"argument": "$__unused",
"type": "Abs"
},
"type": "App",
"abstraction": {
"annotation": {
"meta": {
"metaType": "IsTypeClassConstructor"
},
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"value": {
"moduleName": [
"Effect",
"Class"
],
"identifier": "MonadEffect"
},
"type": "Var"
}
}
},
"bindType": "NonRec"
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"identifier": "liftEffect",
"expression": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"body": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"expression": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"value": {
"moduleName": null,
"identifier": "dict"
},
"type": "Var"
},
"fieldName": "liftEffect",
"type": "Accessor"
},
"argument": "dict",
"type": "Abs"
},
"bindType": "NonRec"
}
],
"comments": [],
"foreign": [],
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
}
{
"moduleName": [
"Effect",
"Class"
],
"reExports": {},
"imports": [
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
},
"moduleName": [
"Control",
"Category"
]
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
4,
1
],
"end": [
4,
35
]
}
},
"moduleName": [
"Control",
"Monad"
]
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
},
"moduleName": [
"Effect"
]
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
},
"moduleName": [
"Effect",
"Class"
]
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
},
"moduleName": [
"Prim"
]
}
],
"builtWith": "0.14.5",
"modulePath": ".spago/effect/v3.0.0/src/Effect/Class.purs",
"exports": [
"liftEffect",
"monadEffectEffect"
],
"decls": [
{
"annotation": {
"meta": {
"metaType": "IsTypeClassConstructor"
},
"sourceSpan": {
"start": [
15,
1
],
"end": [
16,
42
]
}
},
"identifier": "MonadEffect$Dict",
"expression": {
"annotation": {
"meta": {
"metaType": "IsNewtype"
},
"sourceSpan": {
"start": [
15,
1
],
"end": [
16,
42
]
}
},
"body": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
15,
1
],
"end": [
16,
42
]
}
},
"value": {
"moduleName": null,
"identifier": "x"
},
"type": "Var"
},
"argument": "x",
"type": "Abs"
},
"bindType": "NonRec"
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"identifier": "monadEffectEffect",
"expression": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"argument": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"value": {
"literalType": "ObjectLiteral",
"value": [
[
"liftEffect",
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
19,
16
],
"end": [
19,
24
]
}
},
"argument": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
0,
0
],
"end": [
0,
0
]
}
},
"value": {
"moduleName": [
"Control",
"Category"
],
"identifier": "categoryFn"
},
"type": "Var"
},
"type": "App",
"abstraction": {
"annotation": {
"meta": {
"metaType": "IsForeign"
},
"sourceSpan": {
"start": [
19,
16
],
"end": [
19,
24
]
}
},
"value": {
"moduleName": [
"Control",
"Category"
],
"identifier": "identity"
},
"type": "Var"
}
}
],
[
"Monad0",
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"body": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
0,
0
],
"end": [
0,
0
]
}
},
"value": {
"moduleName": [
"Effect"
],
"identifier": "monadEffect"
},
"type": "Var"
},
"argument": "$__unused",
"type": "Abs"
}
]
]
},
"type": "Literal"
},
"type": "App",
"abstraction": {
"annotation": {
"meta": {
"metaType": "IsNewtype"
},
"sourceSpan": {
"start": [
18,
1
],
"end": [
19,
24
]
}
},
"value": {
"moduleName": [
"Effect",
"Class"
],
"identifier": "MonadEffect$Dict"
},
"type": "Var"
}
},
"bindType": "NonRec"
},
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"identifier": "liftEffect",
"expression": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"body": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"caseExpressions": [
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"value": {
"moduleName": null,
"identifier": "dict"
},
"type": "Var"
}
],
"caseAlternatives": [
{
"binders": [
{
"constructorName": {
"moduleName": [
"Effect",
"Class"
],
"identifier": "MonadEffect$Dict"
},
"annotation": {
"meta": {
"metaType": "IsNewtype"
},
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"typeName": {
"moduleName": [
"Effect",
"Class"
],
"identifier": "MonadEffect$Dict"
},
"binders": [
{
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"identifier": "v",
"binderType": "VarBinder"
}
],
"binderType": "ConstructorBinder"
}
],
"expression": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"expression": {
"annotation": {
"meta": null,
"sourceSpan": {
"start": [
16,
3
],
"end": [
16,
42
]
}
},
"value": {
"moduleName": null,
"identifier": "v"
},
"type": "Var"
},
"fieldName": "liftEffect",
"type": "Accessor"
},
"isGuarded": false
}
],
"type": "Case"
},
"argument": "dict",
"type": "Abs"
},
"bindType": "NonRec"
}
],
"comments": [],
"foreign": [],
"sourceSpan": {
"start": [
1,
1
],
"end": [
19,
24
]
}
}
I'm pretty sure there are other changes to CoreFn between 0.13.x and 0.14.x, and I'm not certain that psgo
built against 0.13.x should function correctly over all possible outputs from purs
0.14.x (even with these changes).
However, something like this will be required for 0.14.x compatibility (I just don't think it's the whole story).
TL;DR: Try using purs
0.13.x — it should resolve your issue.
Also, my earlier
nix-shell stack.nix
stack --no-nix --system-ghc build
is because I'm running NixOS (and that's the closest I can get to a vanilla stack build).
A simple stack build
should work in other environments.
yes, confirmed, purs 0.13.8 resolved issue.
Thank you for the info. Yes a stack build in Ubuntu worked after installing a library mentioned in this issue with some other project. https://github.com/judah/haskeline/issues/116