[Haskell-cafe] Interactive chatbot

Shachaf Ben-Kiki shachaf at gmail.com
Wed Nov 4 18:32:25 EST 2009

On Wed, Nov 4, 2009 at 3:14 PM, Jason Dagit <dagit at codersbase.com> wrote:
> On Wed, Nov 4, 2009 at 2:21 PM, Torsten Otto <t-otto-news at gmx.de> wrote:
>> Hi!
>> My students have the task to program an interactive chatbot. We have run
>> into a problem that I can't solve either:
>> When we read the user's input through
>> >   t <- getLine
>> it is not possible to delete typos before hitting enter and thereby
>> sending the input off to the system (at least in OS X, bash). I didn't find
>> that terribly problematic, but of course it is a bit of a show stopper from
>> their point of view.
> Is it possible that you need to tweak the input buffering settings?
> http://haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html#v:hSetBuffering
> You probably want to look at 'interact' also.
> Or just switch to readline as others have suggested.
> Jason

Another possibility (perhaps simpler) is to use an external program
such as rlwrap to handle input.


More information about the Haskell-Cafe mailing list