More progress

This commit is contained in:
Sam Mohr 2025-01-05 05:16:47 -08:00
parent b56fbd38e1
commit 0edbf16d55
No known key found for this signature in database
GPG key ID: EA41D161A3C1BC99
79 changed files with 1351 additions and 1419 deletions

View file

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

View file

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

View file

@ -1,4 +1,4 @@
app "test" provides [myU8] to "./platform"
app "test" provides [my_u8] to "./platform"
MDecodeError : [TooShort, Leftover (List U8)]
@ -10,16 +10,16 @@ MDecoding implements
MDecoderFormatting implements
u8 : MDecoder U8 fmt where fmt implements MDecoderFormatting
decodeWith : List U8, MDecoder val fmt, fmt -> { result: Result val MDecodeError, rest: List U8 } where fmt implements MDecoderFormatting
decodeWith = \lst, (@MDecoder doDecode), fmt -> doDecode lst fmt
decode_with : List U8, MDecoder val fmt, fmt -> { result: Result val MDecodeError, rest: List U8 } where fmt implements MDecoderFormatting
decode_with = \lst, (@MDecoder doDecode), fmt -> doDecode lst fmt
fromBytes : List U8, fmt -> Result val MDecodeError
from_bytes : List U8, fmt -> Result val MDecodeError
where fmt implements MDecoderFormatting, val implements MDecoding
fromBytes = \lst, fmt ->
when decodeWith lst decoder fmt is
from_bytes = \lst, fmt ->
when decode_with lst decoder fmt is
{ result, rest } ->
when result is
Ok val -> if List.isEmpty rest then Ok val else Err (Leftover rest)
Ok val -> if List.is_empty rest then Ok val else Err (Leftover rest)
Err e -> Err e
@ -28,17 +28,17 @@ Linear := {} implements [MDecoderFormatting {u8}]
u8 = @MDecoder \lst, @Linear {} ->
#^^{-1} Linear#u8(11): MDecoder U8 Linear
when List.first lst is
Ok n -> { result: Ok n, rest: List.dropFirst lst 1 }
Ok n -> { result: Ok n, rest: List.drop_first lst 1 }
Err _ -> { result: Err TooShort, rest: [] }
MyU8 := U8 implements [MDecoding {decoder}]
decoder = @MDecoder \lst, fmt ->
#^^^^^^^{-1} MyU8#decoder(12): MDecoder MyU8 fmt where fmt implements MDecoderFormatting
when decodeWith lst u8 fmt is
when decode_with lst u8 fmt is
{ result, rest } ->
{ result: Result.map result (\n -> @MyU8 n), rest }
myU8 : Result MyU8 _
myU8 = fromBytes [15] (@Linear {})
#^^^^{-1} Result MyU8 MDecodeError
my_u8 : Result MyU8 _
my_u8 = from_bytes [15] (@Linear {})
#^^^^^{-1} Result MyU8 MDecodeError

View file

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

View file

@ -2,5 +2,5 @@ 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 where fmt implements DecoderFormatting
Decode.decode_with bytes Decode.decoder fmt
# ^^^^^^^^^^^^^^ Decoding#Decode.decoder(4): Decoder Bool fmt where fmt implements DecoderFormatting

View file

@ -1,4 +1,4 @@
app "test" provides [main] to "./platform"
main = Bool.isEq Bool.true Bool.false
# ^^^^^^^^^ Eq#Bool.isEq(9): Bool, Bool -[[Bool.structuralEq(11)]]-> Bool
main = Bool.is_eq Bool.true Bool.false
# ^^^^^^^^^^ Eq#Bool.is_eq(9): Bool, Bool -[[Bool.structural_eq(11)]]-> Bool

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 where a implements Hasher
# ^^^^^^^^^ Hash#Hash.hash(1): a, Bool -[[Hash.hash_bool(9)]]-> a where 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 where fmt implements EncoderFormatting
main = Encode.to_encoder Bool.true
# ^^^^^^^^^^^^^^^^^ Encoding#Encode.to_encoder(2): Bool -[[] + fmt:Encode.bool(17):1]-> Encoder fmt where fmt implements EncoderFormatting

View file

@ -2,4 +2,4 @@ app "test" provides [main] to "./platform"
main =
\h -> Hash.hash h 1.1dec
# ^^^^^^^^^ Hash#Hash.hash(1): a, Dec -[[Hash.hashDec(17)]]-> a where a implements Hasher
# ^^^^^^^^^ Hash#Hash.hash(1): a, Dec -[[Hash.hash_dec(17)]]-> a where a implements Hasher

View file

@ -1,4 +1,4 @@
app "test" provides [main] to "./platform"
main = Inspect.toInspector Bool.true |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.toInspector(32): Bool -[[] + f:Inspect.bool(13):1]-> Inspector f where f implements InspectFormatter
main = Inspect.to_inspector Bool.true |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.to_inspector(32): Bool -[[] + f:Inspect.bool(13):1]-> Inspector f where f implements InspectFormatter

View file

@ -1,4 +1,4 @@
app "test" provides [main] to "./platform"
main = Inspect.toInspector 7dec |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.toInspector(32): Dec -[[] + f:Inspect.dec(29):1]-> Inspector f where f implements InspectFormatter
main = Inspect.to_inspector 7dec |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.to_inspector(32): Dec -[[] + f:Inspect.dec(29):1]-> Inspector f where f implements InspectFormatter

View file

@ -2,5 +2,5 @@ app "test" provides [main] to "./platform"
Op := {}
main = Inspect.toInspector (@Op {}) |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.toInspector(32): Op -[[] + f:Inspect.opaque(15):1]-> Inspector f where f implements InspectFormatter
main = Inspect.to_inspector (@Op {}) |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.to_inspector(32): Op -[[] + f:Inspect.opaque(15):1]-> Inspector f where f implements InspectFormatter

View file

@ -8,42 +8,42 @@ main =
1
# -emit:mono
procedure Inspect.252 (Inspect.253):
let Inspect.317 : Str = "<opaque>";
let Inspect.316 : Str = CallByName Inspect.63 Inspect.253 Inspect.317;
dec Inspect.317;
ret Inspect.316;
procedure Inspect.251 (Inspect.252):
let Inspect.316 : Str = "<opaque>";
let Inspect.315 : Str = CallByName Inspect.63 Inspect.252 Inspect.316;
dec Inspect.316;
ret Inspect.315;
procedure Inspect.30 (Inspect.147):
ret Inspect.147;
procedure Inspect.33 (Inspect.152):
let Inspect.305 : Str = CallByName Inspect.5 Inspect.152;
let Inspect.304 : Str = CallByName Inspect.64 Inspect.305;
ret Inspect.304;
let Inspect.304 : Str = CallByName Inspect.5 Inspect.152;
let Inspect.303 : Str = CallByName Inspect.64 Inspect.304;
ret Inspect.303;
procedure Inspect.39 (Inspect.301):
let Inspect.311 : Str = "";
ret Inspect.311;
procedure Inspect.39 (Inspect.300):
let Inspect.310 : Str = "";
ret Inspect.310;
procedure Inspect.48 (Inspect.299):
let Inspect.314 : {} = Struct {};
let Inspect.313 : {} = CallByName Inspect.30 Inspect.314;
ret Inspect.313;
procedure Inspect.48 (Inspect.298):
let Inspect.313 : {} = Struct {};
let Inspect.312 : {} = CallByName Inspect.30 Inspect.313;
ret Inspect.312;
procedure Inspect.5 (Inspect.150):
let Inspect.312 : {} = CallByName Inspect.48 Inspect.150;
let Inspect.309 : {} = Struct {};
let Inspect.308 : Str = CallByName Inspect.39 Inspect.309;
let Inspect.307 : Str = CallByName Inspect.252 Inspect.308;
ret Inspect.307;
let Inspect.311 : {} = CallByName Inspect.48 Inspect.150;
let Inspect.308 : {} = Struct {};
let Inspect.307 : Str = CallByName Inspect.39 Inspect.308;
let Inspect.306 : Str = CallByName Inspect.251 Inspect.307;
ret Inspect.306;
procedure Inspect.63 (Inspect.300, Inspect.296):
let Inspect.319 : Str = CallByName Str.3 Inspect.300 Inspect.296;
ret Inspect.319;
procedure Inspect.63 (Inspect.299, Inspect.295):
let Inspect.318 : Str = CallByName Str.3 Inspect.299 Inspect.295;
ret Inspect.318;
procedure Inspect.64 (Inspect.302):
ret Inspect.302;
procedure Inspect.64 (Inspect.301):
ret Inspect.301;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3;

View file

@ -11,42 +11,42 @@ main =
late (@Op {})
# -emit:mono
procedure Inspect.252 (Inspect.253):
let Inspect.317 : Str = "<opaque>";
let Inspect.316 : Str = CallByName Inspect.63 Inspect.253 Inspect.317;
dec Inspect.317;
ret Inspect.316;
procedure Inspect.251 (Inspect.252):
let Inspect.316 : Str = "<opaque>";
let Inspect.315 : Str = CallByName Inspect.63 Inspect.252 Inspect.316;
dec Inspect.316;
ret Inspect.315;
procedure Inspect.30 (Inspect.147):
ret Inspect.147;
procedure Inspect.33 (Inspect.152):
let Inspect.305 : Str = CallByName Inspect.5 Inspect.152;
let Inspect.304 : Str = CallByName Inspect.64 Inspect.305;
ret Inspect.304;
let Inspect.304 : Str = CallByName Inspect.5 Inspect.152;
let Inspect.303 : Str = CallByName Inspect.64 Inspect.304;
ret Inspect.303;
procedure Inspect.39 (Inspect.301):
let Inspect.311 : Str = "";
ret Inspect.311;
procedure Inspect.39 (Inspect.300):
let Inspect.310 : Str = "";
ret Inspect.310;
procedure Inspect.48 (Inspect.299):
let Inspect.314 : {} = Struct {};
let Inspect.313 : {} = CallByName Inspect.30 Inspect.314;
ret Inspect.313;
procedure Inspect.48 (Inspect.298):
let Inspect.313 : {} = Struct {};
let Inspect.312 : {} = CallByName Inspect.30 Inspect.313;
ret Inspect.312;
procedure Inspect.5 (Inspect.150):
let Inspect.312 : {} = CallByName Inspect.48 Inspect.150;
let Inspect.309 : {} = Struct {};
let Inspect.308 : Str = CallByName Inspect.39 Inspect.309;
let Inspect.307 : Str = CallByName Inspect.252 Inspect.308;
ret Inspect.307;
let Inspect.311 : {} = CallByName Inspect.48 Inspect.150;
let Inspect.308 : {} = Struct {};
let Inspect.307 : Str = CallByName Inspect.39 Inspect.308;
let Inspect.306 : Str = CallByName Inspect.251 Inspect.307;
ret Inspect.306;
procedure Inspect.63 (Inspect.300, Inspect.296):
let Inspect.319 : Str = CallByName Str.3 Inspect.300 Inspect.296;
ret Inspect.319;
procedure Inspect.63 (Inspect.299, Inspect.295):
let Inspect.318 : Str = CallByName Str.3 Inspect.299 Inspect.295;
ret Inspect.318;
procedure Inspect.64 (Inspect.302):
ret Inspect.302;
procedure Inspect.64 (Inspect.301):
ret Inspect.301;
procedure Str.3 (#Attr.2, #Attr.3):
let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3;

View file

@ -1,9 +1,9 @@
app "test" provides [main] to "./platform"
Op := U8 implements [Inspect { toInspector: myToInspector }]
Op := U8 implements [Inspect { to_inspector: myToInspector }]
myToInspector : Op -> Inspector f where f implements InspectFormatter
myToInspector = \@Op num -> Inspect.u8 num
main = Inspect.toInspector (@Op 1u8) |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^ Op#Inspect.toInspector(2): Op -[[myToInspector(2)]]-> Inspector f where f implements InspectFormatter
main = Inspect.to_inspector (@Op 1u8) |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^^ Op#Inspect.to_inspector(2): Op -[[myToInspector(2)]]-> Inspector f where f implements InspectFormatter

View file

@ -2,5 +2,5 @@ app "test" provides [main] to "./platform"
Op := U8 implements [Inspect]
main = Inspect.toInspector (@Op 1u8) |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^ Op#Inspect.toInspector(3): Op -[[#Op_toInspector(3)]]-> Inspector f where f implements InspectFormatter
main = Inspect.to_inspector (@Op 1u8) |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^^ Op#Inspect.to_inspector(3): Op -[[#Op_to_inspector(3)]]-> Inspector f where f implements InspectFormatter

View file

@ -1,4 +1,4 @@
app "test" provides [main] to "./platform"
main = Inspect.toInspector 7 |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.toInspector(32): I64 -[[] + f:Inspect.i64(24):1]-> Inspector f where f implements InspectFormatter
main = Inspect.to_inspector 7 |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.to_inspector(32): I64 -[[] + f:Inspect.i64(24):1]-> Inspector f where f implements InspectFormatter

View file

@ -1,4 +1,4 @@
app "test" provides [main] to "./platform"
main = Inspect.toInspector { a: "" } |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.toInspector(32): { a : Str } -[[#Derived.toInspector_{a}(0)]]-> Inspector f where f implements InspectFormatter
main = Inspect.to_inspector { a: "" } |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.to_inspector(32): { a : Str } -[[#Derived.to_inspector_{a}(0)]]-> Inspector f where f implements InspectFormatter

View file

@ -1,9 +1,9 @@
app "test" provides [main] to "./platform"
Op := U8 implements [Inspect { toInspector: myToInspector }]
Op := U8 implements [Inspect { to_inspector: myToInspector }]
myToInspector : Op -> Inspector f where f implements InspectFormatter
myToInspector = \@Op num -> Inspect.u8 num
main = Inspect.toInspector { op: @Op 1u8 } |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.toInspector(32): { op : Op } -[[#Derived.toInspector_{op}(0)]]-> Inspector f where f implements InspectFormatter
main = Inspect.to_inspector { op: @Op 1u8 } |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.to_inspector(32): { op : Op } -[[#Derived.to_inspector_{op}(0)]]-> Inspector f where f implements InspectFormatter

View file

@ -1,4 +1,4 @@
app "test" provides [main] to "./platform"
main = Inspect.toInspector 7u8 |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.toInspector(32): U8 -[[] + f:Inspect.u8(17):1]-> Inspector f where f implements InspectFormatter
main = Inspect.to_inspector 7u8 |> Inspect.apply (Inspect.init {})
# ^^^^^^^^^^^^^^^^^^^^ Inspect#Inspect.to_inspector(32): U8 -[[] + f:Inspect.u8(17):1]-> Inspector f where f implements InspectFormatter

View file

@ -5,5 +5,5 @@ 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] } where fmt implements DecoderFormatting
Decode.decode_with bytes Decode.decoder fmt
# ^^^^^^^^^^^^^^ N#Decode.decoder(3): List U8, fmt -[[7]]-> { rest : List U8, result : [Err [TooShort], Ok U8] } where fmt implements DecoderFormatting

View file

@ -2,5 +2,5 @@ app "test" provides [main] to "./platform"
N := U8 implements [Encoding]
main = Encode.toEncoder (@N 15)
# ^^^^^^^^^^^^^^^^ N#Encode.toEncoder(3): N -[[#N_toEncoder(3)]]-> Encoder fmt where fmt implements EncoderFormatting
main = Encode.to_encoder (@N 15)
# ^^^^^^^^^^^^^^^^^ N#Encode.to_encoder(3): N -[[#N_to_encoder(3)]]-> Encoder fmt where fmt implements EncoderFormatting

View file

@ -1,8 +1,8 @@
app "test" provides [main] to "./platform"
Trivial := {} implements [Eq {isEq}]
Trivial := {} implements [Eq {is_eq}]
isEq = \@Trivial {}, @Trivial {} -> Bool.true
is_eq = \@Trivial {}, @Trivial {} -> Bool.true
main = Bool.isEq (@Trivial {}) (@Trivial {})
# ^^^^^^^^^ Trivial#Bool.isEq(2): Trivial, Trivial -[[isEq(2)]]-> Bool
main = Bool.is_eq (@Trivial {}) (@Trivial {})
# ^^^^^^^^^^ Trivial#Bool.is_eq(2): Trivial, Trivial -[[is_eq(2)]]-> Bool

View file

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

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 where a implements Hasher
# ^^^^^^^^^ Hash#Hash.hash(1): a, I64 -[[Hash.hash_i64(13)]]-> a where a implements Hasher

View file

@ -1,6 +1,6 @@
app "test"
imports [Encode.{ toEncoder }]
imports [Encode.{ to_encoder }]
provides [main] to "./platform"
main = toEncoder { a: "" }
# ^^^^^^^^^ Encoding#toEncoder(2): { a : Str } -[[#Derived.toEncoder_{a}(0)]]-> Encoder fmt where fmt implements EncoderFormatting
main = to_encoder { a: "" }
# ^^^^^^^^^^ Encoding#to_encoder(2): { a : Str } -[[#Derived.to_encoder_{a}(0)]]-> Encoder fmt where fmt implements EncoderFormatting

View file

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

View file

@ -7,6 +7,6 @@ main =
s2 : Set Str
s2 = Set.empty {}
Bool.isEq s1 s1 && Bool.isEq s2 s2
# ^^^^^^^^^ Set#Bool.isEq(31): Set Str, Set Str -[[Set.isEq(31)]]-> Bool
# ^^^^^^^^^ Set#Bool.isEq(31): Set U8, Set U8 -[[Set.isEq(31)]]-> Bool
Bool.is_eq s1 s1 && Bool.is_eq s2 s2
# ^^^^^^^^^^ Set#Bool.is_eq(31): Set Str, Set Str -[[Set.is_eq(31)]]-> Bool
# ^^^^^^^^^^ Set#Bool.is_eq(31): Set U8, Set U8 -[[Set.is_eq(31)]]-> Bool

View file

@ -42,4 +42,4 @@ parseInput = \{} ->
] is
_ -> ""
main = Bool.isEq (parseInput {}) ""
main = Bool.is_eq (parseInput {}) ""

View file

@ -20,6 +20,6 @@ main =
printed = printCombinatorParser f.parser
if Bool.false then printed else "foo"
|> List.first
|> Result.withDefault ("foo")
|> Result.with_default ("foo")
printCombinatorParser (Record [])

View file

@ -5,7 +5,7 @@ Parser a : List U8 -> List [Pair a (List U8)]
any: Parser U8
any = \inp ->
when List.first inp is
Ok u -> [Pair u (List.dropFirst inp 1)]
Ok u -> [Pair u (List.drop_first inp 1)]
_ -> []
main = any

View file

@ -1,7 +1,7 @@
app "test" provides [main] to "./platform"
entry =
if Bool.true then List.first [] else Str.toI64 ""
if Bool.true then List.first [] else Str.to_i64 ""
main = entry
# ^^^^^ Result I64 [InvalidNumStr, ListWasEmpty]w_a

View file

@ -13,7 +13,7 @@ Id := U64 implements [MHash {hash, hash32}, Ord {eq, le}]
hash = \@Id n -> n
#^^^^{-1} Id#hash(7): Id -[[hash(7)]]-> U64
hash32 = \@Id n -> Num.toU32 n
hash32 = \@Id n -> Num.to_u32 n
#^^^^^^{-1} Id#hash32(8): Id -[[hash32(8)]]-> U32
eq = \@Id m, @Id n -> m == n

View file

@ -9,5 +9,5 @@ Id := U64 implements [MHash {hash, hash32}]
hash = \@Id n -> n
#^^^^{-1} Id#hash(4): Id -[[hash(4)]]-> U64
hash32 = \@Id n -> Num.toU32 n
hash32 = \@Id n -> Num.to_u32 n
#^^^^^^{-1} Id#hash32(5): Id -[[hash32(5)]]-> U32

View file

@ -39,7 +39,7 @@ encodeF32 = \_n -> encodeNothing
encodeF64 = \_n -> encodeNothing
encodeDec = \_n -> encodeNothing
encodeBool = \_b -> encodeNothing
encodeString = \str -> Encode.custom \bytes, @OnlyStrEncoder {} -> List.concat bytes (Str.toUtf8 str)
encodeString = \str -> Encode.custom \bytes, @OnlyStrEncoder {} -> List.concat bytes (Str.to_utf8 str)
encodeList : List elem, (elem -> Encoder OnlyStrEncoder) -> Encoder OnlyStrEncoder
encodeList = \_lst, _encodeElem -> encodeNothing
encodeRecord : List {key: Str, value: Encoder OnlyStrEncoder} -> Encoder OnlyStrEncoder
@ -50,15 +50,15 @@ encodeTag : Str, List (Encoder OnlyStrEncoder) -> Encoder OnlyStrEncoder
encodeTag = \_name, _payload -> encodeNothing
HelloWorld := {} implements [Encoding {toEncoder}]
HelloWorld := {} implements [Encoding {to_encoder}]
toEncoder = \@HelloWorld {} ->
to_encoder = \@HelloWorld {} ->
Encode.custom \bytes, fmt ->
bytes
|> Encode.appendWith (Encode.string "Hello, World!\n") fmt
|> Encode.append_with (Encode.string "Hello, World!\n") fmt
f =
when Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) (@OnlyStrEncoder {})) is
when Str.from_utf8 (Encode.to_bytes (@HelloWorld {}) (@OnlyStrEncoder {})) is
Ok s -> s
_ -> "<bad>"

View file

@ -2,9 +2,9 @@ app "test" provides [main] to "./platform"
entry =
{
toF32: Num.toF32,
toF64: Num.toF64,
to_f32: Num.to_f32,
to_f64: Num.to_f64,
}
main = entry
# ^^^^^ { toF32 : Num * -[[Num.toF32(139)]]-> F32, toF64 : Num w_a -[[Num.toF64(141)]]-> F64 }
# ^^^^^ { to_f32 : Num * -[[Num.to_f32(139)]]-> F32, to_f64 : Num w_a -[[Num.to_f64(141)]]-> F64 }

View file

@ -2,17 +2,17 @@ app "test" provides [main] to "./platform"
entry =
{
toI8: Num.toI8,
toI16: Num.toI16,
toI32: Num.toI32,
toI64: Num.toI64,
toI128: Num.toI128,
toU8: Num.toU8,
toU16: Num.toU16,
toU32: Num.toU32,
toU64: Num.toU64,
toU128: Num.toU128,
to_i8: Num.to_i8,
to_i16: Num.to_i16,
to_i32: Num.to_i32,
to_i64: Num.to_i64,
to_i128: Num.to_i128,
to_u8: Num.to_u8,
to_u16: Num.to_u16,
to_u32: Num.to_u32,
to_u64: Num.to_u64,
to_u128: Num.to_u128,
}
main = entry
# ^^^^^ { toI128 : Int * -[[Num.toI128(125)]]-> I128, toI16 : Int w_a -[[Num.toI16(119)]]-> I16, toI32 : Int w_b -[[Num.toI32(121)]]-> I32, toI64 : Int w_c -[[Num.toI64(123)]]-> I64, toI8 : Int w_d -[[Num.toI8(117)]]-> I8, toU128 : Int w_e -[[Num.toU128(135)]]-> U128, toU16 : Int w_f -[[Num.toU16(129)]]-> U16, toU32 : Int w_g -[[Num.toU32(131)]]-> U32, toU64 : Int w_h -[[Num.toU64(133)]]-> U64, toU8 : Int w_i -[[Num.toU8(127)]]-> U8 }
# ^^^^^ { to_i128 : Int * -[[Num.to_i128(125)]]-> I128, to_i16 : Int w_a -[[Num.to_i16(119)]]-> I16, to_i32 : Int w_b -[[Num.to_i32(121)]]-> I32, to_i64 : Int w_c -[[Num.to_i64(123)]]-> I64, to_i8 : Int w_d -[[Num.to_i8(117)]]-> I8, to_u128 : Int w_e -[[Num.to_u128(135)]]-> U128, to_u16 : Int w_f -[[Num.to_u16(129)]]-> U16, to_u32 : Int w_g -[[Num.to_u32(131)]]-> U32, to_u64 : Int w_h -[[Num.to_u64(133)]]-> U64, to_u8 : Int w_i -[[Num.to_u8(127)]]-> U8 }