[Haskell-beginners] Using IO values for computations

Dananji Liyanage dan9131 at gmail.com
Mon May 25 06:44:32 UTC 2015


Hi All,

I'm writing a code, where the input is read from a text file using:
readValues = readFile "Input.txt"

Since the type of this is 'IO String', I can't use this in the consequent
functions.

For an example: I want to split this as follows within another function

extractInput url method template
  | isURI url == True = getList values components
  | otherwise = []
  where components = splitTemplate readValues
        values = getURL (splitURL url) method

This gives the following error:

 Couldn't match type ‘IO String’ with ‘[Char]’
    Expected type: String
      Actual type: IO String

How can I solve this?

Thanks in advance!

-- 
Regards,
Dananji Liyanage
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150525/057ca6cd/attachment.html>


More information about the Beginners mailing list