File processing-Haskell
        Posted  
        
            by 
                Martinas Maria
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Martinas Maria
        
        
        
        Published on 2012-06-09T14:57:55Z
        Indexed on 
            2012/06/09
            22:40 UTC
        
        
        Read the original article
        Hit count: 333
        
How can I implement in haskell the following: I receive an input file from the command line. This input file contains words separated with tabs,new lines and spaces.I have two replace this elements(tabs,new lines and spaces) with comma(,) .Observation:more newlines,tabs,spaces will be replaced with a single comma.The result has to be write in a new file(output.txt).
Please help me with this.My haskell skills are very scarse.
This is what I have so far:
    processFile::String->String
    processFile [] =[]
    processFile input =input
    process :: String -> IO String
    process fileName = do
    text <- readFile fileName
    return (processFile text)
    main :: IO ()
    main = do
    n <- process "input.txt"
    print n
In processFile function I should process the text from the input file. I'm stuck..Please help.
© Stack Overflow or respective owner