0
如何測試Control.Monad.Except
(兩個後衛結果)像一個函數:如何測試導入Control.Monad.Except與Hunit?
foo :: Double -> Double -> Except String Double
foo x y
| x < -10.0 = throwError "Invalid parameter"
| otherwise = pure $ x + y
使用hunit
?
好像從我迄今所看到的,不可能用非IO Monad的使用hunit。 –
hunit的替代品? – Randomize
我不確定。你有使用Except的原因嗎?我會在這裏使用'Maybe'。 –