Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .haxerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "3.4.7",
"version": "4.3.3",
"resolveLibs": "scoped"
}
15 changes: 7 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,31 @@ stages:
- deploy

language: node_js
node_js: 8
node_js: 14

os:
- linux
# - osx

env:
- HAXE_VERSION=3.4.7
- HAXE_VERSION=stable
- HAXE_VERSION=nightly

install:
- npm i -g lix@15.3.13
- npm i -g lix@15.9.0
- lix install haxe $HAXE_VERSION
- lix download

script:
# - lix run travix interp # runtime stack overflow
- lix run travix neko
- lix run travix python
- lix run travix node
- lix run travix js
# - lix run travix flash
- lix run travix java
- if [[ "$(haxe -version)" =~ ^4.* ]]; then lix run travix java -D jvm; fi
- lix run travix java -D jvm
- lix run travix cpp
# - lix run travix cs # gencs stack overflow, to be investigated
- lix run travix cs -D erase-generics
- lix run travix php
- lix run travix lua

Expand Down
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

21 changes: 14 additions & 7 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"version": "0.1.0",
"command": "npm",
"args": ["run","--silent","travix","node"],
"isShellCommand": true,
"problemMatcher": "$haxe"
}
{
"version": "2.0.0",
"tasks": [
{
"type": "hxml",
"file": "dev.hxml",
"group": {
"kind": "build",
"isDefault": true
},
"label": "hxml: dev.hxml"
}
]
}
7 changes: 7 additions & 0 deletions bench.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-lib tink_streams
-lib hxnodejs
-cp tests
-main Benchmark
--dce full
-D analyzer-optimize
-js bin/bench.js
2 changes: 0 additions & 2 deletions extraParams.hxml

This file was deleted.

8 changes: 4 additions & 4 deletions haxe_libraries/hxcpp.hxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-D hxcpp=4.0.8
# @install: lix --silent download "haxelib:/hxcpp#4.0.8" into hxcpp/4.0.8/haxelib
# @run: haxelib run-dir hxcpp ${HAXE_LIBCACHE}/hxcpp/4.0.8/haxelib
-cp ${HAXE_LIBCACHE}/hxcpp/4.0.8/haxelib/
# @install: lix --silent download "haxelib:/hxcpp#4.2.1" into hxcpp/4.2.1/haxelib
# @run: haxelib run-dir hxcpp ${HAXE_LIBCACHE}/hxcpp/4.2.1/haxelib
-cp ${HAXE_LIBCACHE}/hxcpp/4.2.1/haxelib/
-D hxcpp=4.2.1
4 changes: 4 additions & 0 deletions haxe_libraries/hxcs.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# @install: lix --silent download "haxelib:/hxcs#4.2.0" into hxcs/4.2.0/haxelib
# @run: haxelib run-dir hxcs ${HAXE_LIBCACHE}/hxcs/4.2.0/haxelib
-cp ${HAXE_LIBCACHE}/hxcs/4.2.0/haxelib/
-D hxcs=4.2.0
8 changes: 4 additions & 4 deletions haxe_libraries/hxjava.hxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-D hxjava=3.2.0
# @install: lix --silent download "haxelib:/hxjava#3.2.0" into hxjava/3.2.0/haxelib
# @run: haxelib run-dir hxjava ${HAXE_LIBCACHE}/hxjava/3.2.0/haxelib
-cp ${HAXE_LIBCACHE}/hxjava/3.2.0/haxelib/
# @install: lix --silent download "haxelib:/hxjava#4.2.0" into hxjava/4.2.0/haxelib
# @run: haxelib run-dir hxjava ${HAXE_LIBCACHE}/hxjava/4.2.0/haxelib
-cp ${HAXE_LIBCACHE}/hxjava/4.2.0/haxelib/
-D hxjava=4.2.0
-java-lib lib/hxjava-std.jar
11 changes: 6 additions & 5 deletions haxe_libraries/hxnodejs.hxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# @install: lix --silent download haxelib:hxnodejs#4.0.9 into hxnodejs/4.0.9/haxelib
-D hxnodejs=4.0.9
-cp ${HAXESHIM_LIBCACHE}/hxnodejs/4.0.9/haxelib/src
-D nodejs
# @install: lix --silent download "gh://github.com/HaxeFoundation/hxnodejs#504066dc1ba5ad543afa5f6c3ea019f06136a82b" into hxnodejs/12.1.0/github/504066dc1ba5ad543afa5f6c3ea019f06136a82b
-cp ${HAXE_LIBCACHE}/hxnodejs/12.1.0/github/504066dc1ba5ad543afa5f6c3ea019f06136a82b/src
-D hxnodejs=12.1.0
--macro allowPackage('sys')
--macro _hxnodejs.VersionWarning.include()
# should behave like other target defines and not be defined in macro context
--macro define('nodejs')
--macro _internal.SuppressDeprecated.run()
6 changes: 3 additions & 3 deletions haxe_libraries/tink_core.hxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-D tink_core=1.22.0
# @install: lix --silent download "gh://github.com/haxetink/tink_core#fa752b88f6757c18da92998aeab5523fe4f28853" into tink_core/1.22.0/github/fa752b88f6757c18da92998aeab5523fe4f28853
-cp ${HAXE_LIBCACHE}/tink_core/1.22.0/github/fa752b88f6757c18da92998aeab5523fe4f28853/src
# @install: lix --silent download "gh://github.com/haxetink/tink_core#670bc1d256a657cee2e78e3554d7effe31c3682d" into tink_core/2.1.1/github/670bc1d256a657cee2e78e3554d7effe31c3682d
-cp ${HAXE_LIBCACHE}/tink_core/2.1.1/github/670bc1d256a657cee2e78e3554d7effe31c3682d/src
-D tink_core=2.1.1
6 changes: 3 additions & 3 deletions haxe_libraries/tink_testrunner.hxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-D tink_testrunner=0.7.2
# @install: lix --silent download "gh://github.com/haxetink/tink_testrunner#9a2e3cbb9ddff7269e08584f30fc425226f10aae" into tink_testrunner/0.7.2/github/9a2e3cbb9ddff7269e08584f30fc425226f10aae
# @install: lix --silent download "gh://github.com/haxetink/tink_testrunner#866de8b991be89b969825b0c0f5565d51f96a6f7" into tink_testrunner/0.8.0/github/866de8b991be89b969825b0c0f5565d51f96a6f7
-lib ansi
-lib tink_macro
-lib tink_streams
-cp ${HAXE_LIBCACHE}/tink_testrunner/0.7.2/github/9a2e3cbb9ddff7269e08584f30fc425226f10aae/src
-cp ${HAXE_LIBCACHE}/tink_testrunner/0.8.0/github/866de8b991be89b969825b0c0f5565d51f96a6f7/src
-D tink_testrunner=0.8.0
6 changes: 3 additions & 3 deletions haxe_libraries/tink_unittest.hxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-D tink_unittest=0.6.2
# @install: lix --silent download "gh://github.com/haxetink/tink_unittest#0b0c7de647e522ca42662e2cdfc59e21ed8d4eb4" into tink_unittest/0.6.2/github/0b0c7de647e522ca42662e2cdfc59e21ed8d4eb4
# @install: lix --silent download "gh://github.com/haxetink/tink_unittest#1c26b50064855d3e7810d4d871103964d5ac9fba" into tink_unittest/0.7.0/github/1c26b50064855d3e7810d4d871103964d5ac9fba
-lib tink_syntaxhub
-lib tink_testrunner
-cp ${HAXE_LIBCACHE}/tink_unittest/0.6.2/github/0b0c7de647e522ca42662e2cdfc59e21ed8d4eb4/src
-cp ${HAXE_LIBCACHE}/tink_unittest/0.7.0/github/1c26b50064855d3e7810d4d871103964d5ac9fba/src
-D tink_unittest=0.7.0
--macro tink.unit.AssertionBufferInjector.use()
11 changes: 6 additions & 5 deletions haxe_libraries/travix.hxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# @install: lix --silent download "gh://github.com/back2dos/travix#90624892ef6bd5b7bb02d359959d1b3d47553999" into travix/0.14.0/github/90624892ef6bd5b7bb02d359959d1b3d47553999
# @post-install: cd ${HAXE_LIBCACHE}/travix/0.14.0/github/90624892ef6bd5b7bb02d359959d1b3d47553999 && haxe -cp src --run travix.PostDownload
# @run: haxelib run-dir travix ${HAXE_LIBCACHE}/travix/0.14.0/github/90624892ef6bd5b7bb02d359959d1b3d47553999
# @install: lix --silent download "haxelib:/travix#0.15.3" into travix/0.15.3/haxelib
# @post-install: cd ${HAXE_LIBCACHE}/travix/0.15.3/haxelib && haxe -cp src --run travix.PostDownload
# @run: haxelib run-dir travix "${HAXE_LIBCACHE}/travix/0.15.3/haxelib"
-lib tink_cli
-cp ${HAXE_LIBCACHE}/travix/0.14.0/github/90624892ef6bd5b7bb02d359959d1b3d47553999/src
-D travix=0.14.0
-cp ${HAXE_LIBCACHE}/travix/0.15.3/haxelib/src
-D travix=0.15.3
--macro travix.Macro.setup()
30 changes: 1 addition & 29 deletions src/tink/streams/IdealStream.hx
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
package tink.streams;

import tink.streams.Stream;

using tink.CoreApi;

@:forward @:transitive
abstract IdealStream<Item>(Stream<Item, Noise>) from Stream<Item, Noise> to Stream<Item, Noise> {
@:from
public static inline function promiseOfIdealStream<Item>(p:Promise<IdealStream<Item>>):IdealStream<Item>
return cast Stream.promise(p);

@:from
public static inline function promiseOfStreamNoise<Item>(p:Promise<Stream<Item, Noise>>):IdealStream<Item>
return cast Stream.promise(p);

public function collect():Future<Array<Item>> {
var buf = [];
return this.forEach(function(x) {
buf.push(x);
return Resume;
}).map(function(c) return buf);
}
}

typedef IdealStreamObject<Item> = StreamObject<Item, Noise>;

class IdealStreamBase<Item> extends StreamBase<Item, Noise> {
override public function idealize(rescue:Error->Stream<Item,Noise>):IdealStream<Item>
return this;
}
typedef IdealStream<Item> = Stream<Item, tink.core.Noise>;
53 changes: 21 additions & 32 deletions src/tink/streams/RealStream.hx
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
package tink.streams;

import tink.streams.Stream;
import tink.streams.Stream.StreamObject;

using tink.CoreApi;

@:forward @:transitive
abstract RealStream<Item>(Stream<Item, Error>) from Stream<Item, Error> to Stream<Item, Error> {
@:from
public static inline function promiseOfIdealStream<Item>(p:Promise<IdealStream<Item>>):RealStream<Item>
return cast Stream.promise(p);

@:from
public static inline function promiseOfStreamNoise<Item>(p:Promise<Stream<Item, Noise>>):RealStream<Item>
return cast Stream.promise(p);

@:from
public static inline function promiseOfRealStream<Item>(p:Promise<RealStream<Item>>):RealStream<Item>
return cast Stream.promise(p);

@:from
public static inline function promiseOfStreamError<Item>(p:Promise<Stream<Item, Error>>):RealStream<Item>
return cast Stream.promise(p);

public function collect():Promise<Array<Item>> {
var buf = [];
return this.forEach(function(x) {
buf.push(x);
return Resume;
}).map(function(c) return switch c {
case Depleted: Success(buf);
case Failed(e): Failure(e);
case Halted(_): throw 'unreachable';
});
}
typedef RealStream<Item> = Stream<Item, tink.core.Error>;

class RealStreamTools {
static public function idealize<Item>(s:RealStream<Item>, rescue:(error:Error)->RealStream<Item>):IdealStream<Item>
return cast s;
}
typedef RealStreamObject<Item> = StreamObject<Item, Error>;
typedef RealStreamBase<Item> = StreamBase<Item, Error>;

// private class IdealizedStream<Item> implements StreamObject<Item, Noise> {

// final stream:RealStream<Item>;
// final rescue:Error->RealStream<Item>;

// public function new(stream, rescue) {
// this.stream = stream;
// this.rescue = rescue;
// }

// public function forEach<Result>(f:Consumer<Item, Result>):Future<IterationResult<Item, Result, Noise>>
// return
// stream.forEach()
// }
29 changes: 29 additions & 0 deletions src/tink/streams/Return.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package tink.streams;

using tink.CoreApi;

@:forward
abstract Return<T, Quality>(Surprise<T, Quality>) from Surprise<T, Quality> {

inline function new(v)
this = v;

public inline function asFuture()
return this;

@:from static function ofError<T>(e:Error):Return<T, Error>
return ofPromise(e);

@:from static function ofOutcome<T, Quality>(o:Outcome<T, Quality>):Return<T, Quality>
return new Return(Future.sync(o));

@:from static function ofPromise<T>(f:Promise<T>):Return<T, Error>
return new Return(f);

@:from static function ofFuture<T, Quality>(f:Future<T>):Return<T, Quality>
return new Return(f.map(Success));

@:from static function ofConst<T, Quality>(v:T):Return<T, Quality>
return ofFuture(v);

}
Loading