Skip to content

Commit 7ab324d

Browse files
committed
Update to newest Effekt version
1 parent 74411c8 commit 7ab324d

3 files changed

Lines changed: 18 additions & 22 deletions

File tree

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/csv.effekt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,25 +98,25 @@ def buildRow[R] { body: => R / RowBuilder }: (R, CsvRow) = {
9898

9999
def unbuild(v: CsvValue): Unit / CsvBuilder = v match {
100100
case rows => rows.foreach { row =>
101-
do rows {
101+
do rows {
102102
row.foreach { cell =>
103-
do cell(cell)
103+
do cell(cell)
104104
}
105105
}
106106
}
107107
}
108108

109-
def readUntil { shouldStop: Char => Bool }: String / Scan[Char] =
109+
def readUntil { shouldStop: Char => Bool }: String / Scan[Char] =
110110
collectString { readMany[Char] { c => not(shouldStop(c)) } }
111111

112112
/// Read and unescape a string in ""
113113
/// Stolen from 'json'
114114
def readQuotedString(): Unit / { Scan[Char], emit[Char], Exception[WrongFormat] } = {
115115
try {
116116
expect("Expected \"") { readIf('"') }
117-
while(read[Char]() is c and c != '"') {
117+
while(do read[Char]() is c and c != '"') {
118118
c match {
119-
case '\\' => read[Char]() match {
119+
case '\\' => do read[Char]() match {
120120
case '"' => do emit('\"')
121121
case '\\' => do emit('\\')
122122
case '/' => do emit('/')
@@ -140,9 +140,9 @@ def decodeRow(): Unit / {Scan[Char], RowBuilder, Exception[WrongFormat]} = loop
140140
do cell(cell)
141141

142142
do peek[Char]() match {
143-
case ',' => do skip[Char]()
143+
case ',' => skip[Char]()
144144
case '\n' =>
145-
do skip[Char]()
145+
skip[Char]()
146146
do stop()
147147
case '"' =>
148148
do cell(collectString { readQuotedString() })
@@ -153,10 +153,10 @@ def decodeRow(): Unit / {Scan[Char], RowBuilder, Exception[WrongFormat]} = loop
153153

154154
def decodeCsv(): Unit / {Scan[Char], CsvBuilder, Exception[WrongFormat]} = loop {
155155
do peek[Char]() match {
156-
case '\n' =>
156+
case '\n' =>
157157
// do skip[Char]()
158158
do rows { decodeRow() } // technically could be `do rows { () }`
159-
case _ =>
159+
case _ =>
160160
do rows { decodeRow() }
161161
}
162162
// QUESTION TODO: Why doesn't just this work instead of the match, huh?!
@@ -171,7 +171,7 @@ def encodeCsv[R] { csv: => R / CsvBuilder }: R / emit[String] = {
171171
}
172172

173173
try csv() with CsvBuilder {
174-
def rows[R]() = resume { {row} =>
174+
def rows[R]() = resume { {row} =>
175175
sep(); encodeRow {row}
176176
}
177177
}
@@ -185,7 +185,7 @@ def encodeRow[R] { row: => R / RowBuilder }: R / emit[String] = {
185185
}
186186

187187
try row() with RowBuilder { // TODO: quoting?!
188-
def cell(s) = { sep(); do emit(s); resume(()) }
188+
def cell(s) = { sep(); do emit(s); resume(()) }
189189
}
190190
}
191191

@@ -250,7 +250,7 @@ def getColumnOf[R](columnName: String) { csv: => R / CsvBuilder }: R / {emit[Str
250250
}
251251

252252
/// Not in PR, added by myself
253-
///
253+
///
254254
/// Get multiple columns by their names
255255
def getColumnsOf[R](columnNames: List[String]) { csv: => R / CsvBuilder }: R / {emit[Map[String, String]], Exception[WrongFormat]} = {
256256
with on[MissingValue].panic() // should never happen

src/lib/event.effekt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ def toEvent(value: String): Event / Exception[WrongFormat] = {
2828
Event(currentTimestampMillis(), value.toDouble)
2929
}
3030

31-
def show(e: Event): String = {
32-
"Event(value=" ++ e.value.show() ++ ", timestamp=" ++ timeMillisToString(e.timestamp) ++ ")"
33-
}
34-
3531
def equals(a: Event, b: Event): Bool = {
3632
a.timestamp == b.timestamp && a.value == b.value
3733
}

0 commit comments

Comments
 (0)