This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ; | |
using Main.ListTypes; | |
using Main.Tuple2Types; | |
enum ListType<T> { | |
Nil; | |
Cons(head : T, tail : List<T>); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ; | |
import haxe.macro.Expr; | |
import haxe.macro.Context; | |
@:remove @:autoBuild(CaseClassImpl.build()) | |
extern interface CaseClass {} | |
class CaseClassImpl { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
static function main(){ | |
var a = Cons(1, Nil); | |
trace(a); | |
trace(ListLens.mutate(a, 2)); | |
trace(a); | |
/* | |
Output from the above traces - this is dangerous ;-) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ; | |
@:remove | |
@:autoBuild(IsolateTypes.build()) | |
extern interface Isolate {} | |
class Isolates { | |
private static var _isolates : Array<Class<Isolate>> = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
static function main(){ | |
var val0 : A<Int> = a(1); // This is fine. | |
trace(val0); | |
var val1 : A<A<Int>> = a(a(1)); // This fails. | |
trace(val1); | |
} | |
} | |
enum AType<T> { | |
a(v : T); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
static function main(){ | |
try { | |
//throw a(1); | |
throw b('1'); | |
} catch (e : A) { | |
trace(e); | |
} catch (e : B) { | |
trace(e); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I think this should be valid syntax | |
do remove() if (once()); | |
// which is similar to | |
do remove() while(once()); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('fantasy-promises'); | |
/** | |
## isPromise(a) | |
Returns `true` if `a` is `Promise`. | |
**/ | |
var isPromise = isInstanceOf(Promise); | |
bilby = bilby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I've got quite a convoluted example, but it boils down to this, sort of. | |
(function(global){ | |
function functionName(f) { | |
return f._name || f.name; // In istanbul this actually comes back as being not tested, even though it is. | |
} | |
global.functionName = functionName; | |
})(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = _.List(_.Some(_.Right(1)), _.Some(_.Left('Error'))); | |
var result = a.match({ | |
Some: { | |
Right: partial( | |
function(a) { | |
return a == 1; | |
}, | |
_.identity | |
), | |
Right: _.constant(-1), |