Haxe Code Cookbook

Easy to read Haxe coding examples.

Start browsing..

Beginner (13)Abstract types (5)Compilation (1)Data structures (4)Design patterns (3)Functional Programming (1)Macros (16)Principles (3)Other (5)


 macro-function (9) building-fields (7) build-macro (6) abstract-type (6) enum (5) data-structures (4) iterator (3) validation (3) collections (3) dead-code-elimination (3) javascript (3) pattern-matching (3) class (3) array (3) math (2) ereg (2) arguments (2) conditional-compilation (2) libraries (2) static-extension (2) cppia (1) canvas (1) type-parameter (1) modules (1) git (1) extern (1) type-parameter-constraint (1) process (1) type-params (1) reflection (1) functional-programming (1) filesystem (1) build-function (1) completion (1) binary (1) json (1)

Newest articles

03-01-2017 Functional Programming / Enums as GADTs

As already established Haxe enums are a form of algebraic data types. In fact, they may even serve as so called generalized algebraic data types - GADTs for short. While for an ordinary enum every constructor yields the same type, with an GADT each constructor may yield a different type. ‥

Read »

03-01-2017 Macros / Generating Arrays with values

Sometimes it is useful make your arrays compile-time, for example to embed data from files, to pre-calculate heavy calculations, generating lookup tables and other similar things. With macros this is perfectly doable but requires some basic knowledge of expression building. In this article you will find out how to build arrays and return them as expressions in a macro function.‥

Read »

15-12-2016 Beginner / Using maps

In Haxe, Map (also known as dictionary) allows key to value mapping for arbitrary value types and many key types. ‥

Read »

Learning by example

The Haxe Foundation facilitates the following code cookbook for the Haxe commmunity. Enjoy learning Haxe; It is great!

More documentation

Haxe Manual

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Contribution is easy

The project is being developed on GitHub. Feel free to contribute code snippets.

Haxe Code Cookbook on Github