function SumType (name, constructors) {
    this._name = name;
    //this._constructors = constructors;
    this._consMap = {};
    // mapping constructors for named access
    for (var i = 0; i<constructors.length; i++) {
        this._consMap[constructors[i]._name] = constructors[i];
        // processing any recursive type definitions if found
        for (prop in constructors[i]._fields) {
            var t = constructors[i]._fields[prop];
            if (t === Types.__SELF__) {
                //console.log("Found recursion!");
                constructors[i]._fields[prop] = this;
            }
        }
    }
    // processing recursion
    Types[name] = this;
}
// sum types - basically a hashmap of product constructors
sum types - basically a hashmap of product constructors
sum types - basically a hashmap of product constructors
function SumType (name, constructors) {
    this._name = name;
    this._consMap = {};
    for (var i = 0; i<constructors.length; i++) {
        this._consMap[constructors[i]._name] = constructors[i];
        for (prop in constructors[i]._fields) {
            var t = constructors[i]._fields[prop];
            if (t === Types.__SELF__) {
                constructors[i]._fields[prop] = this;
            }
        }
    }
    Types[name] = this;
}
function SumType ( name , constructors ) { this . _name = name ; this . _consMap = { } ; for ( var i = 0 ; i < constructors . length ; i ++ ) { this . _consMap [ constructors [ i ] . _name ] = constructors [ i ] ; for ( prop in constructors [ i ] . _fields ) { var t = constructors [ i ] . _fields [ prop ] ; if ( t === Types . __SELF__ ) { constructors [ i ] . _fields [ prop ] = this ; } } } Types [ name ] = this ; }
sum types - basically a hashmap of product constructors
sum types - basically a hashmap of product constructors
//this._constructors = constructors; // mapping constructors for named access // processing any recursive type definitions if found //console.log("Found recursion!"); // processing recursion