Hi,

  Could anyone, please, give me reference to or a sophisticated
answer?

  I am going to have maybe a very stupid question.
Playing with IO monads I made to me a task. Create
a function which counts lines of a file and returns the
number of lines as a result:

  lineNo :: String -> Int
            fname     number of lines

To access files I'm using standard file access and operators
defined in class Monad. The problem is, that when I count
the lines, I'm imprisoned by IO monad. Is there any way
(e.g. by converting value to String and obtaining this string as a result)
how to break IO monads? How to make a function of type

  f :: IO [Char] -> [Char]

I know, that usually it is possible to write whole the
program such a way so that it would not matter to have
a IO monad as a top type, but having a function which counts number
of lines in the file (or watever else) is also not too bad,
at least as fas as I think, but maybe I'm completely wrong.

  Thanks a lot

               Dusan Kolar

Reply via email to