I think I figured out..  I had to replace M.member with M.lookup..

Thanks,
Sunil.

On Thu, Aug 11, 2011 at 4:23 PM, Sunil S Nandihalli <sunil.nandihalli@gmail.com> wrote:
Hello everybody,
When I compile a file containing ... 

plotAsString::(Integral a)=>[(a,a)]->a->String
plotAsString locs ans = let xs = map fst locs
                            ys = map snd locs
                            locsmap = M.fromList (zip locs [0..])
                            bufsize=10
                            min' = ((\x -> x-bufsize) . minimum)
                            max' = ((\x -> x+bufsize) . maximum)
                            (bmin@(x0,y0),bmax@(x1,y1)) = ((min' xs,min' ys),(max' xs,max' ys))
                            plotString = foldl (\curStr newRowId -> (foldl (\ccStr newColId -> (ccStr++(case (M.member (newRowId,newColId) locsmap) of
                                                                                                         (Just v) -> ("." ++ (show v) ++ ".")
                                                                                                         (Nothing) -> "   ")))
                                                                           curStr [y0..y1])) "" [x0..x1]
                        in plotString

I get the following error..

main.hs:34:107:
    Couldn't match expected type `Bool' with actual type `Maybe t0'
    In the pattern: Just v
    In a case alternative: (Just v) -> ("." ++ (show v) ++ ".")
    In the second argument of `(++)', namely
      `(case (M.member (newRowId, newColId) locsmap) of {
          (Just v) -> ("." ++ (show v) ++ ".")
          (Nothing) -> "   " })'

can somebody help?

Thanks,
Sunil.