[Haskell-cafe] first post
raptor
raptor at tvskat.net
Wed Nov 30 20:32:13 EST 2005
hi,
I'm trying to figure out how to parse a text file, but
these type-conversations are just killing me!
Whats wrong with following code :
module Main where
main = putStrLn "hi"
parse str = take 10 str
load = do
content <- readFile "parse.hs"
return content
when try :
Prelude> parse load
<interactive>:1:6:
Couldn't match `[a]' against `IO String'
Expected type: [a]
Inferred type: IO String
In the first argument of `parse', namely `load'
In the definition of `it': it = parse load
i tried different combinations, but still cant figure out...
How do u use an "IO String" in normal "String" functions..
I want to particulary slurp file in a string and then make
funny things with it...spliting to lines,parsing them and
building hash like strucutre of it...etc.
later i want to try spliting,regex-es..etc.
It is very hard to figure out how to use these modules.. :"(
More information about the Haskell-Cafe
mailing list