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