[Haskell-beginners] count function

John Moore john.moore54 at gmail.com
Sun Oct 18 10:52:28 EDT 2009

 Trying to get aprogram to count all the lines or words from a file. Not
sure about the syntax. Probably missing some.
Here's what I have so far any help in the right direction would be great.

import System.IO
main :: IO ()
main = do
       incom <- openFile "file.txt" ReadMode
       otcom <- openFile "prob.txt" WriteMode
       fCount incom otcom
       hClose incom
       hClose otcom
       fCount incomh otcomh =
         do eof <- hIsEof incomh
             if eof
              then return()
              else do c <- hGetCount incom

it tells me parse error on =

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20091018/a46cf273/attachment.html

More information about the Beginners mailing list