<div dir="ltr"><span style="font-family: courier new,monospace;">warn :: String $B"*(B IO Int</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">warn = return 1 << putStrLn -- causes an error</span><br>
<span style="font-family: courier new,monospace;"> -- = \msg $B"*(B return 1 << putStrLn msg -- works just fine</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> -- = \msg $B"*(B putStrLn msg >> return 1 -- works just fine</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(<<) :: Monad m $B"M(B m b $B"*(B m a $B"*(B m b</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">b << a = a >>= \_ $B"*(B b<br>
<br><font face="arial,helvetica,sans-serif">Why do I get this compile-time error?? How can one define << ?</font><br><br>cetin@linux-d312:~/lab/test/qths/p> ghc -fglasgow-exts -O2 -o d64x --make demo2.hs system.hs<br>
[1 of 2] Compiling Netman.System ( system.hs, system.o )<br><br>system.hs:23:14:<br> No instance for (Num (IO Int))<br> arising from the literal `1' at system.hs:23:14<br> Possible fix: add an instance declaration for (Num (IO Int))<br>
In the first argument of `return', namely `1'<br> In the first argument of `(<<)', namely `return 1'<br> In the expression: return 1 << putStrLn<br style="font-family: courier new,monospace;">
</span><br style="font-family: courier new,monospace;"></div>