When trying to compile the last source code changes for chapter 3, I received the following error:
Lib.hs:46:3: error:
• No instance for (Control.Monad.Fail.MonadFail App)
arising from a do statement
with the failable pattern ‘Just registeredEmail’
• In a stmt of a 'do' block: Just registeredEmail <- getUser uId
In the expression:
do let email = either undefined id $ mkEmail "ecky@test.com"
passw = either undefined id $ mkPassword "1234ABCDefgh"
....
register auth
Just vCode <- M.getNotificationsForEmail email
verifyEmail vCode
....
In an equation for ‘action’:
action
= do let email = ...
....
register auth
Just vCode <- M.getNotificationsForEmail email
....
|
46 | Just registeredEmail <- getUser uId
I found a resolution on Reddit, and I've copied it to ensure it survives.
Into Lib.hs I imported
import Control.Monad ( MonadFail )
and added MonadFail to App's deriving list:
newtype App a = App
{ unApp :: ReaderT State IO a
} deriving (Applicative, Functor, Monad, MonadReader State, MonadIO, MonadFail)
which allowed me to build, and run somefunc into the repl
ghci> someFunc
("1Bk40ZG6XGJ1bsqWV",1,Email {emailRaw = "ecky@test.com"})
When trying to compile the last source code changes for chapter 3, I received the following error:
I found a resolution on Reddit, and I've copied it to ensure it survives.
Into
Lib.hsI importedand added MonadFail to App's deriving list:
which allowed me to build, and run
somefuncinto the repl