
7 Jul
2015
7 Jul
'15
6:46 a.m.
'a1' is new variable
Thank you Daniel! is there a way to "freeze" outside variables into constants which can be used as "case" statement patterns? for example if I use "if", the below test passes. It would be handy to use case statement instead of multiple ifs or guards main::IO() main = hspec $ do describe "TestCase" $ do it "case 1 - pass" $ do result1 1 `shouldBe` "one" it "case 2 - pass" $ do result1 2 `shouldBe` "two" where result1 x = if x == a1 then "one" else if x == a2 then "two" else "three" where a1 = 1 a2 = 2