I have a homework to sort a numbers that are to extract from a file.
Simple File Format:
45673
57879
28392
54950
23280
...
So I want to extract [Int]
and than to apply my sort-function radix to it.
I write in my file
readLines :: FilePath -> IO [String]
readLines = fmap lines . readFile
makeInteger :: [String] -> [Int]
makeInteger = map read
and then I write in the command line
radix (makeInteger (readlines("111.txt")))
and then I have, off course, problems with type conversion from IO String
to String
. I tried to write
makeInteger :: IO [String] -> [Int]
makeInteger = map read
but it also doesn't work.
How do I work with pure data outside the IO
monad?