How can I test Control.Monad.Except (both guard results) a function like:
foo :: Double -> Double -> Except String Double
foo x y
| x < -10.0 = throwError "Invalid parameter"
| otherwise = pure $ x + y
using hunit?
How can I test Control.Monad.Except (both guard results) a function like:
foo :: Double -> Double -> Except String Double
foo x y
| x < -10.0 = throwError "Invalid parameter"
| otherwise = pure $ x + y
using hunit?
Copyright © 2021 Jogjafile Inc.
It's pretty straightforward to write some functions which use
runExceptto execute anExceptaction and use~?=to check its results.Example usage: