0.0.2 • Published 9 years ago

monax v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

h1. Monax macro library.

This library, built on top of Haxe macros give the user the possibility to define specific Monad instance and get automatically access to a haskell like sugared syntax. About monad: http://en.wikipedia.org/wiki/Monad_(functional_programming)#Background

The syntactic sugar rely on the existence 'ret' and 'flatMap' in the Monad instance. It also requiers the existence of 'map' to provide automatic optimisations.

h2. Learn the (not so) hard way - Defining a Monad instance.

h2. Using a Monad instance (Option here).

Due to optimisations; this code reduce to Some(165), those optimisations are applied by default. One can define his own optimisations (feeding the Monad.dO method its last parameter)

(please refer to the default function code to make sense of how to make optimization - macro knowledge requiered).

or using no optimisation at all:

h2. Syntactic Sugar support.

Monax provides some leaner syntax: