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 TestX.Eqs; | |
// consider the following interfaces | |
interface Compare<T> { | |
public function compare(b:T):Int; | |
} | |
interface Eq<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
abstract Choice<A,B>(Dynamic) { | |
inline function new (x:Dynamic) this = x; | |
@:from static inline function fromA <A,B>(x:A):Choice<A,B> return new Choice(x); | |
@:from static inline function fromB <A,B>(x:B):Choice<A,B> return new Choice(x); | |
} | |
class Test { | |
public static function expectStringOrInt (x:Choice<String, Int>) { | |
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
abstract FunctionReturning<T>(Dynamic) { | |
inline function new (x:Dynamic) this = x; | |
@:from static inline function from0 <T>(x:Void->T):FunctionReturning<T> return new FunctionReturning(x); | |
@:from static inline function from1 <T>(x:Dynamic->T):FunctionReturning<T> return new FunctionReturning(x); | |
@:from static inline function from2 <T>(x:Dynamic->Dynamic->T):FunctionReturning<T> return new FunctionReturning(x); | |
@:from static inline function from3 <T>(x:Dynamic->Dynamic->Dynamic->T):FunctionReturning<T> return new FunctionReturning(x); | |
/* ... */ | |
} | |
class Test { |
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
// - Implicit and explicit PA (via partial function) | |
// - Short alternative for partial => part, foo.part(_) | |
// - Implicit as default usage (short and concise), explicit for corner cases, where implicit usage is not possible/ambigous | |
// - Explicit PA can handle all cases that implicit PA can handle + corner cases | |
// - Implicit PA is only applied if one of the arguments is an underscore | |
function foo(x:Array<Int>, ?a:Int, ?b:Int):Void; | |
// Implicit Explicit Type |
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
// two special types to fake type constructor ploymorphism. | |
@:native('Dynamic') | |
class Of<M,A> {} | |
class In {} | |
interface Functor<F> | |
{ | |
public function map<A,B>(val:Of<F,A>, f:A->B):Of<F,B>; | |
} | |
class ArrayFunctor implements Functor<Array<In>> |
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
public static function getFirstPath (from:ClassType, to:ClassType):Option<Path> | |
{ | |
function loop(from:ClassType, to:ClassType, path:Path) | |
{ | |
trace(loop); // boom, loop is null in my case | |
function findInSuperOrInterface () | |
{ | |
function findInSuper () |
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
public static function getFirstPath (from:ClassType, to:ClassType):Option<Path> | |
{ | |
function loop(from:ClassType, to:ClassType, path:Path) | |
{ | |
trace(loop); | |
return if (ClassTypes.eq(from, to)) { | |
Some(path); | |
} else { |
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 A implements B { | |
public function new () {} | |
public inline function plus (a:Int,b:Int):Int { | |
return a + b; | |
} | |
} | |
interface B { |
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
| a,((TMono x) as b) -> | |
(match !x with | |
| None -> if not (link x b a) then error [cannot_unify t1 t2] | |
| _ -> error [cannot_unify t1 t2]) | |
| ((TMono x) as a),b -> | |
(match !x with | |
| None -> if not (link x a b) then error [cannot_unify t1 t2] | |
| _ -> error [cannot_unify t1 t2]) |
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
Parsing bin/xml/neko.xml | |
Processing types | |
............................................................................................................................................................................... | |
Generating navigation | |
Generating to bin/pages | |
............................................................................................................................................................... | |
Generated 309 types in 20 packages | |
Copying resources from /media/frabbit/data/work/projects/github/dox-py/themes/default/resources | |
Done (11.01s) | |
16742913 function calls (16397456 primitive calls) in 11.586 seconds |