
On 25 May 2015 at 08:44, Dananji Liyanage
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?
Start with reading some basic Haskell book/tutorial. That should tell you how to e.g. use 'do' notation, or `liftM`, to achieve what you want. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus