[Haskell] line-based interactive program

Colin Runciman colin at cs.york.ac.uk
Fri Jul 8 04:56:13 EDT 2005


Christian Maeder wrote:

>Could you also insert a prompt that is shown before the lines are read?
>(The first prompt seems to be tricky assuming line buffering )
>  
>
If line-buffering is assumed or imposed, of course it prevents the
programming of interactive applications where the units of input or
output are less than a line!  However, there is no need to build
line-buffering into the system, because it is easily defined in Haskell:

buffer xs = foldl const xs xs

lineBuffered = map buffer  .  lines

Regards
Colin R





More information about the Haskell mailing list