Re: [Haskell-cafe] Trapping getChar before echo

2010-02-01 Thread Mark Spezzano
I've tried this example and it just lets me type in anything in CAPITALS, which is nice, but Delete key doesn't delete and the arrow keys unfortunately let me manoeuvre the cursor all over the screen. Also the biggest problem is that Enter doesn't terminate the input session. Isn't there a

Re: [Haskell-cafe] Trapping getChar before echo

2010-02-01 Thread Lyndon Maydwell
It might be worth looking at something like a curses library. On Mon, Feb 1, 2010 at 4:45 PM, Mark Spezzano mark.spezz...@chariot.net.au wrote: I've tried this example and it just lets me type in anything in CAPITALS, which is nice, but Delete key doesn't delete and the arrow keys

[Haskell-cafe] Trapping getChar before echo

2010-01-31 Thread Mark Spezzano
Hi, Is there any way of trapping keystrokes in Haskell, modifying them, and then echoing? Basically I want to give the user a prompt like: and then have whatever they type appear in UPPERCASE regardless of whether caps lock was on or not. By default Haskell seems to echo characters in

Re: [Haskell-cafe] Trapping getChar before echo

2010-01-31 Thread Neil Mitchell
Hi Mark, http://haskell.org/hoogle/?hoogle=set+echo Thanks, Neil On Sun, Jan 31, 2010 at 8:47 AM, Mark Spezzano mark.spezz...@chariot.net.au wrote: Hi, Is there any way of trapping keystrokes in Haskell, modifying them, and then echoing? Basically I want to give the user a prompt  like:

Re: [Haskell-cafe] Trapping getChar before echo

2010-01-31 Thread Michael Hartl
import System.IO import Data.Char main = do hSetEcho stdin False hSetBuffering stdin NoBuffering hSetBuffering stdout NoBuffering scanLine where scanLine = do c - hGetChar stdin putChar . toUpper $ c scanLine Am Sonntag, den 31.01.2010,

Re: [Haskell-cafe] Trapping getChar before echo

2010-01-31 Thread Andrew Coppin
Michael Hartl wrote: import System.IO import Data.Char main = do hSetEcho stdin False hSetBuffering stdin NoBuffering hSetBuffering stdout NoBuffering scanLine where scanLine = do c - hGetChar stdin putChar . toUpper $ c scanLine