@effekt-lang/effekt 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/bin/effekt +0 -0
- package/bin/effekt.sh +2 -0
- package/libraries/chez/THIRD-PARTY.txt +11 -0
- package/libraries/chez/callcc/datatype.ss +188 -0
- package/libraries/chez/callcc/effekt.ss +31 -0
- package/libraries/chez/callcc/seq.ss +44 -0
- package/libraries/chez/callcc/seq0.ss +69 -0
- package/libraries/chez/callcc/tail.ss +76 -0
- package/libraries/chez/callcc/tail0.ss +89 -0
- package/libraries/chez/common/effekt_primitives.ss +105 -0
- package/libraries/chez/common/immutable/cslist.effekt +37 -0
- package/libraries/chez/common/mutable/dict.effekt +28 -0
- package/libraries/chez/common/text/pregexp.scm +772 -0
- package/libraries/chez/common/text/regex.effekt +31 -0
- package/libraries/chez/lift/effekt.ss +118 -0
- package/libraries/chez/monadic/effekt.ss +84 -0
- package/libraries/chez/monadic/seq0.ss +76 -0
- package/libraries/common/args.effekt +95 -0
- package/libraries/common/array.effekt +225 -0
- package/libraries/common/bench.effekt +60 -0
- package/libraries/common/buffer.effekt +123 -0
- package/libraries/common/bytes.effekt +125 -0
- package/libraries/common/dequeue.effekt +92 -0
- package/libraries/common/effekt.effekt +764 -0
- package/libraries/common/exception.effekt +122 -0
- package/libraries/common/io/console.effekt +66 -0
- package/libraries/common/io/error.effekt +365 -0
- package/libraries/common/io/files.effekt +282 -0
- package/libraries/common/io/network.effekt +105 -0
- package/libraries/common/io/time.effekt +15 -0
- package/libraries/common/io.effekt +158 -0
- package/libraries/common/list.effekt +687 -0
- package/libraries/common/option.effekt +72 -0
- package/libraries/common/process.effekt +10 -0
- package/libraries/common/queue.effekt +140 -0
- package/libraries/common/ref.effekt +63 -0
- package/libraries/common/result.effekt +45 -0
- package/libraries/common/seq.effekt +914 -0
- package/libraries/common/string.effekt +395 -0
- package/libraries/common/test.effekt +98 -0
- package/libraries/js/effekt_builtins.js +57 -0
- package/libraries/js/effekt_runtime.js +385 -0
- package/libraries/js/io.js +143 -0
- package/libraries/js/mutable/map.effekt +31 -0
- package/libraries/js/text/regex.effekt +33 -0
- package/libraries/js/unsafe/cont.effekt +11 -0
- package/libraries/js/web/dom.effekt +45 -0
- package/libraries/llvm/array.c +53 -0
- package/libraries/llvm/buffer.c +286 -0
- package/libraries/llvm/forward-declare-c.ll +43 -0
- package/libraries/llvm/hole.c +11 -0
- package/libraries/llvm/io.c +566 -0
- package/libraries/llvm/io.ll +19 -0
- package/libraries/llvm/main.c +41 -0
- package/libraries/llvm/ref.c +45 -0
- package/libraries/llvm/rts.ll +761 -0
- package/libraries/llvm/sanity.c +16 -0
- package/libraries/llvm/types.c +43 -0
- package/libraries/ml/effekt.sml +65 -0
- package/libraries/ml/internal/mllist.effekt +9 -0
- package/libraries/ml/internal/mloption.effekt +18 -0
- package/libraries/ml/random.effekt +85 -0
- package/libraries/ml/text/regex.effekt +102 -0
- package/licenses/THIRD-PARTY.txt +21 -0
- package/licenses/apache-2.0 - license-2.0.txt +202 -0
- package/licenses/eclipse public license, version 2.0 - epl-2.0.html +61 -0
- package/licenses/kiama-license.txt +373 -0
- package/licenses/kiama-readme.txt +186 -0
- package/licenses/mit license - mit-license.html +1239 -0
- package/licenses/the apache software license, version 2.0 - license-2.0.txt +202 -0
- package/licenses/the bsd license - bsd-license.html +1237 -0
- package/licenses/the mit license - mit.html +1239 -0
- package/package.json +26 -18
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module immutable/cslist
|
|
2
|
+
|
|
3
|
+
import list
|
|
4
|
+
import array
|
|
5
|
+
|
|
6
|
+
// a chez scheme cons list
|
|
7
|
+
extern type CSList[A]
|
|
8
|
+
extern pure def cons[A](el: A, rest: CSList[A]): CSList[A] =
|
|
9
|
+
chez "(cons ${el} ${rest})"
|
|
10
|
+
|
|
11
|
+
extern pure def nil[A](): CSList[A] =
|
|
12
|
+
chez "(list)"
|
|
13
|
+
|
|
14
|
+
extern pure def isEmpty[A](l: CSList[A]): Bool =
|
|
15
|
+
chez "(null? ${l})"
|
|
16
|
+
|
|
17
|
+
// unsafe!
|
|
18
|
+
extern pure def head[A](l: CSList[A]): A =
|
|
19
|
+
chez "(car ${l})"
|
|
20
|
+
|
|
21
|
+
// unsafe!
|
|
22
|
+
extern pure def tail[A](l: CSList[A]): CSList[A] =
|
|
23
|
+
chez "(cdr ${l})"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def toChez[A](l: List[A]): CSList[A] = l match {
|
|
27
|
+
case Nil() => nil()
|
|
28
|
+
case Cons(a, rest) => cons(a, rest.toChez)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
def fromChez[A](l: CSList[A]): List[A] =
|
|
32
|
+
if (l.isEmpty) Nil() else Cons(l.head, l.tail.fromChez)
|
|
33
|
+
|
|
34
|
+
// Old From Chez
|
|
35
|
+
// -------------
|
|
36
|
+
extern pure def toArray[A](l: CSList[A]): Array[A] =
|
|
37
|
+
chez "(list->vector ${l})"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module mutable/dict
|
|
2
|
+
|
|
3
|
+
// https://cisco.github.io/ChezScheme/csug9.5/compat.html#g148
|
|
4
|
+
extern type Dict[K, V]
|
|
5
|
+
|
|
6
|
+
extern io def emptyDict[K, V](): Dict[K, V] =
|
|
7
|
+
chez "(make-eq-hashtable)"
|
|
8
|
+
|
|
9
|
+
extern io def emptyWeakDict[K, V](): Dict[K, V] =
|
|
10
|
+
chez "(make-hash-table #t)"
|
|
11
|
+
|
|
12
|
+
extern io def put[K, V](d: Dict[K, V], key: K, value: V): Unit =
|
|
13
|
+
chez "(put-hash-table! ${d} ${key} ${value})"
|
|
14
|
+
|
|
15
|
+
extern io def get[K, V](d: Dict[K, V], key: K, default: V): V =
|
|
16
|
+
chez "(hashtable-ref ${d} ${key} ${default})"
|
|
17
|
+
|
|
18
|
+
extern io def unsafeGet[K, V](d: Dict[K, V], key: K): V =
|
|
19
|
+
chez "(hashtable-ref ${d} ${key} #f)"
|
|
20
|
+
|
|
21
|
+
extern io def contains[K, V](d: Dict[K, V], key: K): Bool =
|
|
22
|
+
chez "(hashtable-contains? ${d} ${key})"
|
|
23
|
+
|
|
24
|
+
extern io def remove[K, V](d: Dict[K, V], key: K): Unit =
|
|
25
|
+
chez "(remove-hash-table! ${d} ${key})"
|
|
26
|
+
|
|
27
|
+
def get[K, V](d: Dict[K, V], key: K): Option[V] =
|
|
28
|
+
undefinedToOption(unsafeGet(d, key))
|