Created
January 19, 2020 03:59
-
-
Save justinhj/ca4e24cc329bba8d12c050eeb1c64e69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def eventToState(event: BankAccountEvent): AccountState = { | |
event match { | |
case DepositEvt(time, amount) => | |
AccountState(amount, None) | |
case PurchaseEvt(time, amount) => | |
AccountState(-amount, None) | |
case AssignAccountHolderEvt(time, accountHolder) => | |
AccountState(0, accountHolder.some) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment