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

@ -634,6 +634,7 @@ mod cli_run {
}
#[test]
#[ignore]
#[cfg_attr(
windows,
ignore = "this platform is broken, and `roc run --lib` is missing on windows"

View File

@ -13,7 +13,7 @@ Model position :
}
initialModel : position -> Model position | position has Hash & Eq
initialModel : position -> Model position | position implements Hash & Eq
initialModel = \start ->
{ evaluated : Set.empty {}
, openSet : Set.single start
@ -22,7 +22,7 @@ initialModel = \start ->
}
cheapestOpen : (position -> F64), Model position -> Result position [KeyNotFound] | position has Hash & Eq
cheapestOpen : (position -> F64), Model position -> Result position [KeyNotFound] | position implements Hash & Eq
cheapestOpen = \costFunction, model ->
folder = \resSmallestSoFar, position ->
@ -47,7 +47,7 @@ cheapestOpen = \costFunction, model ->
reconstructPath : Dict position position, position -> List position | position has Hash & Eq
reconstructPath : Dict position position, position -> List position | position implements Hash & Eq
reconstructPath = \cameFrom, goal ->
when Dict.get cameFrom goal is
Err KeyNotFound ->
@ -56,7 +56,7 @@ reconstructPath = \cameFrom, goal ->
Ok next ->
List.append (reconstructPath cameFrom next) goal
updateCost : position, position, Model position -> Model position | position has Hash & Eq
updateCost : position, position, Model position -> Model position | position implements Hash & Eq
updateCost = \current, neighbour, model ->
newCameFrom = Dict.insert model.cameFrom neighbour current
@ -80,12 +80,12 @@ updateCost = \current, neighbour, model ->
model
findPath : { costFunction: (position, position -> F64), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [KeyNotFound] | position has Hash & Eq
findPath : { costFunction: (position, position -> F64), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [KeyNotFound] | position implements Hash & Eq
findPath = \{ costFunction, moveFunction, start, end } ->
astar costFunction moveFunction end (initialModel start)
astar : (position, position -> F64), (position -> Set position), position, Model position -> [Err [KeyNotFound], Ok (List position)] | position has Hash & Eq
astar : (position, position -> F64), (position -> Set position), position, Model position -> [Err [KeyNotFound], Ok (List position)] | position implements Hash & Eq
astar = \costFn, moveFn, goal, model ->
when cheapestOpen (\position -> costFn goal position) model is
Err _ ->

View File

@ -491,12 +491,12 @@ fn load_astar() {
expect_types(
loaded_module,
hashmap! {
"findPath" => "{ costFunction : position, position -> F64, end : position, moveFunction : position -> Set position, start : position } -> Result (List position) [KeyNotFound] | position has Hash & Eq",
"initialModel" => "position -> Model position | position has Hash & Eq",
"reconstructPath" => "Dict position position, position -> List position | position has Hash & Eq",
"updateCost" => "position, position, Model position -> Model position | position has Hash & Eq",
"cheapestOpen" => "(position -> F64), Model position -> Result position [KeyNotFound] | position has Hash & Eq",
"astar" => "(position, position -> F64), (position -> Set position), position, Model position -> [Err [KeyNotFound], Ok (List position)] | position has Hash & Eq",
"findPath" => "{ costFunction : position, position -> F64, end : position, moveFunction : position -> Set position, start : position } -> Result (List position) [KeyNotFound] | position implements Hash & Eq",
"initialModel" => "position -> Model position | position implements Hash & Eq",
"reconstructPath" => "Dict position position, position -> List position | position implements Hash & Eq",
"updateCost" => "position, position, Model position -> Model position | position implements Hash & Eq",
"cheapestOpen" => "(position -> F64), Model position -> Result position [KeyNotFound] | position implements Hash & Eq",
"astar" => "(position, position -> F64), (position -> Set position), position, Model position -> [Err [KeyNotFound], Ok (List position)] | position implements Hash & Eq",
},
);
}

View File

@ -3150,7 +3150,7 @@ mod solve_expr {
Dict.insert
"#
),
"Dict k v, k, v -> Dict k v | k has Hash & Eq",
"Dict k v, k, v -> Dict k v | k implements Hash & Eq",
);
}
@ -3423,7 +3423,7 @@ mod solve_expr {
reconstructPath
"#
),
"Dict position position, position -> List position | position has Hash & Eq",
"Dict position position, position -> List position | position implements Hash & Eq",
);
}
@ -3480,7 +3480,7 @@ mod solve_expr {
astar
"#
),
"Model position -> Result position [KeyNotFound] | position has Hash & Eq",
"Model position -> Result position [KeyNotFound] | position implements Hash & Eq",
);
}

View File

@ -106,8 +106,8 @@ fn list() {
derive_test(Decoder, v!(Symbol::LIST_LIST v!(STR)), |golden| {
assert_snapshot!(golden, @r###"
# derived for List Str
# Decoder (List val) fmt | fmt has DecoderFormatting, val has Decoding
# List U8, fmt -[[custom(3)]]-> { rest : List U8, result : [Err [TooShort], Ok (List val)] } | fmt has DecoderFormatting, val has Decoding
# Decoder (List val) fmt | fmt has DecoderFormatting, val implements Decoding
# List U8, fmt -[[custom(3)]]-> { rest : List U8, result : [Err [TooShort], Ok (List val)] } | fmt has DecoderFormatting, val implements Decoding
# Specialization lambda sets:
# @<1>: [[custom(3)]]
#Derived.decoder_list =
@ -124,8 +124,8 @@ fn record_2_fields() {
derive_test(Decoder, v!({first: v!(STR), second: v!(STR),}), |golden| {
assert_snapshot!(golden, @r###"
# derived for { first : Str, second : Str }
# Decoder { first : val, second : val1 } fmt | fmt has DecoderFormatting, val has Decoding, val1 has Decoding
# List U8, fmt -[[custom(22)]]-> { rest : List U8, result : [Err [TooShort], Ok { first : val, second : val1 }] } | fmt has DecoderFormatting, val has Decoding, val1 has Decoding
# Decoder { first : val, second : val1 } fmt | fmt has DecoderFormatting, val has Decoding, val1 implements Decoding
# List U8, fmt -[[custom(22)]]-> { rest : List U8, result : [Err [TooShort], Ok { first : val, second : val1 }] } | fmt has DecoderFormatting, val has Decoding, val1 implements Decoding
# Specialization lambda sets:
# @<1>: [[custom(22)]]
#Derived.decoder_{first,second} =
@ -181,8 +181,8 @@ fn tuple_2_fields() {
derive_test(Decoder, v!((v!(STR), v!(U8),)), |golden| {
assert_snapshot!(golden, @r###"
# derived for ( Str, U8 )*
# Decoder ( val, val1 )* fmt | fmt has DecoderFormatting, val has Decoding, val1 has Decoding
# List U8, fmt -[[custom(22)]]-> { rest : List U8, result : [Err [TooShort], Ok ( val, val1 )a] } | fmt has DecoderFormatting, val has Decoding, val1 has Decoding
# Decoder ( val, val1 )* fmt | fmt has DecoderFormatting, val has Decoding, val1 implements Decoding
# List U8, fmt -[[custom(22)]]-> { rest : List U8, result : [Err [TooShort], Ok ( val, val1 )a] } | fmt has DecoderFormatting, val has Decoding, val1 implements Decoding
# Specialization lambda sets:
# @<1>: [[custom(22)]]
#Derived.decoder_(arity:2) =

View File

@ -188,8 +188,8 @@ fn empty_record() {
derive_test(ToEncoder, v!(EMPTY_RECORD), |golden| {
assert_snapshot!(golden, @r###"
# derived for {}
# {} -[[toEncoder_{}(0)]]-> Encoder fmt | fmt has EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> (List U8, fmt -[[custom(2) {}]]-> List U8) | fmt has EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> Encoder fmt | fmt implements EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> (List U8, fmt -[[custom(2) {}]]-> List U8) | fmt implements EncoderFormatting
# Specialization lambda sets:
# @<1>: [[toEncoder_{}(0)]]
# @<2>: [[custom(2) {}]]
@ -208,8 +208,8 @@ fn zero_field_record() {
derive_test(ToEncoder, v!({}), |golden| {
assert_snapshot!(golden, @r###"
# derived for {}
# {} -[[toEncoder_{}(0)]]-> Encoder fmt | fmt has EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> (List U8, fmt -[[custom(2) {}]]-> List U8) | fmt has EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> Encoder fmt | fmt implements EncoderFormatting
# {} -[[toEncoder_{}(0)]]-> (List U8, fmt -[[custom(2) {}]]-> List U8) | fmt implements EncoderFormatting
# Specialization lambda sets:
# @<1>: [[toEncoder_{}(0)]]
# @<2>: [[custom(2) {}]]
@ -228,11 +228,11 @@ fn one_field_record() {
derive_test(ToEncoder, v!({ a: v!(U8), }), |golden| {
assert_snapshot!(golden, @r###"
# derived for { a : U8 }
# { a : val } -[[toEncoder_{a}(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding
# { a : val } -[[toEncoder_{a}(0)]]-> (List U8, fmt -[[custom(2) { a : val }]]-> List U8) | fmt has EncoderFormatting, val has Encoding
# { a : val } -[[toEncoder_{a}(0)]]-> Encoder fmt | fmt has EncoderFormatting, val implements Encoding
# { a : val } -[[toEncoder_{a}(0)]]-> (List U8, fmt -[[custom(2) { a : val }]]-> List U8) | fmt has EncoderFormatting, val implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_{a}(0)]]
# @<2>: [[custom(2) { a : val }]] | val has Encoding
# @<2>: [[custom(2) { a : val }]] | val implements Encoding
#Derived.toEncoder_{a} =
\#Derived.rcd ->
custom
@ -251,11 +251,11 @@ fn two_field_record() {
derive_test(ToEncoder, v!({ a: v!(U8), b: v!(STR), }), |golden| {
assert_snapshot!(golden, @r###"
# derived for { a : U8, b : Str }
# { a : val, b : val1 } -[[toEncoder_{a,b}(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# { a : val, b : val1 } -[[toEncoder_{a,b}(0)]]-> (List U8, fmt -[[custom(2) { a : val, b : val1 }]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# { a : val, b : val1 } -[[toEncoder_{a,b}(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# { a : val, b : val1 } -[[toEncoder_{a,b}(0)]]-> (List U8, fmt -[[custom(2) { a : val, b : val1 }]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_{a,b}(0)]]
# @<2>: [[custom(2) { a : val, b : val1 }]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(2) { a : val, b : val1 }]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_{a,b} =
\#Derived.rcd ->
custom
@ -278,11 +278,11 @@ fn two_field_tuple() {
derive_test(ToEncoder, v!((v!(U8), v!(STR),)), |golden| {
assert_snapshot!(golden, @r###"
# derived for ( U8, Str )*
# ( val, val1 )* -[[toEncoder_(arity:2)(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# ( val, val1 )a -[[toEncoder_(arity:2)(0)]]-> (List U8, fmt -[[custom(2) ( val, val1 )a]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# ( val, val1 )* -[[toEncoder_(arity:2)(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# ( val, val1 )a -[[toEncoder_(arity:2)(0)]]-> (List U8, fmt -[[custom(2) ( val, val1 )a]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_(arity:2)(0)]]
# @<2>: [[custom(2) ( val, val1 )*]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(2) ( val, val1 )*]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_(arity:2) =
\#Derived.tup ->
custom
@ -314,8 +314,8 @@ fn tag_one_label_zero_args() {
derive_test(ToEncoder, v!([A]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A]
# [A] -[[toEncoder_[A 0](0)]]-> Encoder fmt | fmt has EncoderFormatting
# [A] -[[toEncoder_[A 0](0)]]-> (List U8, fmt -[[custom(2) [A]]]-> List U8) | fmt has EncoderFormatting
# [A] -[[toEncoder_[A 0](0)]]-> Encoder fmt | fmt implements EncoderFormatting
# [A] -[[toEncoder_[A 0](0)]]-> (List U8, fmt -[[custom(2) [A]]]-> List U8) | fmt implements EncoderFormatting
# Specialization lambda sets:
# @<1>: [[toEncoder_[A 0](0)]]
# @<2>: [[custom(2) [A]]]
@ -338,11 +338,11 @@ fn tag_one_label_two_args() {
derive_test(ToEncoder, v!([A v!(U8) v!(STR)]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A U8 Str]
# [A val val1] -[[toEncoder_[A 2](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [A val val1] -[[toEncoder_[A 2](0)]]-> (List U8, fmt -[[custom(4) [A val val1]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [A val val1] -[[toEncoder_[A 2](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# [A val val1] -[[toEncoder_[A 2](0)]]-> (List U8, fmt -[[custom(4) [A val val1]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_[A 2](0)]]
# @<2>: [[custom(4) [A val val1]]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(4) [A val val1]]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_[A 2] =
\#Derived.tag ->
custom
@ -366,11 +366,11 @@ fn tag_two_labels() {
|golden| {
assert_snapshot!(golden, @r###"
# derived for [A U8 Str U16, B Str]
# [A val val1 val1, B val1] -[[toEncoder_[A 3,B 1](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [A val val1 val1, B val1] -[[toEncoder_[A 3,B 1](0)]]-> (List U8, fmt -[[custom(6) [A val val1 val1, B val1]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [A val val1 val1, B val1] -[[toEncoder_[A 3,B 1](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# [A val val1 val1, B val1] -[[toEncoder_[A 3,B 1](0)]]-> (List U8, fmt -[[custom(6) [A val val1 val1, B val1]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_[A 3,B 1](0)]]
# @<2>: [[custom(6) [A val val1 val1, B val1]]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(6) [A val val1 val1, B val1]]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_[A 3,B 1] =
\#Derived.tag ->
custom
@ -402,11 +402,11 @@ fn recursive_tag_union() {
|golden| {
assert_snapshot!(golden, @r###"
# derived for [Cons U8 $rec, Nil] as $rec
# [Cons val val1, Nil] -[[toEncoder_[Cons 2,Nil 0](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [Cons val val1, Nil] -[[toEncoder_[Cons 2,Nil 0](0)]]-> (List U8, fmt -[[custom(4) [Cons val val1, Nil]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding
# [Cons val val1, Nil] -[[toEncoder_[Cons 2,Nil 0](0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# [Cons val val1, Nil] -[[toEncoder_[Cons 2,Nil 0](0)]]-> (List U8, fmt -[[custom(4) [Cons val val1, Nil]]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_[Cons 2,Nil 0](0)]]
# @<2>: [[custom(4) [Cons val val1, Nil]]] | val has Encoding, val1 has Encoding
# @<2>: [[custom(4) [Cons val val1, Nil]]] | val has Encoding, val1 implements Encoding
#Derived.toEncoder_[Cons 2,Nil 0] =
\#Derived.tag ->
custom
@ -429,11 +429,11 @@ fn list() {
derive_test(ToEncoder, v!(Symbol::LIST_LIST v!(STR)), |golden| {
assert_snapshot!(golden, @r###"
# derived for List Str
# List val -[[toEncoder_list(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding
# List val -[[toEncoder_list(0)]]-> (List U8, fmt -[[custom(4) (List val)]]-> List U8) | fmt has EncoderFormatting, val has Encoding
# List val -[[toEncoder_list(0)]]-> Encoder fmt | fmt has EncoderFormatting, val implements Encoding
# List val -[[toEncoder_list(0)]]-> (List U8, fmt -[[custom(4) (List val)]]-> List U8) | fmt has EncoderFormatting, val implements Encoding
# Specialization lambda sets:
# @<1>: [[toEncoder_list(0)]]
# @<2>: [[custom(4) (List val)]] | val has Encoding
# @<2>: [[custom(4) (List val)]] | val implements Encoding
#Derived.toEncoder_list =
\#Derived.lst ->
custom

View File

@ -151,8 +151,8 @@ fn empty_record() {
derive_test(Hash, v!(EMPTY_RECORD), |golden| {
assert_snapshot!(golden, @r###"
# derived for {}
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher has Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher has Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher implements Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_{}(0)]]
#Derived.hash_{} = \#Derived.hasher, #Derived.rcd -> #Derived.hasher
@ -166,8 +166,8 @@ fn zero_field_record() {
derive_test(Hash, v!({}), |golden| {
assert_snapshot!(golden, @r###"
# derived for {}
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher has Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher has Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher implements Hasher
# hasher, {} -[[hash_{}(0)]]-> hasher | hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_{}(0)]]
#Derived.hash_{} = \#Derived.hasher, #Derived.rcd -> #Derived.hasher
@ -181,8 +181,8 @@ fn one_field_record() {
derive_test(Hash, v!({ a: v!(U8), }), |golden| {
assert_snapshot!(golden, @r###"
# derived for { a : U8 }
# hasher, { a : a } -[[hash_{a}(0)]]-> hasher | a has Hash, hasher has Hasher
# hasher, { a : a } -[[hash_{a}(0)]]-> hasher | a has Hash, hasher has Hasher
# hasher, { a : a } -[[hash_{a}(0)]]-> hasher | a has Hash, hasher implements Hasher
# hasher, { a : a } -[[hash_{a}(0)]]-> hasher | a has Hash, hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_{a}(0)]]
#Derived.hash_{a} =
@ -197,8 +197,8 @@ fn two_field_record() {
derive_test(Hash, v!({ a: v!(U8), b: v!(STR), }), |golden| {
assert_snapshot!(golden, @r###"
# derived for { a : U8, b : Str }
# hasher, { a : a, b : a1 } -[[hash_{a,b}(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, { a : a, b : a1 } -[[hash_{a,b}(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, { a : a, b : a1 } -[[hash_{a,b}(0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# hasher, { a : a, b : a1 } -[[hash_{a,b}(0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_{a,b}(0)]]
#Derived.hash_{a,b} =
@ -214,8 +214,8 @@ fn two_element_tuple() {
derive_test(Hash, v!((v!(U8), v!(STR),)), |golden| {
assert_snapshot!(golden, @r###"
# derived for ( U8, Str )*
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_(arity:2)(0)]]
#Derived.hash_(arity:2) =
@ -231,8 +231,8 @@ fn tag_one_label_no_payloads() {
derive_test(Hash, v!([A]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A]
# hasher, [A] -[[hash_[A 0](0)]]-> hasher | hasher has Hasher
# hasher, [A] -[[hash_[A 0](0)]]-> hasher | hasher has Hasher
# hasher, [A] -[[hash_[A 0](0)]]-> hasher | hasher implements Hasher
# hasher, [A] -[[hash_[A 0](0)]]-> hasher | hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_[A 0](0)]]
#Derived.hash_[A 0] = \#Derived.hasher, A -> #Derived.hasher
@ -246,8 +246,8 @@ fn tag_one_label_newtype() {
derive_test(Hash, v!([A v!(U8) v!(STR)]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A U8 Str]
# hasher, [A a a1] -[[hash_[A 2](0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, [A a a1] -[[hash_[A 2](0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher
# hasher, [A a a1] -[[hash_[A 2](0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# hasher, [A a a1] -[[hash_[A 2](0)]]-> hasher | a has Hash, a1 has Hash, hasher implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_[A 2](0)]]
#Derived.hash_[A 2] =
@ -263,8 +263,8 @@ fn tag_two_labels() {
derive_test(Hash, v!([A v!(U8) v!(STR) v!(U16), B v!(STR)]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A U8 Str U16, B Str]
# a, [A a1 a2 a3, B a3] -[[hash_[A 3,B 1](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash, a3 has Hash
# a, [A a1 a2 a3, B a3] -[[hash_[A 3,B 1](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash, a3 has Hash
# a, [A a1 a2 a3, B a3] -[[hash_[A 3,B 1](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash, a3 implements Hash
# a, [A a1 a2 a3, B a3] -[[hash_[A 3,B 1](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash, a3 implements Hash
# Specialization lambda sets:
# @<1>: [[hash_[A 3,B 1](0)]]
#Derived.hash_[A 3,B 1] =
@ -285,8 +285,8 @@ fn tag_two_labels_no_payloads() {
derive_test(Hash, v!([A, B]), |golden| {
assert_snapshot!(golden, @r###"
# derived for [A, B]
# a, [A, B] -[[hash_[A 0,B 0](0)]]-> a | a has Hasher
# a, [A, B] -[[hash_[A 0,B 0](0)]]-> a | a has Hasher
# a, [A, B] -[[hash_[A 0,B 0](0)]]-> a | a implements Hasher
# a, [A, B] -[[hash_[A 0,B 0](0)]]-> a | a implements Hasher
# Specialization lambda sets:
# @<1>: [[hash_[A 0,B 0](0)]]
#Derived.hash_[A 0,B 0] =
@ -304,8 +304,8 @@ fn recursive_tag_union() {
derive_test(Hash, v!([Nil, Cons v!(U8) v!(^lst) ] as lst), |golden| {
assert_snapshot!(golden, @r###"
# derived for [Cons U8 $rec, Nil] as $rec
# a, [Cons a1 a2, Nil] -[[hash_[Cons 2,Nil 0](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash
# a, [Cons a1 a2, Nil] -[[hash_[Cons 2,Nil 0](0)]]-> a | a has Hasher, a1 has Hash, a2 has Hash
# a, [Cons a1 a2, Nil] -[[hash_[Cons 2,Nil 0](0)]]-> a | a has Hasher, a1 has Hash, a2 implements Hash
# a, [Cons a1 a2, Nil] -[[hash_[Cons 2,Nil 0](0)]]-> a | a has Hasher, a1 has Hash, a2 implements Hash
# Specialization lambda sets:
# @<1>: [[hash_[Cons 2,Nil 0](0)]]
#Derived.hash_[Cons 2,Nil 0] =

View File

@ -20,10 +20,10 @@ fn hash_specialization() {
r#"
app "test" provides [main] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash = \@Id n -> n
@ -43,14 +43,14 @@ fn hash_specialization_multiple_add() {
r#"
app "test" provides [main] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 has [ MHash {hash: hashId} ]
Id := U64 implements [ MHash {hash: hashId} ]
hashId = \@Id n -> n
One := {} has [ MHash {hash: hashOne} ]
One := {} implements [ MHash {hash: hashOne} ]
hashOne = \@One _ -> 1
@ -70,10 +70,10 @@ fn alias_member_specialization() {
r#"
app "test" provides [main] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash = \@Id n -> n
@ -95,13 +95,13 @@ fn ability_constrained_in_non_member_usage() {
r#"
app "test" provides [result] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
mulMHashes : a, a -> U64 | a has MHash
mulMHashes : a, a -> U64 | a implements MHash
mulMHashes = \x, y -> hash x * hash y
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash = \@Id n -> n
result = mulMHashes (@Id 5) (@Id 7)
@ -120,12 +120,12 @@ fn ability_constrained_in_non_member_usage_inferred() {
r#"
app "test" provides [result] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
mulMHashes = \x, y -> hash x * hash y
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash = \@Id n -> n
result = mulMHashes (@Id 5) (@Id 7)
@ -144,16 +144,16 @@ fn ability_constrained_in_non_member_multiple_specializations() {
r#"
app "test" provides [result] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
mulMHashes : a, b -> U64 | a has MHash, b has MHash
mulMHashes : a, b -> U64 | a implements MHash, b implements MHash
mulMHashes = \x, y -> hash x * hash y
Id := U64 has [MHash { hash: hashId }]
Id := U64 implements [MHash { hash: hashId }]
hashId = \@Id n -> n
Three := {} has [MHash { hash: hashThree }]
Three := {} implements [MHash { hash: hashThree }]
hashThree = \@Three _ -> 3
result = mulMHashes (@Id 100) (@Three {})
@ -172,15 +172,15 @@ fn ability_constrained_in_non_member_multiple_specializations_inferred() {
r#"
app "test" provides [result] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
mulMHashes = \x, y -> hash x * hash y
Id := U64 has [MHash { hash: hashId }]
Id := U64 implements [MHash { hash: hashId }]
hashId = \@Id n -> n
Three := {} has [MHash { hash: hashThree }]
Three := {} implements [MHash { hash: hashThree }]
hashThree = \@Three _ -> 3
result = mulMHashes (@Id 100) (@Three {})
@ -199,16 +199,16 @@ fn ability_used_as_type_still_compiles() {
r#"
app "test" provides [result] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
mulMHashes : MHash, MHash -> U64
mulMHashes = \x, y -> hash x * hash y
Id := U64 has [MHash { hash: hashId }]
Id := U64 implements [MHash { hash: hashId }]
hashId = \@Id n -> n
Three := {} has [MHash { hash: hashThree }]
Three := {} implements [MHash { hash: hashThree }]
hashThree = \@Three _ -> 3
result = mulMHashes (@Id 100) (@Three {})
@ -227,15 +227,15 @@ fn bounds_to_multiple_abilities() {
r#"
app "test" provides [main] to "./platform"
Idempot has idempot : a -> a | a has Idempot
Consume has consume : a -> Str | a has Consume
Idempot implements idempot : a -> a | a implements Idempot
Consume implements consume : a -> Str | a implements Consume
Hello := Str has [Idempot { idempot: idempotHello }, Consume { consume: consumeHello }]
Hello := Str implements [Idempot { idempot: idempotHello }, Consume { consume: consumeHello }]
idempotHello = \@Hello msg -> @Hello msg
consumeHello = \@Hello msg -> msg
lifecycle : a -> Str | a has Idempot & Consume
lifecycle : a -> Str | a implements Idempot & Consume
lifecycle = \x -> idempot x |> consume
main = lifecycle (@Hello "hello world")
@ -254,26 +254,26 @@ fn encode() {
r#"
app "test" provides [myU8Bytes] to "./platform"
MEncoder fmt := List U8, fmt -> List U8 | fmt has Format
MEncoder fmt := List U8, fmt -> List U8 | fmt implements Format
MEncoding has
toEncoder : val -> MEncoder fmt | val has MEncoding, fmt has Format
MEncoding implements
toEncoder : val -> MEncoder fmt | val implements MEncoding, fmt implements Format
Format has
u8 : U8 -> MEncoder fmt | fmt has Format
Format implements
u8 : U8 -> MEncoder fmt | fmt implements Format
appendWith : List U8, MEncoder fmt, fmt -> List U8 | fmt has Format
appendWith : List U8, MEncoder fmt, fmt -> List U8 | fmt implements Format
appendWith = \lst, (@MEncoder doFormat), fmt -> doFormat lst fmt
toBytes : val, fmt -> List U8 | val has MEncoding, fmt has Format
toBytes : val, fmt -> List U8 | val implements MEncoding, fmt implements Format
toBytes = \val, fmt -> appendWith [] (toEncoder val) fmt
Linear := {} has [Format {u8}]
Linear := {} implements [Format {u8}]
u8 = \n -> @MEncoder (\lst, @Linear {} -> List.append lst n)
Rgba := { r : U8, g : U8, b : U8, a : U8 } has [MEncoding {toEncoder}]
Rgba := { r : U8, g : U8, b : U8, a : U8 } implements [MEncoding {toEncoder}]
toEncoder = \@Rgba {r, g, b, a} ->
@MEncoder \lst, fmt -> lst
@ -301,19 +301,19 @@ fn decode() {
MDecodeError : [TooShort, Leftover (List U8)]
MDecoder val fmt := List U8, fmt -> { result: Result val MDecodeError, rest: List U8 } | fmt has MDecoderFormatting
MDecoder val fmt := List U8, fmt -> { result: Result val MDecodeError, rest: List U8 } | fmt implements MDecoderFormatting
MDecoding has
decoder : MDecoder val fmt | val has MDecoding, fmt has MDecoderFormatting
MDecoding implements
decoder : MDecoder val fmt | val implements MDecoding, fmt implements MDecoderFormatting
MDecoderFormatting has
u8 : MDecoder U8 fmt | fmt has MDecoderFormatting
MDecoderFormatting implements
u8 : MDecoder U8 fmt | fmt implements MDecoderFormatting
decodeWith : List U8, MDecoder val fmt, fmt -> { result: Result val MDecodeError, rest: List U8 } | fmt has MDecoderFormatting
decodeWith : List U8, MDecoder val fmt, fmt -> { result: Result val MDecodeError, rest: List U8 } | fmt implements MDecoderFormatting
decodeWith = \lst, (@MDecoder doDecode), fmt -> doDecode lst fmt
fromBytes : List U8, fmt -> Result val MDecodeError
| fmt has MDecoderFormatting, val has MDecoding
| fmt implements MDecoderFormatting, val implements MDecoding
fromBytes = \lst, fmt ->
when decodeWith lst decoder fmt is
{ result, rest } ->
@ -323,14 +323,14 @@ fn decode() {
else Err (Leftover rest)
Linear := {} has [MDecoderFormatting {u8}]
Linear := {} implements [MDecoderFormatting {u8}]
u8 = @MDecoder \lst, @Linear {} ->
when List.first lst is
Ok n -> { result: Ok n, rest: List.dropFirst lst }
Err _ -> { result: Err TooShort, rest: [] }
MyU8 := U8 has [MDecoding {decoder}]
MyU8 := U8 implements [MDecoding {decoder}]
# impl MDecoding for MyU8
decoder = @MDecoder \lst, fmt ->
@ -358,7 +358,7 @@ fn encode_use_stdlib() {
imports [Encode, Json]
provides [main] to "./platform"
HelloWorld := {} has [Encoding {toEncoder}]
HelloWorld := {} implements [Encoding {toEncoder}]
toEncoder = \@HelloWorld {} ->
Encode.custom \bytes, fmt ->
bytes
@ -386,7 +386,7 @@ fn encode_use_stdlib_without_wrapping_custom() {
imports [Encode, Json]
provides [main] to "./platform"
HelloWorld := {} has [Encoding {toEncoder}]
HelloWorld := {} implements [Encoding {toEncoder}]
toEncoder = \@HelloWorld {} -> Encode.string "Hello, World!\n"
main =
@ -411,7 +411,7 @@ fn encode_derive_to_encoder_for_opaque() {
imports [Json]
provides [main] to "./platform"
HelloWorld := { a: Str } has [Encoding]
HelloWorld := { a: Str } implements [Encoding]
main =
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld { a: "Hello, World!" }) Json.json)
@ -435,7 +435,7 @@ fn to_encoder_encode_custom_has_capture() {
imports [Encode, Json]
provides [main] to "./platform"
HelloWorld := Str has [Encoding {toEncoder}]
HelloWorld := Str implements [Encoding {toEncoder}]
toEncoder = \@HelloWorld s1 ->
Encode.custom \bytes, fmt ->
bytes
@ -881,7 +881,7 @@ fn encode_derived_generic_record_with_different_field_types() {
imports [Encode, Json]
provides [main] to "./platform"
Q a b := {a: a, b: b} has [Encoding]
Q a b := {a: a, b: b} implements [Encoding]
q = @Q {a: 10u32, b: "fieldb"}
@ -907,7 +907,7 @@ fn encode_derived_generic_tag_with_different_field_types() {
imports [Encode, Json]
provides [main] to "./platform"
Q a b := [A a, B b] has [Encoding]
Q a b := [A a, B b] implements [Encoding]
q : Q Str U32
q = @Q (B 67)
@ -934,7 +934,7 @@ fn decode_use_stdlib() {
imports [Json]
provides [main] to "./platform"
MyNum := U8 has [Decoding {decoder: myDecoder}]
MyNum := U8 implements [Decoding {decoder: myDecoder}]
myDecoder =
Decode.custom \bytes, fmt ->
@ -968,7 +968,7 @@ fn decode_derive_decoder_for_opaque() {
imports [Json]
provides [main] to "./platform"
HelloWorld := { a: Str } has [Decoding]
HelloWorld := { a: Str } implements [Decoding]
main =
when Str.toUtf8 """{"a":"Hello, World!"}""" |> Decode.fromBytes Json.json is
@ -991,7 +991,7 @@ fn decode_use_stdlib_json_list() {
imports [Json]
provides [main] to "./platform"
MyNumList := List U8 has [Decoding {decoder: myDecoder}]
MyNumList := List U8 implements [Decoding {decoder: myDecoder}]
myDecoder =
Decode.custom \bytes, fmt ->
@ -1414,7 +1414,7 @@ mod hash {
const TEST_HASHER: &str = indoc!(
r#"
THasher := List U8 has [Hasher {
THasher := List U8 implements [Hasher {
addBytes: tAddBytes,
addU8: tAddU8,
addU16: tAddU16,
@ -1947,7 +1947,7 @@ mod hash {
{}
Q := {{ a: U8, b: U8, c: U8 }} has [Hash]
Q := {{ a: U8, b: U8, c: U8 }} implements [Hash]
q = @Q {{ a: 15, b: 27, c: 31 }}
@ -2000,7 +2000,7 @@ mod eq {
r#"
app "test" provides [main] to "./platform"
LyingEq := U8 has [Eq {isEq}]
LyingEq := U8 implements [Eq {isEq}]
isEq = \@LyingEq m, @LyingEq n -> m != n
@ -2026,7 +2026,7 @@ mod eq {
r#"
app "test" provides [main] to "./platform"
Q := ({} -> Str) has [Eq {isEq: isEqQ}]
Q := ({} -> Str) implements [Eq {isEq: isEqQ}]
isEqQ = \@Q _, @Q _ -> Bool.true
@ -2046,7 +2046,7 @@ mod eq {
r#"
app "test" provides [main] to "./platform"
Q := ({} -> Str) has [Eq {isEq: isEqQ}]
Q := ({} -> Str) implements [Eq {isEq: isEqQ}]
isEqQ = \@Q f1, @Q f2 -> (f1 {} == f2 {})
@ -2080,7 +2080,7 @@ mod eq {
r#"
app "test" provides [main] to "./platform"
Q := U8 has [Eq]
Q := U8 implements [Eq]
main = (@Q 15) == (@Q 15)
"#

View File

@ -960,7 +960,7 @@ fn list_walk_implements_position() {
r#"
Option a : [Some a, None]
find : List a, a -> Option Nat | a has Eq
find : List a, a -> Option Nat | a implements Eq
find = \list, needle ->
findHelp list needle
|> .v
@ -3693,7 +3693,7 @@ fn list_walk_backwards_implements_position() {
r#"
Option a : [Some a, None]
find : List a, a -> Option Nat | a has Eq
find : List a, a -> Option Nat | a implements Eq
find = \list, needle ->
findHelp list needle
|> .v

View File

@ -891,7 +891,7 @@ fn gen_wrap_int_neq() {
assert_evals_to!(
indoc!(
r#"
wrappedNotEq : a, a -> Bool | a has Eq
wrappedNotEq : a, a -> Bool | a implements Eq
wrappedNotEq = \num1, num2 ->
num1 != num2

View File

@ -1344,10 +1344,10 @@ fn specialize_ability_call() {
r#"
app "test" provides [main] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash : Id -> U64
hash = \@Id n -> n
@ -1380,20 +1380,20 @@ fn encode() {
r#"
app "test" provides [myU8Bytes] to "./platform"
MEncoder fmt := List U8, fmt -> List U8 | fmt has Format
MEncoder fmt := List U8, fmt -> List U8 | fmt implements Format
MEncoding has
toEncoder : val -> MEncoder fmt | val has MEncoding, fmt has Format
MEncoding implements
toEncoder : val -> MEncoder fmt | val implements MEncoding, fmt implements Format
Format has
u8 : U8 -> MEncoder fmt | fmt has Format
Format implements
u8 : U8 -> MEncoder fmt | fmt implements Format
Linear := {} has [Format {u8}]
Linear := {} implements [Format {u8}]
u8 = \n -> @MEncoder (\lst, @Linear {} -> List.append lst n)
MyU8 := U8 has [MEncoding {toEncoder}]
MyU8 := U8 implements [MEncoding {toEncoder}]
toEncoder = \@MyU8 n -> u8 n
@ -2600,20 +2600,20 @@ fn unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unifica
r#"
app "test" provides [main] to "./platform"
MEncoder fmt := List U8, fmt -> List U8 | fmt has Format
MEncoder fmt := List U8, fmt -> List U8 | fmt implements Format
MEncoding has
toEncoder : val -> MEncoder fmt | val has MEncoding, fmt has Format
MEncoding implements
toEncoder : val -> MEncoder fmt | val implements MEncoding, fmt implements Format
Format has
u8 : {} -> MEncoder fmt | fmt has Format
str : {} -> MEncoder fmt | fmt has Format
tag : MEncoder fmt -> MEncoder fmt | fmt has Format
Format implements
u8 : {} -> MEncoder fmt | fmt implements Format
str : {} -> MEncoder fmt | fmt implements Format
tag : MEncoder fmt -> MEncoder fmt | fmt implements Format
Linear := {} has [Format {u8: lU8, str: lStr, tag: lTag}]
Linear := {} implements [Format {u8: lU8, str: lStr, tag: lTag}]
MU8 := U8 has [MEncoding {toEncoder: toEncoderU8}]
MStr := Str has [MEncoding {toEncoder: toEncoderStr}]
MU8 := U8 implements [MEncoding {toEncoder: toEncoderU8}]
MStr := Str implements [MEncoding {toEncoder: toEncoderStr}]
Q a b := { a: a, b: b }
@ -2663,7 +2663,7 @@ fn unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unifica
r#"
app "test" imports [Json] provides [main] to "./platform"
Q a b := { a: a, b: b } has [Encoding {toEncoder: toEncoderQ}]
Q a b := { a: a, b: b } implements [Encoding {toEncoder: toEncoderQ}]
toEncoderQ =
\@Q t -> Encode.custom \bytes, fmt ->
@ -2701,7 +2701,7 @@ fn unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_ty
r#"
app "test" imports [Json] provides [main] to "./platform"
Q a b := { a: a, b: b } has [Encoding {toEncoder: toEncoderQ}]
Q a b := { a: a, b: b } implements [Encoding {toEncoder: toEncoderQ}]
toEncoderQ =
\@Q t -> Encode.custom \bytes, fmt ->

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
"#

View File

@ -1,7 +1,7 @@
# +opt infer:print_only_under_alias
app "test" provides [main] to "./platform"
F a : a | a has Hash
F a : a | a implements Hash
main : F a -> F a
#^^^^{-1} a -[[main(0)]]-> a | a has Hash
#^^^^{-1} a -[[main(0)]]-> a | a implements Hash

View File

@ -1,7 +1,7 @@
# +opt infer:print_only_under_alias
app "test" provides [main] to "./platform"
F a : a | a has Hash & Eq & Decoding
F a : a | a implements Hash & Eq & Decoding
main : F a -> F a
#^^^^{-1} a -[[main(0)]]-> a | a has Hash & Decoding & Eq
#^^^^{-1} a -[[main(0)]]-> a | a implements Hash & Decoding & Eq

View File

@ -1,8 +1,8 @@
app "test" provides [main] to "./platform"
f : x -> x | x has Hash
g : x -> x | x has Decoding & Encoding
f : x -> x | x implements Hash
g : x -> x | x implements Decoding & Encoding
main : x -> x | x has Hash & Decoding & Encoding
main : x -> x | x implements Hash & Decoding & Encoding
main = \x -> x |> f |> g
#^^^^{-1} x -[[main(0)]]-> x | x has Hash & Encoding & Decoding
#^^^^{-1} x -[[main(0)]]-> x | x implements Hash & Encoding & Decoding

View File

@ -1,6 +1,6 @@
app "test" provides [top] to "./platform"
MDict u := (List u) | u has Hash & Eq
MDict u := (List u) | u implements Hash & Eq
bot : MDict k -> MDict k
bot = \@MDict data ->
@ -9,4 +9,4 @@ bot = \@MDict data ->
top : MDict v -> MDict v
top = \x -> bot x
#^^^{-1} MDict v -[[top(0)]]-> MDict v | v has Hash & Eq
#^^^{-1} MDict v -[[top(0)]]-> MDict v | v implements Hash & Eq

View File

@ -1,6 +1,6 @@
app "test" provides [isEqQ] to "./platform"
Q := [ F (Str -> Str), G ] has [Eq { isEq: isEqQ }]
Q := [ F (Str -> Str), G ] implements [Eq { isEq: isEqQ }]
isEqQ = \@Q q1, @Q q2 -> when T q1 q2 is
#^^^^^{-1} Q, Q -[[isEqQ(0)]]-> Bool

View File

@ -1,7 +1,7 @@
# +opt infer:print_only_under_alias
app "test" provides [main] to "./platform"
Q := ({} -> Str) has [Eq {isEq: isEqQ}]
Q := ({} -> Str) implements [Eq {isEq: isEqQ}]
isEqQ = \@Q f1, @Q f2 -> (f1 {} == f2 {})
#^^^^^{-1} ({} -[[]]-> Str), ({} -[[]]-> Str) -[[isEqQ(2)]]-> [False, True]

View File

@ -2,19 +2,19 @@ app "test" provides [myU8] to "./platform"
MDecodeError : [TooShort, Leftover (List U8)]
MDecoder val fmt := List U8, fmt -> { result: Result val MDecodeError, rest: List U8 } | fmt has MDecoderFormatting
MDecoder val fmt := List U8, fmt -> { result: Result val MDecodeError, rest: List U8 } | fmt implements MDecoderFormatting
MDecoding has
decoder : MDecoder val fmt | val has MDecoding, fmt has MDecoderFormatting
decoder : MDecoder val fmt | val has MDecoding, fmt implements MDecoderFormatting
MDecoderFormatting has
u8 : MDecoder U8 fmt | fmt has MDecoderFormatting
u8 : MDecoder U8 fmt | fmt implements MDecoderFormatting
decodeWith : List U8, MDecoder val fmt, fmt -> { result: Result val MDecodeError, rest: List U8 } | fmt has MDecoderFormatting
decodeWith : List U8, MDecoder val fmt, fmt -> { result: Result val MDecodeError, rest: List U8 } | fmt implements MDecoderFormatting
decodeWith = \lst, (@MDecoder doDecode), fmt -> doDecode lst fmt
fromBytes : List U8, fmt -> Result val MDecodeError
| fmt has MDecoderFormatting, val has MDecoding
| fmt has MDecoderFormatting, val implements MDecoding
fromBytes = \lst, fmt ->
when decodeWith lst decoder fmt is
{ result, rest } ->
@ -23,7 +23,7 @@ fromBytes = \lst, fmt ->
Err e -> Err e
Linear := {} has [MDecoderFormatting {u8}]
Linear := {} implements [MDecoderFormatting {u8}]
u8 = @MDecoder \lst, @Linear {} ->
#^^{-1} Linear#u8(11): MDecoder U8 Linear
@ -31,10 +31,10 @@ u8 = @MDecoder \lst, @Linear {} ->
Ok n -> { result: Ok n, rest: List.dropFirst lst }
Err _ -> { result: Err TooShort, rest: [] }
MyU8 := U8 has [MDecoding {decoder}]
MyU8 := U8 implements [MDecoding {decoder}]
decoder = @MDecoder \lst, fmt ->
#^^^^^^^{-1} MyU8#decoder(12): MDecoder MyU8 fmt | fmt has MDecoderFormatting
#^^^^^^^{-1} MyU8#decoder(12): MDecoder MyU8 fmt | fmt implements MDecoderFormatting
when decodeWith lst u8 fmt is
{ result, rest } ->
{ result: Result.map result (\n -> @MyU8 n), rest }

View File

@ -1,29 +1,29 @@
app "test" provides [myU8Bytes] to "./platform"
MEncoder fmt := List U8, fmt -> List U8 | fmt has Format
MEncoder fmt := List U8, fmt -> List U8 | fmt implements Format
MEncoding has
toEncoder : val -> MEncoder fmt | val has MEncoding, fmt has Format
toEncoder : val -> MEncoder fmt | val has MEncoding, fmt implements Format
Format has
u8 : U8 -> MEncoder fmt | fmt has Format
u8 : U8 -> MEncoder fmt | fmt implements Format
appendWith : List U8, MEncoder fmt, fmt -> List U8 | fmt has Format
appendWith : List U8, MEncoder fmt, fmt -> List U8 | fmt implements Format
appendWith = \lst, (@MEncoder doFormat), fmt -> doFormat lst fmt
toBytes : val, fmt -> List U8 | val has MEncoding, fmt has Format
toBytes : val, fmt -> List U8 | val has MEncoding, fmt implements Format
toBytes = \val, fmt -> appendWith [] (toEncoder val) fmt
Linear := {} has [Format {u8}]
Linear := {} implements [Format {u8}]
u8 = \n -> @MEncoder (\lst, @Linear {} -> List.append lst n)
#^^{-1} Linear#u8(10): U8 -[[u8(10)]]-> MEncoder Linear
MyU8 := U8 has [MEncoding {toEncoder}]
MyU8 := U8 implements [MEncoding {toEncoder}]
toEncoder = \@MyU8 n -> u8 n
#^^^^^^^^^{-1} MyU8#toEncoder(11): MyU8 -[[toEncoder(11)]]-> MEncoder fmt | fmt has Format
#^^^^^^^^^{-1} MyU8#toEncoder(11): MyU8 -[[toEncoder(11)]]-> MEncoder fmt | fmt implements Format
myU8Bytes = toBytes (@MyU8 15) (@Linear {})
#^^^^^^^^^{-1} List U8

View File

@ -3,4 +3,4 @@ app "test" provides [main] to "./platform"
main : Decoder Bool _
main = Decode.custom \bytes, fmt ->
Decode.decodeWith bytes Decode.decoder fmt
# ^^^^^^^^^^^^^^ Decoding#Decode.decoder(4): Decoder Bool fmt | fmt has DecoderFormatting
# ^^^^^^^^^^^^^^ Decoding#Decode.decoder(4): Decoder Bool fmt | fmt implements DecoderFormatting

View File

@ -2,4 +2,4 @@ app "test" provides [main] to "./platform"
main =
\h -> Hash.hash h Bool.true
# ^^^^^^^^^ Hash#Hash.hash(1): a, Bool -[[Hash.hashBool(9)]]-> a | a has Hasher
# ^^^^^^^^^ Hash#Hash.hash(1): a, Bool -[[Hash.hashBool(9)]]-> a | a implements Hasher

View File

@ -1,4 +1,4 @@
app "test" provides [main] to "./platform"
main = Encode.toEncoder Bool.true
# ^^^^^^^^^^^^^^^^ Encoding#Encode.toEncoder(2): Bool -[[] + fmt:Encode.bool(17):1]-> Encoder fmt | fmt has EncoderFormatting
# ^^^^^^^^^^^^^^^^ Encoding#Encode.toEncoder(2): Bool -[[] + fmt:Encode.bool(17):1]-> Encoder fmt | fmt implements EncoderFormatting

View File

@ -1,9 +1,9 @@
# +opt infer:print_only_under_alias
app "test" provides [main] to "./platform"
N := U8 has [Decoding]
N := U8 implements [Decoding]
main : Decoder N _
main = Decode.custom \bytes, fmt ->
Decode.decodeWith bytes Decode.decoder fmt
# ^^^^^^^^^^^^^^ N#Decode.decoder(3): List U8, fmt -[[7]]-> { rest : List U8, result : [Err [TooShort], Ok U8] } | fmt has DecoderFormatting
# ^^^^^^^^^^^^^^ N#Decode.decoder(3): List U8, fmt -[[7]]-> { rest : List U8, result : [Err [TooShort], Ok U8] } | fmt implements DecoderFormatting

View File

@ -1,6 +1,6 @@
app "test" provides [main] to "./platform"
N := U8 has [Encoding]
N := U8 implements [Encoding]
main = Encode.toEncoder (@N 15)
# ^^^^^^^^^^^^^^^^ N#Encode.toEncoder(3): N -[[#N_toEncoder(3)]]-> Encoder fmt | fmt has EncoderFormatting
# ^^^^^^^^^^^^^^^^ N#Encode.toEncoder(3): N -[[#N_toEncoder(3)]]-> Encoder fmt | fmt implements EncoderFormatting

View File

@ -1,6 +1,6 @@
app "test" provides [main] to "./platform"
Trivial := {} has [Eq {isEq}]
Trivial := {} implements [Eq {isEq}]
isEq = \@Trivial {}, @Trivial {} -> Bool.true

View File

@ -1,6 +1,6 @@
app "test" provides [main] to "./platform"
N := U8 has [Eq]
N := U8 implements [Eq]
main = Bool.isEq (@N 15) (@N 23)
# ^^^^^^^^^ N#Bool.isEq(3): N, N -[[#N_isEq(3)]]-> Bool

View File

@ -1,8 +1,8 @@
app "test" provides [main] to "./platform"
Noop := {} has [Hash {hash}]
Noop := {} implements [Hash {hash}]
hash = \hasher, @Noop {} -> hasher
main = \hasher -> hash hasher (@Noop {})
#^^^^{-1} hasher -[[main(0)]]-> hasher | hasher has Hasher
#^^^^{-1} hasher -[[main(0)]]-> hasher | hasher implements Hasher

View File

@ -1,6 +1,6 @@
app "test" provides [main] to "./platform"
N := U8 has [Hash]
N := U8 implements [Hash]
main = \hasher, @N n -> Hash.hash hasher (@N n)
# ^^^^^^^^^ N#Hash.hash(3): a, N -[[#N_hash(3)]]-> a | a has Hasher
# ^^^^^^^^^ N#Hash.hash(3): a, N -[[#N_hash(3)]]-> a | a implements Hasher

View File

@ -1,13 +1,13 @@
app "test" provides [main] to "./platform"
F has f : a -> (b -> {}) | a has F, b has G
G has g : b -> {} | b has G
F has f : a -> (b -> {}) | a has F, b implements G
G has g : b -> {} | b implements G
Fo := {} has [F {f}]
Fo := {} implements [F {f}]
f = \@Fo {} -> g
#^{-1} Fo#f(7): Fo -[[f(7)]]-> (b -[[] + b:g(4):1]-> {}) | b has G
#^{-1} Fo#f(7): Fo -[[f(7)]]-> (b -[[] + b:g(4):1]-> {}) | b implements G
Go := {} has [G {g}]
Go := {} implements [G {g}]
g = \@Go {} -> {}
#^{-1} Go#g(8): Go -[[g(8)]]-> {}

View File

@ -1,13 +1,13 @@
app "test" provides [main] to "./platform"
F has f : a -> ({} -> b) | a has F, b has G
G has g : {} -> b | b has G
F has f : a -> ({} -> b) | a has F, b implements G
G has g : {} -> b | b implements G
Fo := {} has [F {f}]
Fo := {} implements [F {f}]
f = \@Fo {} -> g
#^{-1} Fo#f(7): Fo -[[f(7)]]-> ({} -[[] + b:g(4):1]-> b) | b has G
#^{-1} Fo#f(7): Fo -[[f(7)]]-> ({} -[[] + b:g(4):1]-> b) | b implements G
Go := {} has [G {g}]
Go := {} implements [G {g}]
g = \{} -> @Go {}
#^{-1} Go#g(8): {} -[[g(8)]]-> Go

View File

@ -1,15 +1,15 @@
app "test" provides [f] to "./platform"
J has j : j -> (k -> {}) | j has J, k has K
K has k : k -> {} | k has K
J has j : j -> (k -> {}) | j has J, k implements K
K has k : k -> {} | k implements K
C := {} has [J {j: jC}]
C := {} implements [J {j: jC}]
jC = \@C _ -> k
D := {} has [J {j: jD}]
D := {} implements [J {j: jD}]
jD = \@D _ -> k
E := {} has [K {k}]
E := {} implements [K {k}]
k = \@E _ -> {}
f = \flag, a, c ->
@ -18,5 +18,5 @@ f = \flag, a, c ->
A -> j a
B -> j a
it c
# ^ k | k has K
# ^^ k -[[] + j:j(2):2]-> {} | j has J, k has K
# ^ k | k implements K
# ^^ k -[[] + j:j(2):2]-> {} | j has J, k implements K

View File

@ -1,32 +1,32 @@
app "test" provides [main] to "./platform"
J has j : j -> (k -> {}) | j has J, k has K
K has k : k -> {} | k has K
J has j : j -> (k -> {}) | j has J, k implements K
K has k : k -> {} | k implements K
C := {} has [J {j: jC}]
C := {} implements [J {j: jC}]
jC = \@C _ -> k
#^^{-1} C -[[jC(8)]]-> (k -[[] + k:k(4):1]-> {}) | k has K
#^^{-1} C -[[jC(8)]]-> (k -[[] + k:k(4):1]-> {}) | k implements K
D := {} has [J {j: jD}]
D := {} implements [J {j: jD}]
jD = \@D _ -> k
#^^{-1} D -[[jD(9)]]-> (k -[[] + k:k(4):1]-> {}) | k has K
#^^{-1} D -[[jD(9)]]-> (k -[[] + k:k(4):1]-> {}) | k implements K
E := {} has [K {k}]
E := {} implements [K {k}]
k = \@E _ -> {}
#^{-1} E#k(10): E -[[k(10)]]-> {}
f = \flag, a, b ->
# ^ j | j has J
# ^ j | j has J
# ^ j | j implements J
# ^ j | j implements J
it =
# ^^ k -[[] + j:j(2):2 + j1:j(2):2]-> {} | j has J, j1 has J, k has K
# ^^ k -[[] + j:j(2):2 + j1:j(2):2]-> {} | j has J, j1 has J, k implements K
when flag is
A -> j a
# ^ J#j(2): j -[[] + j:j(2):1]-> (k -[[] + j:j(2):2 + j1:j(2):2]-> {}) | j has J, j1 has J, k has K
# ^ J#j(2): j -[[] + j:j(2):1]-> (k -[[] + j:j(2):2 + j1:j(2):2]-> {}) | j has J, j1 has J, k implements K
B -> j b
# ^ J#j(2): j -[[] + j:j(2):1]-> (k -[[] + j1:j(2):2 + j:j(2):2]-> {}) | j has J, j1 has J, k has K
# ^ J#j(2): j -[[] + j:j(2):1]-> (k -[[] + j1:j(2):2 + j:j(2):2]-> {}) | j has J, j1 has J, k implements K
it
# ^^ k -[[] + j:j(2):2 + j1:j(2):2]-> {} | j has J, j1 has J, k has K
# ^^ k -[[] + j:j(2):2 + j1:j(2):2]-> {} | j has J, j1 has J, k implements K
main = (f A (@C {}) (@D {})) (@E {})
# ^ [A, B], C, D -[[f(11)]]-> (E -[[k(10)]]-> {})

View File

@ -1,43 +1,43 @@
app "test" provides [main] to "./platform"
J has j : j -> (k -> {}) | j has J, k has K
K has k : k -> {} | k has K
J has j : j -> (k -> {}) | j has J, k implements K
K has k : k -> {} | k implements K
C := {} has [J {j: jC}]
C := {} implements [J {j: jC}]
jC = \@C _ -> k
#^^{-1} C -[[jC(9)]]-> (k -[[] + k:k(4):1]-> {}) | k has K
#^^{-1} C -[[jC(9)]]-> (k -[[] + k:k(4):1]-> {}) | k implements K
D := {} has [J {j: jD}]
D := {} implements [J {j: jD}]
jD = \@D _ -> k
#^^{-1} D -[[jD(10)]]-> (k -[[] + k:k(4):1]-> {}) | k has K
#^^{-1} D -[[jD(10)]]-> (k -[[] + k:k(4):1]-> {}) | k implements K
E := {} has [K {k: kE}]
E := {} implements [K {k: kE}]
kE = \@E _ -> {}
#^^{-1} E -[[kE(11)]]-> {}
F := {} has [K {k: kF}]
F := {} implements [K {k: kF}]
kF = \@F _ -> {}
#^^{-1} F -[[kF(12)]]-> {}
f = \flag, a, b ->
# ^ j | j has J
# ^ j | j has J
# ^ j | j implements J
# ^ j | j implements J
it =
# ^^ k -[[] + j:j(2):2 + j1:j(2):2]-> {} | j has J, j1 has J, k has K
# ^^ k -[[] + j:j(2):2 + j1:j(2):2]-> {} | j has J, j1 has J, k implements K
when flag is
A -> j a
# ^ J#j(2): j -[[] + j:j(2):1]-> (k -[[] + j:j(2):2 + j1:j(2):2]-> {}) | j has J, j1 has J, k has K
# ^ J#j(2): j -[[] + j:j(2):1]-> (k -[[] + j:j(2):2 + j1:j(2):2]-> {}) | j has J, j1 has J, k implements K
B -> j b
# ^ J#j(2): j -[[] + j:j(2):1]-> (k -[[] + j1:j(2):2 + j:j(2):2]-> {}) | j has J, j1 has J, k has K
# ^ J#j(2): j -[[] + j:j(2):1]-> (k -[[] + j1:j(2):2 + j:j(2):2]-> {}) | j has J, j1 has J, k implements K
it
# ^^ k -[[] + j:j(2):2 + j1:j(2):2]-> {} | j has J, j1 has J, k has K
# ^^ k -[[] + j:j(2):2 + j1:j(2):2]-> {} | j has J, j1 has J, k implements K
main =
#^^^^{-1} {}
it = \x ->
# ^^ k -[[it(21)]]-> {} | k has K
# ^^ k -[[it(21)]]-> {} | k implements K
(f A (@C {}) (@D {})) x
# ^ [A, B], C, D -[[f(13)]]-> (k -[[] + k:k(4):1]-> {}) | k has K
# ^ [A, B], C, D -[[f(13)]]-> (k -[[] + k:k(4):1]-> {}) | k implements K
if Bool.true
then it (@E {})
# ^^ E -[[it(21)]]-> {}

View File

@ -1,13 +1,13 @@
app "test" provides [main] to "./platform"
F has f : a, b -> ({} -> ({} -> {})) | a has F, b has G
G has g : b -> ({} -> {}) | b has G
F has f : a, b -> ({} -> ({} -> {})) | a has F, b implements G
G has g : b -> ({} -> {}) | b implements G
Fo := {} has [F {f}]
Fo := {} implements [F {f}]
f = \@Fo {}, b -> \{} -> g b
#^{-1} Fo#f(7): Fo, b -[[f(7)]]-> ({} -[[13 b]]-> ({} -[[] + b:g(4):2]-> {})) | b has G
#^{-1} Fo#f(7): Fo, b -[[f(7)]]-> ({} -[[13 b]]-> ({} -[[] + b:g(4):2]-> {})) | b implements G
Go := {} has [G {g}]
Go := {} implements [G {g}]
g = \@Go {} -> \{} -> {}
#^{-1} Go#g(8): Go -[[g(8)]]-> ({} -[[14]]-> {})

View File

@ -1,13 +1,13 @@
app "test" provides [main] to "./platform"
F has f : a -> (b -> {}) | a has F, b has G
G has g : b -> {} | b has G
F has f : a -> (b -> {}) | a has F, b implements G
G has g : b -> {} | b implements G
Fo := {} has [F {f}]
Fo := {} implements [F {f}]
f = \@Fo {} -> g
#^{-1} Fo#f(7): Fo -[[f(7)]]-> (b -[[] + b:g(4):1]-> {}) | b has G
#^{-1} Fo#f(7): Fo -[[f(7)]]-> (b -[[] + b:g(4):1]-> {}) | b implements G
Go := {} has [G {g}]
Go := {} implements [G {g}]
g = \@Go {} -> {}
#^{-1} Go#g(8): Go -[[g(8)]]-> {}

View File

@ -1,19 +1,19 @@
app "test" provides [main] to "./platform"
F has f : a -> (b -> {}) | a has F, b has G
G has g : b -> {} | b has G
F has f : a -> (b -> {}) | a has F, b implements G
G has g : b -> {} | b implements G
Fo := {} has [F {f}]
Fo := {} implements [F {f}]
f = \@Fo {} -> g
#^{-1} Fo#f(7): Fo -[[f(7)]]-> (b -[[] + b:g(4):1]-> {}) | b has G
#^{-1} Fo#f(7): Fo -[[f(7)]]-> (b -[[] + b:g(4):1]-> {}) | b implements G
Go := {} has [G {g}]
Go := {} implements [G {g}]
g = \@Go {} -> {}
#^{-1} Go#g(8): Go -[[g(8)]]-> {}
main =
#^^^^{-1} b -[[] + b:g(4):1]-> {} | b has G
#^^^^{-1} b -[[] + b:g(4):1]-> {} | b implements G
h = f (@Fo {})
# ^ Fo#f(7): Fo -[[f(7)]]-> (b -[[] + b:g(4):1]-> {}) | b has G
# ^ b -[[] + b:g(4):1]-> {} | b has G
# ^ Fo#f(7): Fo -[[f(7)]]-> (b -[[] + b:g(4):1]-> {}) | b implements G
# ^ b -[[] + b:g(4):1]-> {} | b implements G
h

View File

@ -2,4 +2,4 @@ app "test" provides [main] to "./platform"
main =
\h -> Hash.hash h 7
# ^^^^^^^^^ Hash#Hash.hash(1): a, I64 -[[Hash.hashI64(13)]]-> a | a has Hasher
# ^^^^^^^^^ Hash#Hash.hash(1): a, I64 -[[Hash.hashI64(13)]]-> a | a implements Hasher

View File

@ -3,4 +3,4 @@ app "test"
provides [main] to "./platform"
main = toEncoder { a: "" }
# ^^^^^^^^^ Encoding#toEncoder(2): { a : Str } -[[#Derived.toEncoder_{a}(0)]]-> Encoder fmt | fmt has EncoderFormatting
# ^^^^^^^^^ Encoding#toEncoder(2): { a : Str } -[[#Derived.toEncoder_{a}(0)]]-> Encoder fmt | fmt implements EncoderFormatting

View File

@ -2,8 +2,8 @@ app "test"
imports [Encode.{ toEncoder, custom }]
provides [main] to "./platform"
A := {} has [Encoding {toEncoder}]
A := {} implements [Encoding {toEncoder}]
toEncoder = \@A _ -> custom \b, _ -> b
main = toEncoder { a: @A {} }
# ^^^^^^^^^ Encoding#toEncoder(2): { a : A } -[[#Derived.toEncoder_{a}(0)]]-> Encoder fmt | fmt has EncoderFormatting
# ^^^^^^^^^ Encoding#toEncoder(2): { a : A } -[[#Derived.toEncoder_{a}(0)]]-> Encoder fmt | fmt implements EncoderFormatting

View File

@ -1,9 +1,9 @@
app "test" provides [main] to "./platform"
Id1 has id1 : a -> a | a has Id1
Id2 has id2 : a -> a | a has Id2
Id1 has id1 : a -> a | a implements Id1
Id2 has id2 : a -> a | a implements Id2
A := {} has [Id1 {id1}, Id2 {id2}]
A := {} implements [Id1 {id1}, Id2 {id2}]
id1 = \@A {} -> @A {}
#^^^{-1} A#id1(6): A -[[id1(6)]]-> A

View File

@ -1,8 +1,8 @@
app "test" provides [main] to "./platform"
Id has id : a -> a | a has Id
Id has id : a -> a | a implements Id
A := {} has [Id {id}]
A := {} implements [Id {id}]
id = \@A {} -> @A {}
#^^{-1} A#id(4): A -[[id(4)]]-> A

View File

@ -1,8 +1,8 @@
app "test" provides [main] to "./platform"
Id has id : a -> a | a has Id
Id has id : a -> a | a implements Id
A := {} has [Id {id}]
A := {} implements [Id {id}]
id = \@A {} -> @A {}
#^^{-1} A#id(4): A -[[id(4)]]-> A

View File

@ -1,16 +1,16 @@
app "test" provides [main] to "./platform"
Id has id : a -> a | a has Id
Id has id : a -> a | a implements Id
A := {} has [Id {id}]
A := {} implements [Id {id}]
id = \@A {} -> @A {}
#^^{-1} A#id(4): A -[[id(4)]]-> A
main =
alias1 = \x -> id x
# ^^ Id#id(2): a -[[] + a:id(2):1]-> a | a has Id
# ^^ Id#id(2): a -[[] + a:id(2):1]-> a | a implements Id
alias2 = \x -> alias1 x
# ^^^^^^ a -[[alias1(6)]]-> a | a has Id
# ^^^^^^ a -[[alias1(6)]]-> a | a implements Id
a : A
a = alias2 (@A {})

View File

@ -1,8 +1,8 @@
app "test" provides [main] to "./platform"
Id has id : a -> a | a has Id
Id has id : a -> a | a implements Id
A := {} has [Id {id}]
A := {} implements [Id {id}]
id = \@A {} -> @A {}
#^^{-1} A#id(4): A -[[id(4)]]-> A

View File

@ -1,10 +1,10 @@
app "test" provides [main] to "./platform"
Bounce has
ping : a -> a | a has Bounce
pong : a -> a | a has Bounce
ping : a -> a | a implements Bounce
pong : a -> a | a implements Bounce
A := {} has [Bounce {ping: pingA, pong: pongA}]
A := {} implements [Bounce {ping: pingA, pong: pongA}]
pingA = \@A {} -> pong (@A {})
# ^^^^ A#pong(6): A -[[pongA(6)]]-> A

View File

@ -1,10 +1,10 @@
app "test" provides [main] to "./platform"
Bounce has
ping : a -> a | a has Bounce
pong : a -> a | a has Bounce
ping : a -> a | a implements Bounce
pong : a -> a | a implements Bounce
A := {} has [Bounce {ping, pong}]
A := {} implements [Bounce {ping, pong}]
ping = \@A {} -> pong (@A {})
# ^^^^ A#pong(6): A -[[pong(6)]]-> A

View File

@ -1,8 +1,8 @@
app "test" provides [main] to "./platform"
Diverge has diverge : a -> a | a has Diverge
Diverge has diverge : a -> a | a implements Diverge
A := {} has [Diverge {diverge}]
A := {} implements [Diverge {diverge}]
diverge : A -> A
diverge = \@A {} -> diverge (@A {})

View File

@ -3,9 +3,9 @@ app "test" provides [main] to "./platform"
Thunk a : {} -> a
Id has id : a -> Thunk a | a has Id
Id has id : a -> Thunk a | a implements Id
A := {} has [Id {id}]
A := {} implements [Id {id}]
id = \@A {} -> \{} -> @A {}
#^^{-1} A#id(5): {} -[[id(5)]]-> ({} -[[8]]-> {})

View File

@ -3,15 +3,15 @@ app "test" provides [main] to "./platform"
Thunk a : {} -> a
Id has id : a -> Thunk a | a has Id
Id has id : a -> Thunk a | a implements Id
A := {} has [Id {id}]
A := {} implements [Id {id}]
id = \@A {} -> \{} -> @A {}
#^^{-1} A#id(5): {} -[[id(5)]]-> ({} -[[8]]-> {})
main =
alias = \x -> id x
# ^^ Id#id(3): a -[[] + a:id(3):1]-> ({} -[[] + a:id(3):2]-> a) | a has Id
# ^^ Id#id(3): a -[[] + a:id(3):1]-> ({} -[[] + a:id(3):2]-> a) | a implements Id
a : A
a = (alias (@A {})) {}

View File

@ -3,9 +3,9 @@ app "test" provides [main] to "./platform"
Thunk a := {} -> a
Id has id : a -> Thunk a | a has Id
Id has id : a -> Thunk a | a implements Id
A := {} has [Id {id}]
A := {} implements [Id {id}]
id = \@A {} -> @Thunk (\{} -> @A {})
#^^{-1} A#id(5): {} -[[id(5)]]-> ({} -[[8]]-> {})

View File

@ -1,8 +1,8 @@
app "test" provides [main] to "./platform"
Default has default : {} -> a | a has Default
Default has default : {} -> a | a implements Default
A := {} has [Default {default}]
A := {} implements [Default {default}]
default = \{} -> @A {}
main =

View File

@ -1,19 +1,19 @@
app "test" provides [main] to "./platform"
X has
consume : a -> {} | a has X
consume : a -> {} | a implements X
O := {} has [X {consume: consumeO}]
O := {} implements [X {consume: consumeO}]
consumeO = \@O {} -> {}
P := {} has [X {consume: consumeP}]
P := {} implements [X {consume: consumeP}]
consumeP = \@P {} -> {}
caller = \x -> consume x
# ^ a | a has X
# ^^^^^^^ X#consume(2): a -[[] + a:consume(2):1]-> {} | a has X
# ^ a | a implements X
# ^^^^^^^ X#consume(2): a -[[] + a:consume(2):1]-> {} | a implements X
main = {
a: caller (@O {}),

View File

@ -1,9 +1,9 @@
app "test" provides [hash] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash : Id -> U64
#^^^^{-1} Id#hash(3): Id -[[hash(3)]]-> U64

View File

@ -1,9 +1,9 @@
app "test" provides [hash] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash : Id -> U64
hash = \@Id n -> n

View File

@ -1,8 +1,8 @@
app "test" provides [hashEq] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
hashEq : a, a -> Bool | a has MHash
hashEq : a, a -> Bool | a implements MHash
hashEq = \x, y -> hash x == hash y
#^^^^^^{-1} a, a -[[hashEq(0)]]-> Bool | a has MHash
#^^^^^^{-1} a, a -[[hashEq(0)]]-> Bool | a implements MHash

View File

@ -1,7 +1,7 @@
app "test" provides [hashEq] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
hashEq = \x, y -> hash x == hash y
#^^^^^^{-1} a, a1 -[[hashEq(0)]]-> Bool | a has MHash, a1 has MHash
#^^^^^^{-1} a, a1 -[[hashEq(0)]]-> Bool | a implements MHash, a1 implements MHash

View File

@ -1,11 +1,11 @@
app "test" provides [result] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
hashEq = \x, y -> hash x == hash y
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash = \@Id n -> n
result = hashEq (@Id 100) (@Id 101)

View File

@ -1,14 +1,14 @@
app "test" provides [result] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
mulMHashes = \x, y -> hash x * hash y
Id := U64 has [MHash { hash: hashId }]
Id := U64 implements [MHash { hash: hashId }]
hashId = \@Id n -> n
Three := {} has [MHash { hash: hashThree }]
Three := {} implements [MHash { hash: hashThree }]
hashThree = \@Three _ -> 3
result = mulMHashes (@Id 100) (@Three {})

View File

@ -1,9 +1,9 @@
app "test" provides [zero] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash = \@Id n -> n

View File

@ -1,9 +1,9 @@
app "test" provides [thething] to "./platform"
MHash has
hash : a -> U64 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
thething =
#^^^^^^^^{-1} a -[[] + a:hash(2):1]-> U64 | a has MHash
#^^^^^^^^{-1} a -[[] + a:hash(2):1]-> U64 | a implements MHash
itis = hash
itis

View File

@ -1,8 +1,8 @@
app "test" provides [zeroEncoder] to "./platform"
MEncoder fmt := List U8, fmt -> List U8 | fmt has Format
MEncoder fmt := List U8, fmt -> List U8 | fmt implements Format
Format has it : fmt -> {} | fmt has Format
Format implements it : fmt -> {} | fmt implements Format
zeroEncoder = @MEncoder \lst, _ -> lst
#^^^^^^^^^^^{-1} MEncoder a | a has Format
#^^^^^^^^^^^{-1} MEncoder a | a implements Format

View File

@ -1,6 +1,6 @@
app "test" provides [main] to "./platform"
MHash has hash : a -> U64 | a has MHash
MHash implements hash : a -> U64 | a implements MHash
main = hash
# ^^^^ MHash#hash(2): a -[[] + a:hash(2):1]-> U64 | a has MHash
# ^^^^ MHash#hash(2): a -[[] + a:hash(2):1]-> U64 | a implements MHash

View File

@ -1,14 +1,14 @@
app "test" provides [hash, hash32, eq, le] to "./platform"
MHash has
hash : a -> U64 | a has MHash
hash32 : a -> U32 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
hash32 : a -> U32 | a implements MHash
Ord has
eq : a, a -> Bool | a has Ord
le : a, a -> Bool | a has Ord
Ord implements
eq : a, a -> Bool | a implements Ord
le : a, a -> Bool | a implements Ord
Id := U64 has [MHash {hash, hash32}, Ord {eq, le}]
Id := U64 implements [MHash {hash, hash32}, Ord {eq, le}]
hash = \@Id n -> n
#^^^^{-1} Id#hash(7): Id -[[hash(7)]]-> U64

View File

@ -1,10 +1,10 @@
app "test" provides [hash, hash32] to "./platform"
MHash has
hash : a -> U64 | a has MHash
hash32 : a -> U32 | a has MHash
MHash implements
hash : a -> U64 | a implements MHash
hash32 : a -> U32 | a implements MHash
Id := U64 has [MHash {hash, hash32}]
Id := U64 implements [MHash {hash, hash32}]
hash = \@Id n -> n
#^^^^{-1} Id#hash(4): Id -[[hash(4)]]-> U64

View File

@ -1,8 +1,8 @@
app "test" provides [hash] to "./platform"
MHash has hash : a -> U64 | a has MHash
MHash implements hash : a -> U64 | a implements MHash
Id := U64 has [MHash {hash}]
Id := U64 implements [MHash {hash}]
hash = \@Id n -> n
#^^^^{-1} Id#hash(3): Id -[[hash(3)]]-> U64

View File

@ -2,7 +2,7 @@ app "test"
imports [Json]
provides [main] to "./platform"
HelloWorld := {} has [Encoding {toEncoder}]
HelloWorld := {} implements [Encoding {toEncoder}]
toEncoder = \@HelloWorld {} ->
Encode.custom \bytes, fmt ->

View File

@ -8830,7 +8830,7 @@ In roc, functions are always written as a lambda, like{}
r#"
app "test" provides [hash] to "./platform"
MHash has
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 implements [MHash {hash}]
@ -8864,7 +8864,7 @@ In roc, functions are always written as a lambda, like{}
r#"
app "test" provides [noGoodVeryBadTerrible] to "./platform"
MHash has
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 implements [MHash {hash}]
@ -8912,7 +8912,7 @@ In roc, functions are always written as a lambda, like{}
app "test" provides [main] to "./platform"
main =
MHash has
MHash implements
hash : a -> U64 | a implements MHash
123
@ -8923,7 +8923,7 @@ In roc, functions are always written as a lambda, like{}
This ability definition is not on the top-level of a module:
4> MHash has
4> MHash implements
5> hash : a -> U64 | a implements MHash
Abilities can only be defined on the top-level of a Roc module.
@ -8936,7 +8936,7 @@ In roc, functions are always written as a lambda, like{}
r#"
app "test" provides [hash, hashable] to "./platform"
MHash has
MHash implements
hash : a -> U64 | a implements MHash
Id := U64 implements [MHash {hash}]
@ -8977,7 +8977,7 @@ In roc, functions are always written as a lambda, like{}
r#"
app "test" provides [result] to "./platform"
MHash has
MHash implements
hash : a -> U64 | a implements MHash
mulMHashes : MHash, MHash -> U64