import {Option, fromNullable} from 'fp-ts/lib/Option'; // keep it simple export type Account = string; export interface Bank { balance: (account: Account) => Option; deposit: (account: Account, amt: number) => void; withdraw: (account: Account, amt: number) => void; } export class SimpleBank implements Bank { private accounts: Map; constructor(accounts: Map) { // clone the content of the map this.accounts = new Map(accounts); } balance(account: Account): Option { return fromNullable(this.accounts.get(account)); } deposit(account: Account, amt: number): void { throw new Error('Method not implemented.'); } withdraw(account: Account, amt: number): void { throw new Error('Method not implemented.'); } }