Thank you all for the help. This was most helpful.<br><br>Regards,<br>Weiyuan<br><br><br><div class="gmail_quote">On Fri, May 9, 2008 at 8:16 AM, Brett G. Giles &lt;<a href="mailto:brett.giles@ucalgary.ca">brett.giles@ucalgary.ca</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Wei<br>
<br>
Haskell needs to know that it can legally apply the function &quot;shift&quot;.<br>
So, as requested, you need to add context to the typing of &quot;test&quot;.<br>
<br>
if you define your function as:<br>
<br>
test :: (Data.Bits.Bits a) =&gt; a -&gt; Int -&gt; a<br>
<div class="Ih2E3d">test x n = shift x n<br>
<br>
</div>you should be fine.<br>
<div><div></div><div class="Wj3C7c"><br>
On Fri, 2008-05-09 at 03:10 +0800, Wei Yuan Cai wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; I&#39;m having some trouble with a polymorphic function using another<br>
&gt; polymorphic function within. A simplified code of what I&#39;m trying to<br>
&gt; do is as follows:<br>
&gt;<br>
&gt; main = print $ test 1 8<br>
&gt;<br>
&gt; test :: a -&gt; Int -&gt; a<br>
&gt; test x n = shift x n<br>
&gt;<br>
&gt; I get the following compilation error:<br>
&gt;<br>
&gt; Could not deduce (Data.Bits.Bits a) from the context ()<br>
&gt; &nbsp; &nbsp; &nbsp; arising from a use of `shift&#39; at test.hs:8:11-19<br>
&gt; &nbsp; &nbsp; Possible fix:<br>
&gt; &nbsp; &nbsp; &nbsp; add (Data.Bits.Bits a) to the context of<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; the type signature for `test&#39;<br>
&gt; &nbsp; &nbsp; In the expression: shift x n<br>
&gt; &nbsp; &nbsp; In the definition of `test&#39;: test x n = shift x n<br>
&gt;<br>
&gt;<br>
&gt; shift is defined as &quot;a -&gt; Int -&gt; a&quot;<br>
&gt;<br>
&gt; What am I doing wrong here?<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Weiyuan<br>
</div></div><div><div></div><div class="Wj3C7c">&gt; _______________________________________________<br>
&gt; Haskell mailing list<br>
&gt; <a href="mailto:Haskell@haskell.org">Haskell@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell" target="_blank">http://www.haskell.org/mailman/listinfo/haskell</a><br>
<br>
</div></div></blockquote></div><br>