// Generated by purs version 0.14.5
"use strict";
var $foreign = require("./foreign.js");
var Data_Symbol = require("../Data.Symbol/index.js");
var Data_Unit = require("../Data.Unit/index.js");
var Record_Unsafe = require("../Record.Unsafe/index.js");
var Type_Proxy = require("../Type.Proxy/index.js");
var zeroRecord = function (dict) {
    return dict.zeroRecord;
};
var zero = function (dict) {
    return dict.zero;
};
var semiringUnit = {
    add: function (v) {
        return function (v1) {
            return Data_Unit.unit;
        };
    },
    zero: Data_Unit.unit,
    mul: function (v) {
        return function (v1) {
            return Data_Unit.unit;
        };
    },
    one: Data_Unit.unit
};
var semiringRecordNil = {
    addRecord: function (v) {
        return function (v1) {
            return function (v2) {
                return {};
            };
        };
    },
    mulRecord: function (v) {
        return function (v1) {
            return function (v2) {
                return {};
            };
        };
    },
    oneRecord: function (v) {
        return function (v1) {
            return {};
        };
    },
    zeroRecord: function (v) {
        return function (v1) {
            return {};
        };
    }
};
var semiringProxy3 = {
    add: function (v) {
        return function (v1) {
            return Type_Proxy.Proxy3.value;
        };
    },
    mul: function (v) {
        return function (v1) {
            return Type_Proxy.Proxy3.value;
        };
    },
    one: Type_Proxy.Proxy3.value,
    zero: Type_Proxy.Proxy3.value
};
var semiringProxy2 = {
    add: function (v) {
        return function (v1) {
            return Type_Proxy.Proxy2.value;
        };
    },
    mul: function (v) {
        return function (v1) {
            return Type_Proxy.Proxy2.value;
        };
    },
    one: Type_Proxy.Proxy2.value,
    zero: Type_Proxy.Proxy2.value
};
var semiringProxy = {
    add: function (v) {
        return function (v1) {
            return Type_Proxy["Proxy"].value;
        };
    },
    mul: function (v) {
        return function (v1) {
            return Type_Proxy["Proxy"].value;
        };
    },
    one: Type_Proxy["Proxy"].value,
    zero: Type_Proxy["Proxy"].value
};
var semiringNumber = {
    add: $foreign.numAdd,
    zero: 0.0,
    mul: $foreign.numMul,
    one: 1.0
};
var semiringInt = {
    add: $foreign.intAdd,
    zero: 0,
    mul: $foreign.intMul,
    one: 1
};
var oneRecord = function (dict) {
    return dict.oneRecord;
};
var one = function (dict) {
    return dict.one;
};
var mulRecord = function (dict) {
    return dict.mulRecord;
};
var mul = function (dict) {
    return dict.mul;
};
var addRecord = function (dict) {
    return dict.addRecord;
};
var semiringRecord = function (dictRowToList) {
    return function (dictSemiringRecord) {
        return {
            add: addRecord(dictSemiringRecord)(Type_Proxy["Proxy"].value),
            mul: mulRecord(dictSemiringRecord)(Type_Proxy["Proxy"].value),
            one: oneRecord(dictSemiringRecord)(Type_Proxy["Proxy"].value)(Type_Proxy["Proxy"].value),
            zero: zeroRecord(dictSemiringRecord)(Type_Proxy["Proxy"].value)(Type_Proxy["Proxy"].value)
        };
    };
};
var add = function (dict) {
    return dict.add;
};
var semiringFn = function (dictSemiring) {
    return {
        add: function (f) {
            return function (g) {
                return function (x) {
                    return add(dictSemiring)(f(x))(g(x));
                };
            };
        },
        zero: function (v) {
            return zero(dictSemiring);
        },
        mul: function (f) {
            return function (g) {
                return function (x) {
                    return mul(dictSemiring)(f(x))(g(x));
                };
            };
        },
        one: function (v) {
            return one(dictSemiring);
        }
    };
};
var semiringRecordCons = function (dictIsSymbol) {
    return function (dictCons) {
        return function (dictSemiringRecord) {
            return function (dictSemiring) {
                return {
                    addRecord: function (v) {
                        return function (ra) {
                            return function (rb) {
                                var tail = addRecord(dictSemiringRecord)(Type_Proxy["Proxy"].value)(ra)(rb);
                                var key = Data_Symbol.reflectSymbol(dictIsSymbol)(Type_Proxy["Proxy"].value);
                                var insert = Record_Unsafe.unsafeSet(key);
                                var get = Record_Unsafe.unsafeGet(key);
                                return insert(add(dictSemiring)(get(ra))(get(rb)))(tail);
                            };
                        };
                    },
                    mulRecord: function (v) {
                        return function (ra) {
                            return function (rb) {
                                var tail = mulRecord(dictSemiringRecord)(Type_Proxy["Proxy"].value)(ra)(rb);
                                var key = Data_Symbol.reflectSymbol(dictIsSymbol)(Type_Proxy["Proxy"].value);
                                var insert = Record_Unsafe.unsafeSet(key);
                                var get = Record_Unsafe.unsafeGet(key);
                                return insert(mul(dictSemiring)(get(ra))(get(rb)))(tail);
                            };
                        };
                    },
                    oneRecord: function (v) {
                        return function (v1) {
                            var tail = oneRecord(dictSemiringRecord)(Type_Proxy["Proxy"].value)(Type_Proxy["Proxy"].value);
                            var key = Data_Symbol.reflectSymbol(dictIsSymbol)(Type_Proxy["Proxy"].value);
                            var insert = Record_Unsafe.unsafeSet(key);
                            return insert(one(dictSemiring))(tail);
                        };
                    },
                    zeroRecord: function (v) {
                        return function (v1) {
                            var tail = zeroRecord(dictSemiringRecord)(Type_Proxy["Proxy"].value)(Type_Proxy["Proxy"].value);
                            var key = Data_Symbol.reflectSymbol(dictIsSymbol)(Type_Proxy["Proxy"].value);
                            var insert = Record_Unsafe.unsafeSet(key);
                            return insert(zero(dictSemiring))(tail);
                        };
                    }
                };
            };
        };
    };
};
module.exports = {
    add: add,
    zero: zero,
    mul: mul,
    one: one,
    addRecord: addRecord,
    mulRecord: mulRecord,
    oneRecord: oneRecord,
    zeroRecord: zeroRecord,
    semiringInt: semiringInt,
    semiringNumber: semiringNumber,
    semiringFn: semiringFn,
    semiringUnit: semiringUnit,
    semiringProxy: semiringProxy,
    semiringProxy2: semiringProxy2,
    semiringProxy3: semiringProxy3,
    semiringRecord: semiringRecord,
    semiringRecordNil: semiringRecordNil,
    semiringRecordCons: semiringRecordCons
};
