[Haskell-beginners] confused by <-

Ertugrul Söylemez es at ertes.de
Thu Sep 27 01:53:23 CEST 2012


Bryce Verdier <bryceverdier at gmail.com> wrote:

> This is the new code that is trying to use try (imported from 
> Control.Exception)
> getGoogR = do
>      body <- try {- [...] -}
>
> [...]
>
> I'm sure that my problem has a simple fix, but I just don't know what
> it is. I will be happy to share any other code if people ask, I'm just
> giving the short version for brevities sake.

The fix is indeed simple.  In fact you're just using the wrong 'try',
because Yesod handlers aren't IO actions, but actions in a monad that is
specific to your application, called Handler.  The error message
suggests that, although the type is spelled out completely there.

What you want is the lifted version of 'try', which you find in the
Control.Exception.Lifted module.


Greets,
Ertugrul

-- 
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120927/5bde9795/attachment.pgp>


More information about the Beginners mailing list