Skip to content

Instantly share code, notes, and snippets.

@Gryff
Created February 21, 2019 11:18
Show Gist options
  • Save Gryff/d576545121e4936f7fc016c9e2f5b940 to your computer and use it in GitHub Desktop.
Save Gryff/d576545121e4936f7fc016c9e2f5b940 to your computer and use it in GitHub Desktop.
testPrintStatement :: StateT [Transaction] (Writer String) ()
testPrintStatement = innerPrintStatement (\statement -> tell statement)
it "prints a statement" $ do
  -- evalStateT works just like evalState, except it will return us a `Writer String ()` instead of just `()`
  -- we can then use execWriter to get the String from Writer String ()
  execWriter (evalStateT testPrintStatement [Deposit 100, Withdrawal 50]) `shouldBe` "Deposited 100\nWithdrew 50"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment