From eecfd765f30d06c2fd59f06c08b02f2b00cfc2b2 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 6 Feb 2020 19:44:06 +0000 Subject: [PATCH] Simple EA Funds variant --- src/EAFunds.bs.js | 36 ++++++++++++++++++++++++++++++++++++ src/EAFunds.re | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 src/EAFunds.bs.js create mode 100644 src/EAFunds.re diff --git a/src/EAFunds.bs.js b/src/EAFunds.bs.js new file mode 100644 index 00000000..d34b90ba --- /dev/null +++ b/src/EAFunds.bs.js @@ -0,0 +1,36 @@ +'use strict'; + + +function yearlyMeanGrowthRateIfNotClosed(group) { + return { + meanDiff: 1.1, + stdDiff: 1.1 + }; +} + +function yearlyChanceOfClosing(group) { + return 0.1; +} + +function yearlyStdevGrowthRate(group, year, parameter) { + if (group) { + return /* tuple */[ + 30, + 30 + ]; + } else { + return /* tuple */[ + 50, + 10 + ]; + } +} + +var PayoutsIfAround = { + yearlyMeanGrowthRateIfNotClosed: yearlyMeanGrowthRateIfNotClosed, + yearlyChanceOfClosing: yearlyChanceOfClosing, + yearlyStdevGrowthRate: yearlyStdevGrowthRate +}; + +exports.PayoutsIfAround = PayoutsIfAround; +/* No side effect */ diff --git a/src/EAFunds.re b/src/EAFunds.re new file mode 100644 index 00000000..d72ae583 --- /dev/null +++ b/src/EAFunds.re @@ -0,0 +1,39 @@ +type fund = + | ANIMAL_WELFARE + | GLOBAL_HEALTH + | LONG_TERM_FUTURE + | META; + +type group = + | Fund(fund) + | All; + +type parameter = + | CHANCE_CLOSED + | DONATIONS + | PAYOUTS; + +type yearlyNumericDiff = { + meanDiff: float, + stdDiff: float, +}; + +module PayoutsIfAround = { + let yearlyMeanGrowthRateIfNotClosed = (group: group): yearlyNumericDiff => { + {meanDiff: 1.1, stdDiff: 1.1}; + }; + + let yearlyChanceOfClosing = (group: group) => { + 0.1; + }; + + let yearlyStdevGrowthRate = (group: group, year: int, parameter: parameter) => { + switch (group) { + | Fund(ANIMAL_WELFARE) => (30, 30) + | Fund(GLOBAL_HEALTH) => (30, 30) + | Fund(LONG_TERM_FUTURE) => (30, 30) + | Fund(META) => (30, 30) + | All => (50, 10) + }; + }; +}; \ No newline at end of file