Commit graph

5620 commits

Author SHA1 Message Date
ayazhafiz
f65b174ab5 Implement List.find
`List.find : List elem, (elem -> Bool) -> Result elem [ NotFound ]*`
behaves as follows:

```
>>> List.find [1, 2, 3] (\n -> n > 2)
Ok 2
>>> List.find [1, 2, 3] (\n -> n > 4)
Err NotFound
```

We implement this as builtin in two phases. First, we call out to a
pure-llvm-lowlevel `ListFindUnsafe` that returns a record indicating
whether a satisfying element was found, and the value of that element
(the value is all null bytes if the element wasn't found). Then, we lift
that record to a `Result` via a standard construction of the can AST.

Closes #1909
2021-11-08 21:03:14 -05:00
Folkert
7ff4ad6f7b fix merge conflict 2021-11-08 23:57:56 +01:00
Folkert
a9d483cb60 Merge remote-tracking branch 'origin/trunk' into tag-union-imitate-rust 2021-11-08 22:31:17 +01:00
Folkert
8266284567 clippy 2021-11-08 22:31:08 +01:00
Brian Carroll
5bfc0093ec Intitialise CodeSection with just the right capacity 2021-11-08 14:59:49 +00:00
satotake
9087bf7273 Merge branch 'trunk' into builtsins-list-take-first 2021-11-08 14:32:36 +00:00
satotake
d0b09e1922 cleanup unused args 2021-11-08 14:31:34 +00:00
satotake
878400f95f Implement List.takeFirst 2021-11-08 14:10:53 +00:00
satotake
97c82d8d51 pick 02acef6 2021-11-08 11:15:20 +00:00
satotake
b8340b47c6 checkout trunk 2021-11-08 11:13:17 +00:00
satotake
c8f7a98d74 Merge branch 'trunk' into remove-dict-hash-test-only 2021-11-08 11:12:31 +00:00
Brendan Hansknecht
820ba8f5f6 fix formating and add new lock files 2021-11-07 20:20:01 -08:00
Brendan Hansknecht
bfdd454afa Remove unused dependency 2021-11-07 18:27:28 -08:00
Brendan Hansknecht
2ce945771e Make test crates only have dev dependencies and separate out wasm memory helper 2021-11-07 18:01:40 -08:00
Brendan Hansknecht
89781ec50d Stop building test crates as part of non-test builds 2021-11-07 16:28:17 -08:00
Richard Feldman
77a189d94f
Merge branch 'trunk' into move-wasmer-to-test-dependency 2021-11-07 23:52:20 +00:00
Richard Feldman
79080fb3f2
Merge pull request #1907 from rtfeldman/cleanup-zig-artifact-gen
generate wasm32 object file containing the builtins
2021-11-07 23:43:47 +00:00
Richard Feldman
0a347456ef
Merge pull request #1903 from rtfeldman/fix-str-from-int
Implement Str.fromInt for any integer type
2021-11-07 23:42:59 +00:00
Brian Carroll
ce9658684a Move wasmer dependency from gen_wasm to test_wasm 2021-11-07 22:56:28 +00:00
Folkert
e7ec575a81 trying to track down uninitialized memory creation 2021-11-07 21:41:12 +01:00
Brian Carroll
3ce94f8939
Merge branch 'trunk' into cleanup-zig-artifact-gen 2021-11-07 20:19:15 +00:00
Kevin Sjöberg
d6e98c08ec Increment the counter if data is owned 2021-11-07 20:50:29 +01:00
Kevin Sjöberg
87894578cf Remove alignment parameter 2021-11-07 20:48:09 +01:00
Kevin Sjöberg
dfe3f045bd Ignore broken test case for now 2021-11-07 20:48:09 +01:00
Kevin Sjöberg
5e1a9832cb Return false in case of empty list 2021-11-07 20:47:09 +01:00
Kevin Sjöberg
44938a9e35 Implement List.any 2021-11-07 20:44:10 +01:00
Kevin Sjöberg
0e500ba33c Document List.any 2021-11-07 20:43:28 +01:00
ayazhafiz
0d2ed76334 Implement List.joinMap
Closes #1887
2021-11-07 11:08:20 -05:00
Folkert
3138fc43ec cosmetic changes 2021-11-07 16:31:43 +01:00
Folkert
0e1e3381f0 Merge remote-tracking branch 'origin/trunk' into tag-union-imitate-rust 2021-11-07 15:29:55 +01:00
Folkert
180575852a all tests passing 2021-11-07 14:56:24 +01:00
satotake
0b524889c0 fmt 2021-11-07 12:46:11 +00:00
satotake
ad50f4a8f3
Merge branch 'trunk' into remove-dict-hash-test-only 2021-11-07 21:43:04 +09:00
satotake
a12b75192e Hide Dict.hashTestOnly 2021-11-07 12:30:04 +00:00
satotake
f3ee0bef40 Add keep_shadowed_builtins feature to roc_parse 2021-11-07 12:27:43 +00:00
satotake
0922c86352 Rollback 2021-11-07 12:27:26 +00:00
Brian Carroll
34b57cf315 Refactor after creating constant linking data 2021-11-07 11:23:20 +00:00
Brian Carroll
38d9fc5bbd Add linker data for strings, and deduplicate them
For references to addresses of constant strings, we make an entry in
reloc.CODE and configure the relocation type to say it points at a
memory address. (At least I think this is right, I can't test it yet!)

The same info can also be used for de-duplication.

It turns out we don't need reloc.DATA. I had misunderstood it.
The use case for that would be constant nested data structures,
where constant data would contain pointers to other constant data.
I don't think we're doing this in Roc at all, but not sure.
2021-11-07 11:20:32 +00:00
Brian Carroll
7dd5197953
Merge branch 'trunk' into wasm_serialization_refactor 2021-11-07 09:58:57 +00:00
Folkert de Vries
c0c2c1341c
Merge branch 'trunk' into fix-str-from-int 2021-11-07 00:00:21 +01:00
Folkert
75c090fd24 cleanup 2021-11-06 23:57:21 +01:00
Folkert
a31279a2c6 generate wasm32 object file 2021-11-06 23:03:46 +01:00
Brendan Hansknecht
74a55f53f3 Switch back to cranelift due to versioning and aarch64 issues 2021-11-06 14:24:58 -07:00
Brendan Hansknecht
40f0271ccf Fix M1 mac build
I changed wasmer to use the llvm backend because it compiles the fastest and supports aarch64.
If we later run into llvm versioning issues of some sort, we should switch this to cranelift.
Also re-adds serde-json which is used on macos.
2021-11-06 14:08:19 -07:00
Brendan Hansknecht
73e2cbcb1e Make versions numbers consistent and matching the lock files 2021-11-06 13:24:45 -07:00
Brendan Hansknecht
4a4a07441e Merge remote-tracking branch 'origin' into deps 2021-11-06 13:10:33 -07:00
Folkert
bd0f02c542 another waypoint 2021-11-06 19:27:16 +01:00
Richard Feldman
0eab20dbde
Merge pull request #1892 from rtfeldman/nix_M1_fix_v2
WIP Fix nix on Mac M1
2021-11-06 13:59:10 -04:00
Anton-4
69f6ffadab
Merge branch 'trunk' into deps 2021-11-06 18:07:34 +01:00
Anton-4
03cc4abbf0 Merge branch 'trunk' of https://github.com/rtfeldman/roc into nix_M1_fix_v2 2021-11-06 16:32:16 +01:00