Skip to content

Commit 3f292b9

Browse files
committed
std: Fix syntax errors from the great syntax change
1 parent 404050b commit 3f292b9

File tree

8 files changed

+62
-60
lines changed

8 files changed

+62
-60
lines changed

std/array/array.pics

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Array :: module {
130130
// Returns:
131131
// A new array with elements in reverse order
132132
reverse :: (xs=[]) =
133-
Array.reduce(xs, |acc, x| -> x : acc, [])
133+
Array::reduce(xs, |acc, x| -> x : acc, [])
134134

135135
// Function: flatMap
136136
// Maps a over an array and flattens the result
@@ -142,7 +142,7 @@ Array :: module {
142142
// Returns:
143143
// A flat array of concatenated results
144144
flatMap :: (xs=[], f) =
145-
Array.reduce(xs, |acc, x| -> Array.concat(acc, f(x)), [])
145+
Array::reduce(xs, |acc, x| -> Array::concat(acc, f(x)), [])
146146

147147
// Function: take
148148
// Takes the first N elements from the array

std/iters/iters.pics

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import std.unit
22

3+
import std.sys
4+
35
// Module: Iterators
46
// Provides generic iteration utilities for traversing and executing functions over collections
57
Iterators :: module {
@@ -19,17 +21,17 @@ Iterators :: module {
1921
// like printing, logging, or mutating external state.
2022
forEach :: (array=[], fx) =
2123
when array {
22-
is [] -> Unit.UNIT
24+
is [] -> Unit::UNIT
2325
is [x] -> do {
2426
fx(x)
2527
Unit::UNIT
2628
}
2729
is h:t -> do {
2830
fx(h)
2931
forEach(t, fx)
30-
Unit::UNIT
3132
}
3233
}
3334

35+
forever :: (fx) = System::todo("TODO")
3436
}
3537

std/option/option.pics

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Option :: module {
2525

2626
// Variable: NONE
2727
// Predefined constant for the `none` value
28-
NONE := Option.none()
28+
NONE := Option::none()
2929

3030

3131
// Function: unwrap
@@ -42,8 +42,8 @@ Option :: module {
4242
unwrap :: (result) =
4343
when result {
4444
is {tag: "some", value: value} -> value
45-
is {tag: "none"} -> System.panic("Unwrapped none value")
46-
else -> System.panic("Failed to match case")
45+
is {tag: "none"} -> System::panic("Unwrapped none value")
46+
else -> System::panic("Failed to match case")
4747
}
4848

4949

std/result/result.pics

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Result :: module {
4343
unwrap :: (result) =
4444
when result {
4545
is {tag: "ok", value: value} -> value
46-
is {tag: "err", message: msg} -> System.panic(msg)
47-
else -> System.panic("Failed to match case")
46+
is {tag: "err", message: msg} -> System::panic(msg)
47+
else -> System::panic("Failed to match case")
4848
}
4949

5050

@@ -137,7 +137,7 @@ Result :: module {
137137
// A new Result with the transformed error or the original `ok`
138138
mapErr :: (result, fx) =
139139
when result {
140-
is {tag: "err", message: msg} -> Result.err(fx(msg))
140+
is {tag: "err", message: msg} -> Result::err(fx(msg))
141141
else -> result
142142
}
143143

std/string/string.pics

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ String :: module {
9898
// Returns:
9999
// A new string padded on the left to reach `total` length
100100
padLeft :: (str="", total=0, char=" ") = do {
101-
let padCount = total - String.length(str)
101+
let padCount = total - String::length(str)
102102
if padCount <= 0 { str }
103103
else { repeat(char, padCount) + str }
104104
}
@@ -115,7 +115,7 @@ String :: module {
115115
// Returns:
116116
// A new string padded on the right to reach `total` length
117117
padRight :: (str="", total=0, char=" ") = do {
118-
let padCount = total - String.length(str)
118+
let padCount = total - String::length(str)
119119
if padCount <= 0 { str }
120120
else { str + repeat(char, padCount) }
121121
}

std/time/months.pics

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11

22

33
Months :: module {
4-
JANUARY := "January"
5-
FEBRUARY := "February"
6-
MARCH := "March"
7-
APRIL := "April"
8-
MAY := "May"
9-
JUNE := "June"
10-
JULY := "July"
11-
AUGUST := "August"
12-
SEPTEMBER := "September"
13-
OCTOBER := "October"
14-
NOVEMBER := "November"
15-
DECEMBER := "December"
4+
JANUARY := "January"
5+
FEBRUARY := "February"
6+
MARCH := "March"
7+
APRIL := "April"
8+
MAY := "May"
9+
JUNE := "June"
10+
JULY := "July"
11+
AUGUST := "August"
12+
SEPTEMBER := "September"
13+
OCTOBER := "October"
14+
NOVEMBER := "November"
15+
DECEMBER := "December"
1616

1717
getMonth :: (month = 0) =
1818
when month {
@@ -26,24 +26,24 @@ Months :: module {
2626
is 7 -> Months.AUGUST
2727
is 8 -> Months.SEPTEMBER
2828
is 9 -> Months.OCTOBER
29-
is 10 -> Months.NOVEMBER
30-
is 11 -> Months.DECEMBER
29+
is 10 -> Months.NOVEMBER
30+
is 11 -> Months.DECEMBER
3131
}
3232

3333
toNumber :: (month) =
3434
when month {
35-
is Months.JANUARYa -> 0
36-
is Months.FEBRUARY -> 1
37-
is Months.MARCH -> 2
38-
is Months.APRIL -> 3
39-
is Months.MAY -> 4
40-
is Months.JUNE -> 5
41-
is Months.JULY -> 6
42-
is Months.AUGUST -> 7
43-
is Months.SEPTEMBER -> 8
44-
is Months.OCTOBER -> 9
45-
is Months.NOVEMBER -> 10
46-
is Months.DECEMBER -> 11
35+
is Months.JANUARYa -> 0
36+
is Months.FEBRUARY -> 1
37+
is Months.MARCH -> 2
38+
is Months.APRIL -> 3
39+
is Months.MAY -> 4
40+
is Months.JUNE -> 5
41+
is Months.JULY -> 6
42+
is Months.AUGUST -> 7
43+
is Months.SEPTEMBER -> 8
44+
is Months.OCTOBER -> 9
45+
is Months.NOVEMBER -> 10
46+
is Months.DECEMBER -> 11
4747
}
4848
}
4949

std/time/weekdays.pics

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11

22
WeekDays :: module {
3-
MONDAY := "Monday"
4-
TUESDAY := "Tuesday"
5-
WEDNESDAY := "Wednesday"
6-
THURSDAY := "Thursday"
7-
FRIDAY := "Friday"
8-
SATURDAY := "Saturday"
9-
SUNDAY := "Sunday"
3+
MONDAY := "Monday"
4+
TUESDAY := "Tuesday"
5+
WEDNESDAY := "Wednesday"
6+
THURSDAY := "Thursday"
7+
FRIDAY := "Friday"
8+
SATURDAY := "Saturday"
9+
SUNDAY := "Sunday"
1010

1111
getWeekDay :: (day = 0) =
1212
when day {
13-
is 0 -> WeekDays.MONDAY
14-
is 1 -> WeekDays.TUESDAY
15-
is 2 -> WeekDays.WEDNESDAY
16-
is 3 -> WeekDays.THURSDAY
17-
is 4 -> WeekDays.FRIDAY
18-
is 5 -> WeekDays.SATURDAY
19-
is 6 -> WeekDays.SUNDAY
13+
is 0 -> WeekDays.MONDAY
14+
is 1 -> WeekDays.TUESDAY
15+
is 2 -> WeekDays.WEDNESDAY
16+
is 3 -> WeekDays.THURSDAY
17+
is 4 -> WeekDays.FRIDAY
18+
is 5 -> WeekDays.SATURDAY
19+
is 6 -> WeekDays.SUNDAY
2020
}
2121

2222
toNumber :: (day) =
2323
when day {
2424
is WeekDays.MONDAY -> 0
25-
is WeekDays.TUESDAY -> 0
26-
is WeekDays.WEDNESDAY -> 0
27-
is WeekDays.THURSDAY -> 0
28-
is WeekDays.FRIDAY -> 0
29-
is WeekDays.SATURDAY -> 0
30-
is WeekDays.SUNDAY -> 0
25+
is WeekDays.TUESDAY -> 1
26+
is WeekDays.WEDNESDAY -> 2
27+
is WeekDays.THURSDAY -> 3
28+
is WeekDays.FRIDAY -> 4
29+
is WeekDays.SATURDAY -> 5
30+
is WeekDays.SUNDAY -> 6
3131
}
3232
}
3333

std/virtual/vthread.pics

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ Virtual :: module {
3030
// Waits for the virtual thread to finish and gets the result
3131
//
3232
// Parameters:
33-
// task - The task handle
33+
// handle - The task handle
3434
//
3535
// Returns:
3636
// The result of the thread.
37-
await :: (task) = task.await
37+
await :: (handle) = handle.await
3838
}
3939

4040

0 commit comments

Comments
 (0)