Prelude> id
<interactive>:6:1:
No instance for (Show (a0 -> a0))
(maybe you haven't applied enough arguments to a function?)
arising from a use of `print'
In a stmt of an interactive GHCi command: print it
Prelude>
Prelude> return idPrelude>
Yes, but ghci shows an error if it can't print a value, except when the value is in IO monad. Compare:
Prelude> id
<interactive>:6:1:
No instance for (Show (a0 -> a0))
(maybe you haven't applied enough arguments to a function?)
arising from a use of `print'
In a stmt of an interactive GHCi command: print it
Prelude>and
Prelude> return idPrelude>
воскресенье, 26 апреля 2015 г., 5:48:55 UTC+6 пользователь Sumit Sahrawat, Maths & Computing, IIT (BHU) написал: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 <dv...@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
Haskel...@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
--RegardsSumit Sahrawat
Yes, but ghci shows an error if it can't print a value, except when the value is in IO monad. Compare:
Prelude> id
<interactive>:6:1:
No instance for (Show (a0 -> a0))
(maybe you haven't applied enough arguments to a function?)
arising from a use of `print'
In a stmt of an interactive GHCi command: print it
Prelude>and
Prelude> return idPrelude>
воскресенье, 26 апреля 2015 г., 5:48:55 UTC+6 пользователь Sumit Sahrawat, Maths & Computing, IIT (BHU) написал: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 <dv...@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
Haskel...@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
--RegardsSumit Sahrawat