I think I figured out.. I had to replace M.member with M.lookup..<div><br></div><div>Thanks,</div><div>Sunil.<br><br><div class="gmail_quote">On Thu, Aug 11, 2011 at 4:23 PM, Sunil S Nandihalli <span dir="ltr"><<a href="mailto:sunil.nandihalli@gmail.com">sunil.nandihalli@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>Hello everybody,</div><div>When I compile a file containing ... </div><div><br></div><div>plotAsString::(Integral a)=>[(a,a)]->a->String</div>
<div>plotAsString locs ans = let xs = map fst locs</div><div> ys = map snd locs</div>
<div> locsmap = M.fromList (zip locs [0..])</div><div> bufsize=10</div><div> min' = ((\x -> x-bufsize) . minimum)</div><div> max' = ((\x -> x+bufsize) . maximum)</div>
<div> (bmin@(x0,y0),bmax@(x1,y1)) = ((min' xs,min' ys),(max' xs,max' ys))</div><div> plotString = foldl (\curStr newRowId -> (foldl (\ccStr newColId -> (ccStr++(case (M.member (newRowId,newColId) locsmap) of</div>
<div> (Just v) -> ("." ++ (show v) ++ ".")</div><div> (Nothing) -> " ")))</div>
<div> curStr [y0..y1])) "" [x0..x1]</div><div> in plotString</div><div><br></div><div>I get the following error..</div>
<div><br></div><div><div>main.hs:34:107:</div><div> Couldn't match expected type `Bool' with actual type `Maybe t0'</div><div> In the pattern: Just v</div><div> In a case alternative: (Just v) -> ("." ++ (show v) ++ ".")</div>
<div> In the second argument of `(++)', namely</div><div> `(case (M.member (newRowId, newColId) locsmap) of {</div><div> (Just v) -> ("." ++ (show v) ++ ".")</div><div> (Nothing) -> " " })'</div>
</div><div><br></div><div>can somebody help?<br><br>Thanks,<br><font color="#888888">Sunil.</font></div>
</blockquote></div><br></div>