[Haskell-cafe] Disable echo in POSIX terminal

Henning Thielemann lemming at henning-thielemann.de
Sat Nov 10 04:44:29 EST 2007


On Fri, 9 Nov 2007, Derek Elkins wrote:

> Pointless frobbing but is there any issue with setting the echo to False
> when it is already False?  Otherwise not checking seems to both simpler
> and quicker (not that performance matters), i.e.
> getpasswd h = do
>     wasEnabled <- hGetEcho h
>     hSetEcho h False
>     str <- hGetLine h
>     hSetEcho wasEnabled
>     return str

Should one enclose this in 'bracket'?


More information about the Haskell-Cafe mailing list