Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for function aliases/references/lambdas #2

Open
sebthom opened this issue Feb 26, 2023 · 1 comment
Open

Support for function aliases/references/lambdas #2

sebthom opened this issue Feb 26, 2023 · 1 comment

Comments

@sebthom
Copy link

sebthom commented Feb 26, 2023

Hi Andreas,
great library! I was wondering if something like this could be made possible in the library.

typedef Callback = (name:String) -> Void;
typedef Veto = (name:String) -> Bool;

class Test {

  static function main() {
    final vetoFunc = (name:String) -> name.length > 10;

    final union:Union3<String, Callback, Veto> = vetoFunc;
    
    switch(union.type()) {
      case String(s): trace(s);
      case Callback(cb): trace(cb);
      case Veto (veto): trace(veto);
    }
  }
}
@ciscoheat
Copy link
Owner

Hello, Sebastian! Glad you like it, unfortunately I'm not very focused on Haxe at present, so I can't promise that I'll make this work in the near time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants