roc
roc copied to clipboard
division + List.map == segfault in repl
division fn ok, list.map ok, list.map of division not ok.
The rockin' roc repl
────────────────────────
Enter an expression, or :help, or :q to quit.
» (|a| a / 60) 50
0.833333333333333333 : Frac *
» List.map [10, 20, 30, 40, 50, 60] (|a| a + 60)
[70, 80, 90, 100, 110, 120] : List (Num *)
» List.map [10, 20, 30, 40, 50, 60] (|a| a / 60)
Segmentation fault (core dumped)
roc doesn't emit a version number for me ( "build from source") but here's my rev from flake.lock:
"roc": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1750527332,
"narHash": "sha256-aZJUHf5uZ+tJ7ySw7p3vPqord2yjd+xN19546yZnu6M=",
"owner": "roc-lang",
"repo": "roc",
"rev": "881642b850b7ed581c4179b784f5530b292159cc",
"type": "github"
},
"original": {
"owner": "roc-lang",
"repo": "roc",
"type": "github"
}
},
Hi @bburdette,
This could be an issue with division with Dec in the repl and/or failure of the type unification. Current workaround is to force the F64 type:
❯ roc repl
The rockin' roc repl
────────────────────────
Enter an expression, or :help, or :q to quit.
» lst : List F64
… lst = [10, 20, 30, 40, 50, 60]
[10, 20, 30, 40, 50, 60] : List F64
» List.map lst (|a| a / 60)
[0.16666666666666666, 0.3333333333333333, 0.5, 0.6666666666666666, 0.8333333333333334, 1] : List F64
»
With Dec for context:
temp on main [?] took 1m34s
❯ roc repl
The rockin' roc repl
────────────────────────
Enter an expression, or :help, or :q to quit.
» lst : List Dec
… lst = [10, 20, 30, 40, 50, 60]
[10, 20, 30, 40, 50, 60] : List Dec
» List.map lst (|a| a / 60)
Segmentation fault (core dumped)
We probably will not fix this issue in the old (current) compiler but I will leave this open to make sure this works in the repl of the new compiler.