[Haskell-beginners] confused by <-

Bryce Verdier bryceverdier at gmail.com
Thu Sep 27 02:31:46 CEST 2012


On 9/26/12 4:53 PM, Ertugrul Söylemez wrote:
> 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

Thank you for the reply Ertugrul, sadly that didn't seem to help. :(

Here are my changes:
import qualified Control.Exception.Lifted as L
...

     body <- L.try (simpleHttp "http://www.google.com") :: IO (Either 
L.SomeException Data.ByteString.Lazy.Internal.ByteString)


I did the full qualified because the first time I tried your suggestion 
I just "Control.Exception.Lifted" and I got the same error as I'm 
sharing below.

playhaven.hs:51:19:
     Couldn't match expected type `IO b0'
                 with actual type `GHandler sub0 master0 RepJson'
     In the expression:


Thanks for being willing to help me with this.
Bryce


>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120926/ceaee65d/attachment.htm>


More information about the Beginners mailing list