[Haskell-cafe] Re: socket TChan problem

2006-02-28 Thread Stefan Aeschbacher
Hi I think I finally found the problem. I had to replace the call to usleep with a call to threadDelay and it worked. regards Stefan 2006/2/27, Stefan Aeschbacher [EMAIL PROTECTED]: HiI try to write a program that reads from a socket and communicates the result over a TChan and writes it to

[Haskell-cafe] Re: standard poll/select interface

2006-02-28 Thread Simon Marlow
Marcin 'Qrczak' Kowalczyk wrote: Simon Marlow [EMAIL PROTECTED] writes: I think the reason we set O_NONBLOCK is so that we don't have to test with select() before reading, we can just call read(). If you don't use O_NONBLOCK, you need two system calls to read/write instead of one. This

Re: [Haskell-cafe] haskell programming guidelines

2006-02-28 Thread Cale Gibbard
On 28/02/06, John Meacham [EMAIL PROTECTED] wrote: On Tue, Feb 28, 2006 at 01:09:03AM -0500, Cale Gibbard wrote: Well, the benefit of the Identity monad is so that the user of a routine can choose to recover gracefully by using a different monad, you only use the Identity monad when you

Re: [Haskell-cafe] Re: socket TChan problem

2006-02-28 Thread Anatoly Zaretsky
Why do you need to duplicate channels? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] haskell programming guidelines

2006-02-28 Thread John Meacham
On Tue, Feb 28, 2006 at 04:52:40AM -0500, Cale Gibbard wrote: -- collect error messages from all failing parsers [ err | Left err - map parse xs] I don't see how you lose this one at all. because somewhere else, you might want to use 'parse' as a maybe. somewhere else, you might want it to

[Haskell-cafe] Re: PrefixMap: code review request

2006-02-28 Thread Ben Rudiak-Gould
Brian Hulley wrote: Whoever thought up the original Haskell layout rule assumed that people would be happy using a single fixed width font, tabs set to 8 spaces, and didn't care about the brittleness of the code (in the face of identifier renamings) it allowed one to write. Are you

[Haskell-cafe] Re: PrefixMap is a Trie

2006-02-28 Thread Christian Maeder
David F.Place wrote: The PrefixMap datastructure implements a Prefix Tree which allows a key/value relationship. \begin{code} data PrefixMap k v = Node (Maybe v) (Map.Map k (PrefixMap k v)) deriving (Show) \end{code} You may compare your code with Keith's implemenation

[Haskell-cafe] Re: rounding errors with real numbers.

2006-02-28 Thread Ben Rudiak-Gould
Henning Thielemann wrote: Maybe you should use a kind of convex combination, that is (x-oldLower)*a + (oldUpper-x)*b Maybe lower*(1-z) + upper*z where z = (x-oldLower) / (oldUpper-oldLower). I think this will always map oldLower and oldUpper to lower and upper exactly, but I'm not sure it's

Re: [Haskell-cafe] Re: PrefixMap: code review request

2006-02-28 Thread Brian Hulley
Ben Rudiak-Gould wrote: Brian Hulley wrote: Whoever thought up the original Haskell layout rule assumed that people would be happy using a single fixed width font, tabs set to 8 spaces, and didn't care about the brittleness of the code (in the face of identifier renamings) it allowed one to

[Haskell-cafe] Re: PrefixMap is a Trie

2006-02-28 Thread David F. Place
On Feb 28, 2006, at 8:33 AM, Christian Maeder wrote:You may compare your code with Keith's implemenation of a Trie. http://article.gmane.org/gmane.comp.lang.haskell.libraries/2571 Thanks for the pointer,  I searched for "Prefix Tree" which is an alternative name for trie so I didn't find that

Re: [Haskell-cafe] Re: socket TChan problem

2006-02-28 Thread Stefan Aeschbacher
HiActually I don't need to duplicate them, it's an oversight from my side when I converted my code from my own channels to TChan.regardsStefanAm 28.02.06 schrieb Anatoly Zaretsky [EMAIL PROTECTED]: Why do you need to duplicate channels?___Haskell-Cafe

[Haskell-cafe] Picking a shell for runCommand

2006-02-28 Thread Tom Hawkins
It appears runCommand uses /bin/sh by default, but our environment needs tcsh. Is there any way to set an alternative shell? -Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Picking a shell for runCommand

2006-02-28 Thread Donn Cave
On Tue, 28 Feb 2006, Tom Hawkins wrote: It appears runCommand uses /bin/sh by default, but our environment needs tcsh. Is there any way to set an alternative shell? Ideally, it would be better to fix your environment, but something like this should work if you can't do that - runSh cmd =

[Haskell-cafe] Layout rule (was Re: PrefixMap: code review request)

2006-02-28 Thread Ben Rudiak-Gould
Brian Hulley wrote: Here is my proposed layout rule: 1) All layout keywords (where, of, let, do) must either be followed by a single element of the corresponding block type, and explicit block introduced by '{', or a layout block whose first line starts on the *next* line I wouldn't have

[Haskell-cafe] Help with Type Class

2006-02-28 Thread Alson Kemp
Although the discussion about Array refactoring died down quickly on the Haskell' mailing list, I've been noodling on refactoring the various Collections in Haskell. In doing so, I've bumped into a problem with type classes that I can't resolve. The issue is as follows: I'm designing a

[Haskell-cafe] My piece of an IRC bot

2006-02-28 Thread ihope
Today I started on a simple IRC bot framework thingy. I decided to post the source code here so people can look at it and tell me what the heck I did wrong :-P module IRC where import Control.Monad.State import System.IO import Network

Re: [Haskell-cafe] Layout rule (was Re: PrefixMap: code review request)

2006-02-28 Thread Brian Hulley
Ben Rudiak-Gould wrote: Brian Hulley wrote: Here is my proposed layout rule: 1) All layout keywords (where, of, let, do) must either be followed by a single element of the corresponding block type, and explicit block introduced by '{', or a layout block whose first line starts on the *next*

Re: [Haskell-cafe] Layout rule (was Re: PrefixMap: code review request)

2006-02-28 Thread Philippa Cowderoy
On Wed, 1 Mar 2006, Brian Hulley wrote: Ben Rudiak-Gould wrote: Brian Hulley wrote: Here is my proposed layout rule: snip and whose indentation is accomplished *only* by tabs You can't be serious. This would cause far more problems than the current rule. Why? Surely typing

[Haskell-cafe] Re: haskell programming guidelines

2006-02-28 Thread ajb
G'day all. Quoting Christian Maeder [EMAIL PROTECTED]: I suggested: f . g $ h x or f $ g $ h x Of these, the first version only makes sense if you want to single out h for some reason. I'm known to do this, for example, if h is a record accessor. The second is just plain

Re: [Haskell-cafe] Layout rule (was Re: PrefixMap: code review request)

2006-02-28 Thread Jared Updike
BH Why? Surely typing one tab is better than having to hit the spacebar 4 (or 8) BH times? PC Not when it prevents me from ever exhibiting the slightest shred of style PC in my code. I use that control for readability purposes in my code. [snip] BH I'm really puzled here. I've been using tabs

[Haskell-cafe] mediawiki syntax highlighting plugins

2006-02-28 Thread Johannes Ahlmann
hi, i've noted that the new haskellwiki has dropped syntax highlighting support for haskell code fragments. while i think that full highlighting might be overkill, at least different color markup of code and comments would certainly be nice. investigating the options for syntax highlighting in

[Haskell-cafe] Code snippet, a `trace' with line and column numbers

2006-02-28 Thread Donald Bruce Stewart
Suggested by a question from sethk on #haskell irc channel. Solves an FAQ where people have often resorted to cpp or m4: a `trace' that prints line numbers. module Location (trace, assert) where import qualified Control.Exception as C (catch) import System.IO.Unsafe (unsafePerformIO)

Re: [Haskell-cafe] Layout rule

2006-02-28 Thread Ketil Malde
Brian Hulley [EMAIL PROTECTED] writes: You can't be serious. This would cause far more problems than the current rule. Why? Surely typing one tab is better than having to hit the spacebar 4 (or 8) times? What you type depends on your editor. I hit tab, and the editor inserts an appropriate