[Haskell-cafe] GHCi shows result of (IO a) only if (a) is in class Show

Sumit Sahrawat, Maths & Computing, IIT (BHU) sumit.sahrawat.apm13 at iitbhu.ac.in
Sat Apr 25 23:48:47 UTC 2015


If something can't be shown (converted to a string), then it can't be
printed (as a string).

On 25 April 2015 at 17:51, Daniel van den Eijkel <dvde at gmx.net> wrote:

> I wrote a parser and it took me a while to realize why GHCi suddenly did
> not show any result nor an error message anymore.
>
> My parsing function has type (IO Expression), Expression is in class Show.
>
> After changing the parser to (IO Declaration), it did not show anything
> anymore, because Declaration was not in class Show.
>
> When I typed (parseFile "input.txt" >>= print), I got the error message
> and understood what was going on. But for I while I was really confused
> what's happening.
>
> Just wanted to share this.
>
> Best,
> Daniel
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>



-- 
Regards

Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150426/04e3f32b/attachment.html>


More information about the Haskell-Cafe mailing list