Commit graph

158 commits

Author SHA1 Message Date
Ayaz Hafiz
3192bed417
Make sure structuralEq, structuralNotEq is not importable 2022-10-12 16:38:36 -05:00
Ayaz Hafiz
fe9b848686
Mark structuralEq as not exposed on the surface 2022-10-12 16:38:36 -05:00
Ayaz Hafiz
b04d7a9471
Bind types passed to isNotEq to Eq 2022-10-12 16:38:36 -05:00
Ayaz Hafiz
a256947a9f
Move Eq to Bool 2022-10-12 16:37:51 -05:00
Ayaz Hafiz
3674f6861e
Compile derived structural equality 2022-10-12 16:37:49 -05:00
Ayaz Hafiz
b587bcf0c2
Implement obligation checking for the Eq ability
Every type can have `Eq.isEq` derived for it, as long as

- it does not transitively contain a function
- it does not transitively contain a floating point value
- it does not transitively contain an opaque type that does not support
  `Eq`
2022-10-12 16:37:49 -05:00
Ayaz Hafiz
16d12a51c2
Add Eq to the standard library 2022-10-12 16:37:48 -05:00
Prajwal S N
a3e6345257
builtin(list): add List.countIf
Closes #4174

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2022-10-13 00:45:13 +05:30
Ayaz
83b64c4fb3
Merge pull request #4209 from roc-lang/impl-tag-discriminant
Derive `Hash` implementations for tag unions
2022-10-10 22:23:05 -05:00
Richard Feldman
860d8b41f1
Merge pull request #4273 from cjduncana/dict-update
Add the `update` function to the `Dict` module
2022-10-10 02:37:42 -07:00
Christopher Duncan
96e12aa790
Add the update function to the Dict module
This resolves #4239
2022-10-09 20:21:21 -04:00
Prajwal S N
aef15ac1e8
Merge branch 'main' into str-withprefix 2022-10-09 15:53:16 +05:30
Richard Feldman
8b3d73dfbc
Merge pull request #4249 from snprajwal/list-walkBckwardsUntil
builtin(list): implement List.walkBackwardsUntil
2022-10-08 23:47:29 -07:00
Ayaz
9d05bcd9d8
Merge pull request #4237 from snprajwal/str-withcapacity
builtin(str): implement Str.withCapacity
2022-10-08 14:31:30 -05:00
Anton-4
54fb1bc32f
Merge remote-tracking branch 'upstream/main' into str-withprefix 2022-10-08 19:58:51 +02:00
Prajwal S N
cbceeff902
builtin(list): implement List.walkBackwardsUntil
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2022-10-08 14:23:06 +05:30
Prajwal S N
d6526fa425
builtin(str): add withPrefix
Closes #4142

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2022-10-08 12:52:10 +05:30
Prajwal S N
9013e4ce11
builtin(str): implement withCapacity
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2022-10-08 00:24:46 +05:30
Prajwal S N
0f96dddc25
builtin(list): expose walkTry
Fixes: #4168

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2022-10-07 00:03:18 +05:30
Ayaz Hafiz
792afe5457
Remove TagDiscriminant low-level 2022-10-05 13:00:45 -05:00
Ayaz Hafiz
fd54cdfdd1
Low-level to extract discriminant from a tag union 2022-10-04 16:17:05 -05:00
Ayaz Hafiz
5b833e57b5
Support derivation of Hash for Str and List 2022-10-04 14:09:40 -05:00
Ayaz Hafiz
8844cd256e
Make sure Num.minU128/Num.maxU128 is properly exposed 2022-10-04 14:09:40 -05:00
Ayaz Hafiz
e9efc95425
Obligation checking for the Hash ability
This implements type-level checks that types can and cannot implement
the `Hash` ability.

Part of #4195
2022-10-04 10:51:14 -05:00
Ayaz Hafiz
eadbc0912a
Update the compiler to be aware of Hash 2022-10-04 10:22:22 -05:00
Ayaz Hafiz
ec40c3aa0e
Derive Copy 2022-10-02 21:42:43 -05:00
Ayaz Hafiz
0cc9ea4b05
Detect and report module names that don't match what they are used as
Prior to this commit, if you had a module structure like

```
| - A.roc
| - Dep
    | - B.roc
```

where `B.roc` was defined as

```
interface B exposes [] imports []
```

and `A.roc` was defined as

```
interface A exposes [] imports [Dep.B]
```

The compiler would hang on you. The reason is that even though we expect
`B` to be named `Dep.B` relative to `A`, that would not be enforced.

With this patch, we now enforce such naming schemes - a module must have
the namespaced name it is referenced by. Currently, we determine the
expected namespaced name by looking at how transitive dependencies of the
root module reference the module. In the future, once we have a package
ecosystem and a solid idea of "package roots", we can use the "package
root" to determine how a module should be named.

Closes #4094
2022-10-02 21:38:03 -05:00
Ayaz Hafiz
c521668d4c
Simplify how builtin types are added to a module 2022-09-30 13:40:33 -05:00
Ayaz Hafiz
2028dd5b0c
Add function to get exposed types of builtin module 2022-09-30 13:40:33 -05:00
Ayaz Hafiz
6832d4054f
Better name imported symbols to apply or hint symbols 2022-09-30 13:40:33 -05:00
Ayaz
f4e77a9e38
Merge pull request #4090 from roc-lang/i4084
Properly import builtin modules in platforms
2022-09-21 14:01:01 -05:00
Ayaz Hafiz
c0fc2fdb29
Do not qualify builtin modules with package shorthand when loading 2022-09-21 09:46:40 -05:00
kilianv
6dbebd7834
Update Bool to be opaque 2022-09-20 14:42:01 -05:00
Folkert de Vries
3ee3f23836
Merge pull request #3971 from roc-lang/dependabot/cargo/bumpalo-3.11.0
Bump bumpalo from 3.10.0 to 3.11.0
2022-09-13 21:00:00 +02:00
Richard Feldman
c64874937f
Add entries for Str.replace___ functions to Symbol 2022-09-12 21:03:18 -06:00
dependabot[bot]
0079048944
Bump bumpalo from 3.10.0 to 3.11.0
Bumps [bumpalo](https://github.com/fitzgen/bumpalo) from 3.10.0 to 3.11.0.
- [Release notes](https://github.com/fitzgen/bumpalo/releases)
- [Changelog](https://github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fitzgen/bumpalo/compare/3.10.0...3.11.0)

---
updated-dependencies:
- dependency-name: bumpalo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-12 21:08:56 +00:00
ayazhafiz
3456a44742
Only compile and run expects that belong to the same package
In particular, don't run expects that come from modules with a different
package qualification (including subpackages; we can loosen this
restriction later), or builtins when run on userspace apps/interfaces.

Closes #3722
2022-08-28 10:16:55 -05:00
Folkert de Vries
51d5aa789a
Merge pull request #3870 from roc-lang/dev-backend-div
add int/float division to the dev backend
2022-08-25 09:03:19 +02:00
Folkert
2d366acc6e
split out int and frac division into separate lowlevels 2022-08-23 11:07:38 +02:00
Richard Feldman
0bff2c6674
Support converting Lowercase to Box<str> 2022-08-15 11:11:31 -05:00
Richard Feldman
6af6006cdd
Give TagName a From<&str> 2022-08-15 11:11:30 -05:00
Ayaz Hafiz
29793fac32
Begin working on JSON record decoding
And we've hit a borrow panic 😍
2022-08-15 11:11:29 -05:00
Ross Smyth
80f14f61df
Add safe layout reprs and safety comments about layout 2022-08-13 03:49:12 -04:00
Richard Feldman
97e2900bf5
s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
Richard Feldman
26ee1a01bc
Merge pull request #3691 from rtfeldman/cargo_verson_change
changed Cargo versions from 0.1.0 to 0.0.1
2022-08-05 09:13:04 -04:00
Anton-4
6a15a7b41b
changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
Ayaz Hafiz
4bbc6b74fc
Add derivability obligation checking for Decode 2022-08-02 14:31:16 -05:00
Ayaz
fa14146054
Merge pull request #3531 from rtfeldman/decode
Very basic Decode.roc in the standard library
2022-08-02 14:26:28 -05:00
Ayaz Hafiz
fc71e3df04
Add Decode to the load graph 2022-08-01 08:09:22 -05:00
Ayaz Hafiz
1f4099449d
Add Decoder module symbol 2022-08-01 08:09:22 -05:00