Skip to content

Instantly share code, notes, and snippets.

@dewey92
Created April 30, 2018 07:22
Show Gist options
  • Select an option

  • Save dewey92/4c38ee9b9faadcb0f3068f55e23edf48 to your computer and use it in GitHub Desktop.

Select an option

Save dewey92/4c38ee9b9faadcb0f3068f55e23edf48 to your computer and use it in GitHub Desktop.
Better Transaksi Bambang
const accRepo: AccountRepo = {
find: no => ({ name: 'Bambang', email: 'tampan@tampan.com' })
};
declare function debit(no: string, amount: number): () => Reader<AccountRepo, Account>;
declare function credit(no: string, amount: number): () => Reader<AccountRepo, Account>;
declare function balance(no: string): () => Reader<AccountRepo, number>;
const transaksiBambangF = (no: string) => composeK(
balance(no), // <- Cleaner
credit(no, 80),
debit(no, 50),
debit(no, 100)
);
const finalbalanceF = transaksiBambangF('NL90DLBK0286293543')(accRepo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment