When I compile below code in Haskell, I get following error:
Error: parse error on input 'gr' in the line x
module Main where
import PGF
import System.Environment
import System.IO
main :: IO ()
main = do
file:_ <- getArgs
gr <- readPGF file
content <- readFile "input.txt"
writeFile "output.txt" &(translate gr content)
translate :: PGF -> String -> String
translate gr s = case parseAllLang gr (startCat gr) s of
(lg,t:_):_ -> unlines [linearize gr l t | l <- languages gr, l /= lg]
_ -> "NO PARSE"
In this code I want to read a line(string) from input file and bind it to content. after that pass the content and PGF file(gr) to translate function and finally write the processed string via translate function on output file.
What is wrong with this code, and how can I fix it?