Hello everybody,
when I compile the file
I get
main.hs:28:64:
Could not deduce (Enum (a, t0))
arising from the arithmetic sequence `0 .. '
from the context (Integral a)
bound by the type signature for
plotAsString :: Integral a => [(a, a)] -> (a, a) -> String
at main.hs:(26,1)-(38,41)
Possible fix:
add (Enum (a, t0)) to the context of
the type signature for
plotAsString :: Integral a => [(a, a)] -> (a, a) -> String
or add an instance declaration for (Enum (a, t0))
In the second argument of `zip', namely `[0 .. ]'
In the first argument of `M.fromList', namely `(zip locs [0 .. ])'
In the expression: M.fromList (zip locs [0 .. ])
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). Were you perhaps expecting (M.lookup) to return a tuple of the key and value?
(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.)