Skip to content

Commit e996f5d

Browse files
committed
Avoid C style namespacing
1 parent 576dc29 commit e996f5d

File tree

16 files changed

+37
-36
lines changed

16 files changed

+37
-36
lines changed

examples/benchmarks/input_output/dyck_one.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type Tree {
2828

2929
def readTree(): Tree / { Scan[Byte], stop } = {
3030
readIf[Byte] { b => b.toInt == 40 }
31-
val children = collectList[Tree] { many { readTree() } }
31+
val children = list::collect[Tree] { many { readTree() } }
3232
skipIf[Byte] { b => b.toInt == 41 }
3333
Node(children)
3434
}

examples/stdlib/list/collect.effekt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ module examples/pos/list/collect
22

33
def main() = {
44
val empty = Nil[Int]()
5-
empty.collect { x => Some(x) }.foreach { x => println(x) }
5+
empty.collectSome { x => Some(x) }.foreach { x => println(x) }
66

77
val l = [1, 2, 3, 4]
8-
l.collect { x => if (x > 2) { Some(x * 10) } else { None() } }.foreach { x => println(x) }
8+
l.collectSome { x => if (x > 2) { Some(x * 10) } else { None() } }.foreach { x => println(x) }
99

1010
val optList = [Some(1), None(), Some(2), None(), Some(3), Some(4), None()]
11-
optList.collect { x => x }.foreach { x => println(x) }
11+
optList.collectSome { x => x }.foreach { x => println(x) }
1212
}

examples/stdlib/stream/characters.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def main() = {
55
println(show(c) ++ " (" ++ show(c.toInt) ++ ")")
66
}
77

8-
val list = collectList[Char] { each("Hello") }
8+
val list = list::collect[Char] { each("Hello") }
99
println(list.map { c => c.show })
1010
}
1111

examples/stdlib/stream/fastexp.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def main() = {
6262

6363
def testBits(n: Int) = {
6464
println(n)
65-
println(collectList[Bool] {n.eachLSB}.prettyBits)
66-
println(collectList[Bool] {n.eachMSB}.prettyBits)
65+
println(list::collect[Bool] {n.eachLSB}.prettyBits)
66+
println(list::collect[Bool] {n.eachMSB}.prettyBits)
6767
}
6868

6969
testBits(0)

examples/stdlib/stream/fuse_newlines.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def skipNewlines(): Nothing / {read[Char], emit[Char], stop} = {
2323

2424
def main() = {
2525
with feed("ab\n\nc\nde")
26-
println(collectString {
26+
println(string::collect {
2727
with exhaustively
2828
fuseNewlines()
2929
})

examples/stdlib/stream/map.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ def main() = {
88
println(show(k) ++ ": " ++ show(v) ++ " (" ++ show(v.toInt) ++ ")")
99
}
1010

11-
val newMap = collectMap[Int, Char](compareInt) { each(m) }
11+
val newMap = map::collect[Int, Char](compareInt) { each(m) }
1212
println(map::internal::prettyPairs(newMap.toList) { n => show(n) } { c => show(c) })
1313

14-
val hello: String = collectString { eachValue(m) }
14+
val hello: String = string::collect { eachValue(m) }
1515
println(hello)
1616
}
1717

examples/stdlib/stream/taylor.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def ints(): Unit / emit[Int] = {
88

99
/// Take the `n` first elements of a `stream`, put them in a list.
1010
def take[A](n: Int) { stream: () => Unit / emit[A] }: List[A] = {
11-
with collectList[A]
11+
with collect[A]
1212
with boundary
1313
with limit[A](n)
1414
stream()

examples/stdlib/stream/tee.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ def main() = {
1111
}
1212
}
1313
def a{ b: => Unit / emit[Int] }: Unit = {
14-
println(collectList[Int]{boundary{limit[Int](4){b}}})
14+
println(list::collect[Int]{boundary{limit[Int](4){b}}})
1515
println("a done")
1616
}
1717
def b{ b: => Unit / emit[Int] }: Unit = {
18-
println(collectList[Int]{boundary{limit[Int](9){b}}})
18+
println(list::collect[Int]{boundary{limit[Int](9){b}}})
1919
println("b done")
2020
}
2121
println("a{ ... }")

libraries/common/array.effekt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,11 @@ def feed[T, R](array: Array[T]) { reader: () => R / read[T] }: R = {
677677
}
678678
}
679679

680-
def collectArray[A] { stream: () => Unit / emit[A] }: Array[A] =
681-
returning::collectArray[A, Unit]{stream}.second
680+
def collect[A] { stream: () => Unit / emit[A] }: Array[A] =
681+
returning::collect[A, Unit]{stream}.second
682682

683683
namespace returning {
684-
def collectArray[A, R] { stream: () => R / emit[A] }: (R, Array[A]) = {
684+
def collect[A, R] { stream: () => R / emit[A] }: (R, Array[A]) = {
685685
var i = 0
686686
var a = allocate(1)
687687
try {

libraries/common/bytearray.effekt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,11 @@ def feed[R](bytes: ByteArray) { reader: () => R / read[Byte] }: R = {
238238
}
239239
}
240240

241-
def collectBytes { stream: () => Unit / emit[Byte] }: ByteArray =
242-
returning::collectBytes[Unit]{stream}.second
241+
def collect { stream: () => Unit / emit[Byte] }: ByteArray =
242+
returning::collect[Unit]{stream}.second
243243

244244
namespace returning {
245-
def collectBytes[R] { stream: () => R / emit[Byte] }: (R, ByteArray) = {
245+
def collect[R] { stream: () => R / emit[Byte] }: (R, ByteArray) = {
246246
var i = 0
247247
var a = allocate(1)
248248
try {

0 commit comments

Comments
 (0)