[Haskell] line-based interactive program

Christian Maeder maeder at tzi.de
Thu Jul 7 08:07:28 EDT 2005

mt wrote:
> hi,
> i'd like to know how to write simply a line-based interactive program, that is 
> one with which you have a 'talk'.

I would start with:

main =
   do putStrLn "Please enter text (or press return to exit):"
      s <- getLine
      if s /= "" then do
          putStrLn s
        else return ()

> a simple filter-like line-based program ca be written as:
> -- a filter program process an entire input to yield some output
> type FilterProgram = [Line] -> [Line]

Forget this, if it's not an (old) exercise


More information about the Haskell mailing list