Saturday, 7 September 2013

read file line by line and execute those line in haskell

read file line by line and execute those line in haskell

i want to read from a file (contains haskell commands per line). I want to
read line by line and execute those and display the result
my following code is not working... print is not processing the command,
it is just displaying it:
import System.IO
import Control.Monad
main = do
fileContents <- readFile "Instructions.txt"
mapM_ f (lines fileContents)
f line = do
putStrLn ("Processing Instruction:" ++ line)
print line

No comments:

Post a Comment