[Haskell-beginners] confused by <-

Bryce Verdier bryceverdier at gmail.com
Thu Sep 27 19:38:31 CEST 2012

On 9/27/12 10:33 AM, Brent Yorgey wrote:
> On Thu, Sep 27, 2012 at 10:01:25AM -0700, Bryce Verdier wrote:
>> On 9/26/12 6:00 PM, Ertugrul Söylemez wrote:
>>> Bryce Verdier <bryceverdier at gmail.com> wrote:
>>>>       body <- L.try (simpleHttp "http://www.google.com") :: IO (Either
>>>> L.SomeException Data.ByteString.Lazy.Internal.ByteString)
>>> Almost right, but your type signature is lying. =)
>>> Greets,
>>> Ertugrul
>> Thanks for your hint, with a fair amount of head bashing against a
>> wall I was able to figure this out. At the end of day I got :
>>      body <- try (simpleHttp "http://www.google.com") :: GHandler
>> PlayHaven PlayHaven (Either SomeException ByteString)
> Do you need a type signature there at all?
> -Brent
That is an awesome question. Originally I tried:

        body <- try (simpleHttp "http://www.google.com")

and I got this error:
     Ambiguous type variable `a0' in the constraints:
       (Show a0) arising from a use of `show' at playhaven.hs:54:73-76
       (Exception a0) arising from a use of `try' at playhaven.hs:52:13-15
     Probable fix: add a type signature that fixes these type variable(s)

So I figured that adding the type signature would help with it. If you 
know of another way to make this work I would really like to hear about it.


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

More information about the Beginners mailing list