Hi There,<br>   Here is a very simple haskell program I have written to find whether a number is prime or not, which doesn&#39;t give me any compilation error but gives following run-time error :<br><br>Any help would help me move ahead, I know that the type concepts is what I am lacking, anly pointer to simple/good article/paper would definitely help.<br>
<br>Lots of thannx jut even to look at the mail :-)<br><br>Regards<br>Kaushal<br><br><font size="4"><u><b>Run Time Error :</b></u></font><br><br>kaushal &gt; isPrime1 171<br><br>&lt;interactive&gt;:1:0:<br>    Ambiguous type variable `t&#39; in the constraints:<br>
      `Integral t&#39;<br>        arising from a use of `isPrime1&#39; at &lt;interactive&gt;:1:0-11<br>      `Floating t&#39;<br>        arising from a use of `isPrime1&#39; at &lt;interactive&gt;:1:0-11<br>      `RealFrac t&#39;<br>
        arising from a use of `isPrime1&#39; at &lt;interactive&gt;:1:0-11<br>    Probable fix: add a type signature that fixes these type variable(s)<br>kaushal &gt; <br><br><font size="4"><u><b>Program :</b></u></font><br>
<br>isPrime1 x =<br>    let canDivide num 0 = 0<br>        canDivide num 1 = 0<br>        canDivide num divisor = if ((mod num divisor) == 0) then 1<br>                                else canDivide num (divisor - 1)<br>    in<br>
        if ( x == 1 ) <br>        then putStrLn(&quot;1 is Neither prime nor composite!!!&quot;) <br>        else if ((canDivide x first_div) == 1) <br>             then putStrLn(show(x) ++ &quot; is not a Prime Number!!!&quot;)<br>
             else putStrLn(show(x) ++ &quot; is a Prime Number!!!&quot;)<br>        where<br>        first_div :: Integral a =&gt; a ; first_div = round (sqrt x)<br><br>