With:
mailHandler = do
name <- param "name"
email <- param "email"
renderSendMail $ forwardMail name email
main = scotty 3000 $ post "/mail" mailHandler
I get the following type error:
Couldn't match type `IO'
with `Web.Scotty.Internal.Types.ActionT T.Text IO'
Expected type: Web.Scotty.Internal.Types.ActionT T.Text IO ()
Actual type: IO ()
In a stmt of a 'do' block: renderSendMail $ forwardMail name email
In the expression:
do { name <- param "name";
email <- param "email";
renderSendMail $ forwardMail name email }
In an equation for `mailHandler':
mailHandler
= do { name <- param "name";
email <- param "email";
renderSendMail $ forwardMail name email }
Failed to install server-0.0.1
cabal: Error: some packages failed to install:
server-0.0.1 failed during the building phase. The exception was:
ExitFailure 1
After spending several hours, I still don't see how to resolve this. If I use a function internal to Scotty, no problem, but if I want to handling anything externally I get the error above. How can I get past this Web.Scotty.Internal.Types.ActionT T.Text IO ()
Web.Scotty.Internal.Types.ActionT T.Text IO () is a monad transformer over IO. These usually implement the MonadIO class, so that you can use the liftIO function (from Control.Monad.IO.Class, if it hasn't been imported already) to "lift" IO actions into them:
liftIO . renderSendMail $ forwardMail name email
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With