aah .. Thanks a lot Brandon, you were right .. I was getting a Int and was destructuring for tuple.. Thanks again<div>Sunil.<br><div><br><div class="gmail_quote">On Thu, Aug 11, 2011 at 5:33 PM, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com">allbery.b@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr"><div class="im">On Thu, Aug 11, 2011 at 07:43, Sunil S Nandihalli <span dir="ltr"><<a href="mailto:sunil.nandihalli@gmail.com" target="_blank">sunil.nandihalli@gmail.com</a>></span> wrote:<br>
</div><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Hello everybody,</div><div> when I compile the file </div><div><br></div><div><a href="https://github.com/sunilnandihalli/is2/blob/master/main.hs" target="_blank">https://github.com/sunilnandihalli/is2/blob/master/main.hs</a></div>
<div><br></div><div>I get </div><div>main.hs:28:64:</div><div> Could not deduce (Enum (a, t0))</div><div> arising from the arithmetic sequence `0 .. '</div><div> from the context (Integral a)</div><div> bound by the type signature for</div>
<div> plotAsString :: Integral a => [(a, a)] -> (a, a) -> String</div><div> at main.hs:(26,1)-(38,41)</div><div> Possible fix:</div><div> add (Enum (a, t0)) to the context of</div><div>
the type signature for</div><div> plotAsString :: Integral a => [(a, a)] -> (a, a) -> String</div><div> or add an instance declaration for (Enum (a, t0))</div><div> In the second argument of `zip', namely `[0 .. ]'</div>
<div> In the first argument of `M.fromList', namely `(zip locs [0 .. ])'</div><div> In the expression: M.fromList (zip locs [0 .. ])</div></blockquote><div><br></div></div><div>The weird error is because Haskell is defined to promote integer literals to instances of Integral, then applying further an instance of Enum; but the actual type it's expecting is a tuple because you're using (Just (id,_)) on line 34 as the result of (M.lookup).<span style="font-family:'Bitstream Vera Sans Mono', Courier, monospace;font-size:12px;line-height:16px;white-space:pre-wrap"> </span>Were you perhaps expecting (M.lookup) to return a tuple of the key and value?</div>
<div><br></div><div>(Also, in light of your previous message, you'll find things compile more easily if you learn the correct types and behaviors of standard Haskell functions instead of making assumptions possibly based on the behavior of some other language.)</div>
</div><div><br><font color="#888888">-- <br>brandon s allbery <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available) (412) 475-9364 vm/sms<br>
<br>
</font></div></div>
</blockquote></div><br></div></div>