diff --git a/test/Course/StateSpec.hs b/test/Course/StateSpec.hs index 29b21dbe..041a0407 100644 --- a/test/Course/StateSpec.hs +++ b/test/Course/StateSpec.hs @@ -49,6 +49,8 @@ spec = do describe "Monad" $ do it "(=<<)" $ runState ((const $ put 2) =<< put 1) 0 `shouldBe` ((),2) + it "correctly produces new state and value" $ + runState ((\a -> State (\s -> (a + s, 10 + s))) =<< State (\s -> (s * 2, 4 + s))) 2 `shouldBe` (10, 16) it "(>>=)" $ let modify f = State (\s -> ((), f s)) in runState (modify (+1) >>= \() -> modify (*2)) 7 `shouldBe` ((),16)