On Fri, Aug 7, 2015 at 11:15 AM, Shishir Srivastava <shishir.srivastava@gmail.com> wrote:
Prelude> :set +m
Prelude> let main1 = do
Prelude|             a <- readLn
Prelude|             return a
Prelude|
Prelude>
Prelude> main1

<interactive>:75:1:
    No instance for (Show (IO b0)) arising from a use of `print'

In an actual program, it would be able to apply defaulting rules and monomorphize `b0` to Integer. The somewhat unusual ghci environment, in particular how it tries to figure out whether to evaluate an expression and `print` the result or instead run an IO action --- coupled with the monomorphism restriction being disabled in the interactive context in ghci 7.8 and later --- is working against you here. As a result, you need to specify a result type when invoking `main1`, which is what the error message is telling you.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net