[Haskell-beginners] IO operations

Alexander Chen alexander at chenjia.nl
Thu Aug 13 11:02:19 UTC 2020


Hi,

module Main where

allwords :: IO Int
allwords  = do
    dict <- readFile "data/dict.txt"
    return  $ length [x | x <- dict , not $ '-' `elem` x]
    
main :: IO Int
main = do allwords

error

* 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

could someone tell me what I am doing wrong?

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


More information about the Beginners mailing list