Closed ScottSedgwick closed 5 years ago
Adding runAppM
is correct. However you've updated the test to suit what your code was doing, not what the test is trying to check for, which is not correct.
The expectation is that you implement the readConfFile
function so when you runAppM
the value that is returned is Right
when you successfully read the file, or Left
with reason that reading the file failed. Using the try
function or something else from Control.Exception
we're able to execute functions and not let exceptions escape.
This will require that you be explicit about what type of exception you're going to want to catch. Since we're reading a file, the choice of IOException
is the most appropriate. Since things like ArithException
and AsyncException
don't make much sense in this context.
The undefined
can then be updated to be the constructor from ConfigError
that you create to wrap the exception. Using show
on the exception is sufficient for this exercise.
In
src/Level06/Conf/File.hs
: Changeto
and change
to