abilities syntax has -> implements

This commit is contained in:
Bryce Miller 2023-05-24 21:29:38 -04:00
parent 55bb8f4b6c
commit 91e37293a2
No known key found for this signature in database
GPG key ID: F1E97BF8DF152350
90 changed files with 438 additions and 437 deletions

View file

@ -6,7 +6,7 @@
"is"
"expect"
"dbg"
"has"
"implements"
"app"
"platform"

View file

@ -1,4 +1,4 @@
MEq has
eq b c : a, a -> U64 | a has MEq
MEq implements
eq b c : a, a -> U64 | a implements MEq
1

View file

@ -1,5 +1,5 @@
MEq has
eq : a, a -> U64 | a has MEq
neq : a, a -> U64 | a has MEq
MEq implements
eq : a, a -> U64 | a implements MEq
neq : a, a -> U64 | a implements MEq
1

View file

@ -1,4 +1,4 @@
MEq has
eq : a, a -> U64 | a has MEq
MEq implements
eq : a, a -> U64 | a implements MEq
1

View file

@ -1,4 +1,4 @@
Hash has
Hash implements
hash : a
-> U64

View file

@ -1,4 +1,4 @@
Hash has
Hash implements
hash : a
-> U64

View file

@ -1,4 +1,4 @@
Hash has
Hash implements
hash : a -> U64
hash2 : a -> U64

View file

@ -1,4 +1,4 @@
Hash has
Hash implements
hash : a -> U64
hash2 : a -> U64

View file

@ -1,3 +1,3 @@
Hash has hash : a -> U64 | a has Hash
Hash implements hash : a -> U64 | a implements Hash
1

View file

@ -1,5 +1,5 @@
Ab1 has ab1 : a -> {} | a has Ab1
Ab1 implements ab1 : a -> {} | a implements Ab1
Ab2 has ab2 : a -> {} | a has Ab2
Ab2 implements ab2 : a -> {} | a implements Ab2
1

View file

@ -1,24 +1,24 @@
A := U8 has [Eq, Hash]
A := U8 implements [Eq, Hash]
A := a | a has Other
has [Eq, Hash]
A := a | a implements Other
implements [Eq, Hash]
A := a | a has Other
has [Eq, Hash]
A := a | a implements Other
implements [Eq, Hash]
A := U8 has [Eq { eq }, Hash { hash }]
A := U8 implements [Eq { eq }, Hash { hash }]
A := U8 has [Eq { eq, eq1 }]
A := U8 implements [Eq { eq, eq1 }]
A := U8 has [Eq { eq, eq1 }, Hash]
A := U8 implements [Eq { eq, eq1 }, Hash]
A := U8 has [Hash, Eq { eq, eq1 }]
A := U8 implements [Hash, Eq { eq, eq1 }]
A := U8 has []
A := U8 implements []
A := a | a has Other
has [Eq { eq }, Hash { hash }]
A := a | a implements Other
implements [Eq { eq }, Hash { hash }]
A := U8 has [Eq {}]
A := U8 implements [Eq {}]
0

View file

@ -1,23 +1,23 @@
A := U8 has [Eq, Hash]
A := U8 implements [Eq, Hash]
A := a | a has Other has [Eq, Hash]
A := a | a implements Other implements [Eq, Hash]
A := a | a has Other
has [Eq, Hash]
A := a | a implements Other
implements [Eq, Hash]
A := U8 has [Eq {eq}, Hash {hash}]
A := U8 implements [Eq {eq}, Hash {hash}]
A := U8 has [Eq {eq, eq1}]
A := U8 implements [Eq {eq, eq1}]
A := U8 has [Eq {eq, eq1}, Hash]
A := U8 implements [Eq {eq, eq1}, Hash]
A := U8 has [Hash, Eq {eq, eq1}]
A := U8 implements [Hash, Eq {eq, eq1}]
A := U8 has []
A := U8 implements []
A := a | a has Other
has [Eq {eq}, Hash {hash}]
A := a | a implements Other
implements [Eq {eq}, Hash {hash}]
A := U8 has [Eq {}]
A := U8 implements [Eq {}]
0

View file

@ -1,3 +1,3 @@
f : a -> (b -> c) | a has A
f : a -> (b -> c) | a implements A
f

View file

@ -1,5 +1,5 @@
f : a -> b | a has Hash & Eq, b has Eq & Hash & Display
f : a -> b | a implements Hash & Eq, b implements Eq & Hash & Display
f : a -> b | a has Hash & Eq, b has Hash & Display & Eq
f : a -> b | a implements Hash & Eq, b implements Hash & Display & Eq
f

View file

@ -1,7 +1,7 @@
f : a -> b | a has Hash & Eq, b has Eq & Hash & Display
f : a -> b | a implements Hash & Eq, b implements Eq & Hash & Display
f : a -> b
| a has Hash & Eq,
b has Hash & Display & Eq
| a implements Hash & Eq,
b implements Hash & Display & Eq
f

View file

@ -1,3 +1,3 @@
f : a -> (b -> c) | a has A, b has Eq, c has Ord
f : a -> (b -> c) | a implements A, b implements Eq, c implements Ord
f

View file

@ -1,3 +1,3 @@
f : a -> (b -> c) | a has Hash, b has Eq, c has Ord
f : a -> (b -> c) | a has Hash, b has Eq, c implements Ord
f

View file

@ -1,6 +1,6 @@
f : a -> (b -> c)
| a has Hash,
b has Eq,
c has Ord
| a implements Hash,
b implements Eq,
c implements Ord
f

View file

@ -1,3 +1,3 @@
f : a | a has A
f : a | a implements A
f

View file

@ -1,3 +1,3 @@
f : a -> U64 | a has Hash
f : a -> U64 | a implements Hash
f

View file

@ -1,4 +1,4 @@
f : a -> U64
| a has Hash
| a implements Hash
f

View file

@ -5428,7 +5428,7 @@ mod test_fmt {
fn opaque_has_clause() {
expr_formats_same(indoc!(
r#"
A := U8 has [Eq, Hash]
A := U8 implements [Eq, Hash]
0
"#
@ -5439,7 +5439,7 @@ mod test_fmt {
r#"
A :=
U8
has [Eq, Hash]
implements [Eq, Hash]
0
"#
@ -5447,7 +5447,7 @@ mod test_fmt {
indoc!(
r#"
A := U8
has [Eq, Hash]
implements [Eq, Hash]
0
"#
@ -5457,15 +5457,15 @@ mod test_fmt {
expr_formats_to(
indoc!(
r#"
A := a | a has Hash has [ Eq, Hash ]
A := a | a implements Hash implements [ Eq, Hash ]
0
"#
),
indoc!(
r#"
A := a | a has Hash
has [Eq, Hash]
A := a | a implements Hash
implements [Eq, Hash]
0
"#
@ -5475,14 +5475,14 @@ mod test_fmt {
expr_formats_to(
indoc!(
r#"
A := U8 has []
A := U8 implements []
0
"#
),
indoc!(
r#"
A := U8 has []
A := U8 implements []
0
"#
@ -5525,7 +5525,7 @@ mod test_fmt {
fn opaque_has_with_impls() {
expr_formats_same(indoc!(
r#"
A := U8 has [Eq { eq }, Hash { hash }]
A := U8 implements [Eq { eq }, Hash { hash }]
0
"#
@ -5533,7 +5533,7 @@ mod test_fmt {
expr_formats_same(indoc!(
r#"
A := U8 has [Eq { eq, eq1 }]
A := U8 implements [Eq { eq, eq1 }]
0
"#
@ -5542,8 +5542,8 @@ mod test_fmt {
expr_formats_to(
indoc!(
r#"
A := U8 has [Eq { eq, eq1 }]
A := U8 has [Eq {
A := U8 implements [Eq { eq, eq1 }]
A := U8 implements [Eq {
eq,
eq1
}]
@ -5553,8 +5553,8 @@ mod test_fmt {
),
indoc!(
r#"
A := U8 has [Eq { eq, eq1 }]
A := U8 has [
A := U8 implements [Eq { eq, eq1 }]
A := U8 implements [
Eq {
eq,
eq1,
@ -5568,8 +5568,8 @@ mod test_fmt {
expr_formats_same(indoc!(
r#"
A := a | a has Other
has [Eq { eq }, Hash { hash }]
A := a | a implements Other
implements [Eq { eq }, Hash { hash }]
0
"#
@ -5577,7 +5577,7 @@ mod test_fmt {
expr_formats_same(indoc!(
r#"
A := U8 has [Eq {}]
A := U8 implements [Eq {}]
0
"#
@ -5625,7 +5625,7 @@ mod test_fmt {
dataIndices : List Nat,
data : List (T k v),
size : Nat,
} | k has Hash & Eq
} | k implements Hash & Eq
a
"#
@ -5837,12 +5837,12 @@ mod test_fmt {
r#"
interface Foo exposes [] imports []
A has
A implements
## This is member ab
ab : a -> a | a has A
ab : a -> a | a implements A
## This is member de
de : a -> a | a has A
de : a -> a | a implements A
f = g
"#
@ -5884,7 +5884,7 @@ mod test_fmt {
fn clauses_with_multiple_abilities() {
expr_formats_same(indoc!(
r#"
f : {} -> a | a has Eq & Hash & Decode
f : {} -> a | a implements Eq & Hash & Decode
f
"#
@ -5893,8 +5893,8 @@ mod test_fmt {
expr_formats_to(
indoc!(
r#"
f : {} -> a | a has Eq & Hash & Decode,
b has Eq & Hash
f : {} -> a | a implements Eq & Hash & Decode,
b implements Eq & Hash
f
"#
@ -5902,10 +5902,10 @@ mod test_fmt {
indoc!(
// TODO: ideally, this would look a bit nicer - consider
// f : {} -> a
// | a has Eq & Hash & Decode,
// b has Eq & Hash
// | a implements Eq & Hash & Decode,
// b implements Eq & Hash
r#"
f : {} -> a | a has Eq & Hash & Decode, b has Eq & Hash
f : {} -> a | a implements Eq & Hash & Decode, b implements Eq & Hash
f
"#