[Haskell] line-based interactive program

Christian Maeder maeder at tzi.de
Thu Jul 7 10:55:13 EDT 2005


Bulat Ziganshin wrote:
> Hello Colin,
> 
> Thursday, July 07, 2005, 4:33:39 PM, you wrote:
>>>>type FilterProgram = [Line] -> [Line]
> 
> CR> interact :: (String -> String) -> IO ()
> 
> and there is lines and unlines functions to do just what yopu need
> 
> example: main = interact (unlines.filter(not.null).lines)
> 

Could you also insert a prompt that is shown before the lines are read?
(The first prompt seems to be tricky assuming line buffering )

Christian


More information about the Haskell mailing list