Usability of System.Posix.Terminal

Simon Marlow simonmarhaskell at gmail.com
Tue Mar 27 07:56:54 EDT 2007


Stefan O'Rear wrote:
> On Sat, Mar 17, 2007 at 10:50:36PM -0700, David Brown wrote:
>> I was wondering if there are any applications that make use of
>> System.Posix.Terminal?  I'm trying to write some code to communicate
>> over a serial port, and am trying to figure out how these functions
>> are intended to be used.
> 
> My 'vty' library (a curses-a-like) uses System.Posix.Terminal to set
> no-echo mode:
> 
> darcs get http://members.cox.net/stefanor/vty
> 
>> There are a bunch of 'with...' and 'without...' functions, but I'm not
>> sure how to easily combine them to modify some terminal attributes.
>> The best I've come up with is:
>>
>>   flip withoutMode IgnoreBreak .
>>   flip withoutMode InterruptOnBreak .
>>   flip withMode LocalMode .
>>   flip withInputSpeed B9600 $ originalMode
>>
>> and so on.  Am I missing something here?

I think withMode/withoutMode etc. were designed to be used infix:

     originalMode
        `withoutMode` IgnoreBreak
        `withoutMode` InterruptOnBreak
        `withMode` LocalMode
        `withInputSpeed` B9600

Cheers,
	Simon




More information about the Libraries mailing list