[Haskell-beginners] IO operations

鲍凯文 traqueofziche at gmail.com
Fri Aug 14 01:23:02 UTC 2020


Hi,

> * Couldn't match expected type `t0 Char' with actual type `Char'
> * In the second argument of `elem', namely `x'
>   In the second argument of `($)', namely '-' `elem` x
>   In the expression: not $ '-' `elem` x

Hope the other answers helped. FWIW, just wanted to point out that for me
these kinds of error messages sometimes used to be confusing since the type
of `elem` is `(Foldable t, Eq a) => a -> t a -> Bool`, so the typechecker
tells you it wants to unify `t0 Char` (where `t0` is something `Foldable`)
with `Char`. As Mr. Klink wrote, it looks like you wanted `t0` to be `[]`;
I used to get confused since I was only working with lists and the extra
`Foldable` genericity made it harder to see that I was still just working
with lists.

Best,

toz

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20200813/fc5ac250/attachment.html>


More information about the Beginners mailing list