RE: [Haskell-cafe] GHCi always optimizes?

2005-11-23 Thread Simon Peyton-Jones
| Anyway, it's strange that you are experiencing crashes. IIRC, there | were problems if you mixed modules compiled with different levels of | optimisation in the same program, but I am not sure it still happens. If you can make a reproducible crash, please tar it up and send it to us. It

RE: Re[2]: [Haskell-cafe] using of data types as kinds

2005-11-23 Thread Simon Peyton-Jones
Sorry should be fixed now (or shortly when the mirror does its stuff) Simon | -Original Message- | From: Bulat Ziganshin [mailto:[EMAIL PROTECTED] | Sent: 22 November 2005 19:28 | To: Simon Peyton-Jones | Cc: haskell-cafe@haskell.org | Subject: Re[2]: [Haskell-cafe] using of data types

[Haskell-cafe] questions on lazy pattern, StateT monad

2005-11-23 Thread Fan Wu
Hi Haskell gurus, I'm very puzzled on some code I saw in GHC Monad.StateT (which is about state monad transformers) source and hope you can kindly give me some insight into this. newtype StateT s m a = S (s - m (a,s)) instance MonadPlus m = MonadPlus (StateT s m) where mzero =

[Haskell-cafe] Re: Frag: a First Person Shooting game

2005-11-23 Thread Mun Hon Cheong
Did you encounter any difficulties in your development because of Haskell? Well, Haskell is different compared with other languages like C. I thought collision detection would be easier if i could use some local or global variables, but i managed to get around it. Was lazy evaluation ever a

[Haskell-cafe] Re: Records vs HList

2005-11-23 Thread Keean Schupke
David Menendez wrote: Keean Schupke writes: David Menendez wrote: Chris Kuklewicz writes: Would the record system describe at http://lambda-the-ultimate.org/node/view/1119 also be convertable into System Fw, GHC's existing, strongly-typeed intermediate language. ?

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Udo Stenzel
Scherrer, Chad wrote: Maybe my point wasn't clear. Of course this idea of comparing lazy evaluation to Unix pipes is very old (long before July 2004, I'm sure). The point I'm making is that there is an old idea that may be underused. It is, and only because (.) is defined all wrong! The unix

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Tomasz Zielonka
On Wed, Nov 23, 2005 at 11:17:25AM +0100, Udo Stenzel wrote: infixl 2 \| (\|) = flip (.) -- though I'm using () The unix pipe becomes (filter (foo `isPrefixOf`) \| sort \| nub) or something, which is rather neat, and (#) is used to call member functions, as in Why not use Control.Arrow. ?

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Henning Thielemann
On Wed, 23 Nov 2005, Udo Stenzel wrote: Scherrer, Chad wrote: Maybe my point wasn't clear. Of course this idea of comparing lazy evaluation to Unix pipes is very old (long before July 2004, I'm sure). The point I'm making is that there is an old idea that may be underused. It is, and only

Re: [Haskell-cafe] questions on lazy pattern, StateT monad

2005-11-23 Thread Wolfgang Jeltsch
Am Mittwoch, 23. November 2005 10:03 schrieb Fan Wu: [...] I'm puzzled over this line: ~(a,s') - lift (mplus m1' m2') Why is this line in Monad.State.StateT? Recently, we discussed that StateT does *not* use a lazy pattern here but that it should be changed to using one. So where did

RE: [Haskell-cafe] Spurious program crashes

2005-11-23 Thread Simon Marlow
On 21 November 2005 16:43, Joel Reymont wrote: I'm being quite careful with resources these days. The outstanding issues are 1) Crashes on Mac OSX that are not reproduced on Linux, Windows, etc. 2) Some kind of a problem with Chan. getChanContents retrieves things smoothly, readChan only

Re: [Haskell-cafe] Spurious program crashes

2005-11-23 Thread Joel Reymont
On Nov 23, 2005, at 1:18 PM, Simon Marlow wrote: After subsequent dicsussion, do you still think something strange was going on here? Yes, but in a different thread. The Postmortem one. so this basically loops until there are no messages in the channel, and then exits. Is that what you

RE: [Haskell-cafe] Spurious program crashes

2005-11-23 Thread Simon Marlow
On 23 November 2005 13:29, Joel Reymont wrote: On Nov 23, 2005, at 1:18 PM, Simon Marlow wrote: After subsequent dicsussion, do you still think something strange was going on here? Yes, but in a different thread. The Postmortem one. so this basically loops until there are no messages

[Haskell-cafe] Uses forkOS all CPUS on-board?

2005-11-23 Thread Dusan Kolar
Hello haskellers, in past few days, a lot of stuff on concurrency went through the conference. I'm trying to use posted things and my own. They work, even in a context switching regime, but I can't exploit all the CPU's on my computer. Always is active just one thread and, thus, the computation

Re: [Haskell-cafe] Uses forkOS all CPUS on-board?

2005-11-23 Thread Sebastian Sylvan
On 11/23/05, Dusan Kolar [EMAIL PROTECTED] wrote: Hello haskellers, in past few days, a lot of stuff on concurrency went through the conference. I'm trying to use posted things and my own. They work, even in a context switching regime, but I can't exploit all the CPU's on my computer.

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Scherrer, Chad
Henning Thielemann [EMAIL PROTECTED] writes: Since (a . b) x a $ b x a (b x) are equivalent, do you also want to reverse function and argument in order to match argument order of . and $ ? That is x (b . a) x b $ a (x b) a ? I'm sorry, I'm not sure I understand your

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Henning Thielemann
On Wed, 23 Nov 2005, Scherrer, Chad wrote: Henning Thielemann [EMAIL PROTECTED] writes: Since (a . b) x a $ b x a (b x) are equivalent, do you also want to reverse function and argument in order to match argument order of . and $ ? That is x (b . a) x b $ a (x b) a ? I'm

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Scherrer, Chad
Henning Thielemann [EMAIL PROTECTED] writes: I want to say, that the order of symbols for ($), (.) and function application is consistent. This is a fine thing. I think that shall not be distroyed by giving ($) and (.) reversed argument order. I see. I like the argument order also,

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Scherrer, Chad
Udo Stenzel [EMAIL PROTECTED] writes: The unix pipe is actually function composition. Its argument (standard input) isn't explicitly mentioned Then it seems Unix must overload the | operator. I typically use it to do things like grep . *.hs | wc So I think of the types as being grep .

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Tomasz Zielonka
On Wed, Nov 23, 2005 at 09:01:07AM -0800, Scherrer, Chad wrote: So I think of the types as being grep . *.hs :: String wc :: String - Int -- ok, not really, but it shows the point better. Every unix program has a standard input, even if it doesn't use it, so I would rather give this type to

Re: [Haskell-cafe] questions on lazy pattern, StateT monad

2005-11-23 Thread Fan Wu
HI Wolfgang, The code is from GHC source ghc-6.4.1/libraries/monads/Monad/StateT.hs, am I looking at the wrong place? I found the thread discussing Monad strictness, where is your StateT defined? But it is still not clear to me why lazy pattern is used here. Any ideas? Thanks, Fan On

Re: [Haskell-cafe] GHCi always optimizes?

2005-11-23 Thread Tomasz Zielonka
On Wed, Nov 23, 2005 at 08:48:04AM -, Simon Peyton-Jones wrote: | Anyway, it's strange that you are experiencing crashes. IIRC, there | were problems if you mixed modules compiled with different levels of | optimisation in the same program, but I am not sure it still happens. If you can

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Bill Wood
On Wed, 2005-11-23 at 08:55 -0800, Scherrer, Chad wrote: . . . I see. I like the argument order also, since it so nicely reflects mathematical notation. But I do think there's a place for (flip ($)) and (flip (.)). The problem is that the assignment of fixities is much more subtle and

Re: [Haskell-cafe] questions on lazy pattern, StateT monad

2005-11-23 Thread Wolfgang Jeltsch
Am Mittwoch, 23. November 2005 19:02 schrieb Fan Wu: HI Wolfgang, The code is from GHC source ghc-6.4.1/libraries/monads/Monad/StateT.hs, am I looking at the wrong place? I found the thread discussing Monad strictness, where is your StateT defined? Hello Fan, the GHC source is just where

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Bill Wood
On Wed, 2005-11-23 at 17:47 +0100, Henning Thielemann wrote: . . . Why is there no () and why is (=) not the default? The order of 'do {a;b;c}' is compatible with that of (). So we have the fundamental conflict, that usually function application is from right to left, but interpreting

Re: [Haskell-cafe] questions on lazy pattern, StateT monad

2005-11-23 Thread Andrew Pimlott
On Wed, Nov 23, 2005 at 02:03:22AM -0700, Fan Wu wrote: instance MonadPlus m = MonadPlus (StateT s m) where mzero = lift mzero mplus m1 m2 = do s - peek let m1' = runState s m1 m2' = runState s m2

Re: [Haskell-cafe] questions on lazy pattern, StateT monad

2005-11-23 Thread Fan Wu
Hi Wolfgang, Thanks for your response and examples! It helps a lot. From your example I can see Lazy patterns are useful in contexts where infinite data structures are being defined recursively (quote section 4.4 of Gentle Introduction to Haskell). But does it apply to the mplus case? I mean the

Re: [Haskell-cafe] questions on lazy pattern, StateT monad

2005-11-23 Thread David Menendez
Wolfgang Jeltsch writes: If we use an implementation of State *without lazy patterns*, it becomes something like this: \s - case next s of (x,s') - case everyting s' of (xs,s'') - ((x : xs),s'') Note that I used case expressions to realize strict patterns

[Haskell-cafe] Problem over Context Free Grammar Transitive Closure Algorithm

2005-11-23 Thread Victor Silva
Folks this is a parser for Context Free Grammars, for some reason when I go simplify the grammar trying to remove productions that substitute variables like in the case: S - A, A - B, B - a, it works perfectly and returns S - a, the problem is when the root symbol is on the listthat must be

Re[2]: [Haskell-cafe] Uses forkOS all CPUS on-board?

2005-11-23 Thread Bulat Ziganshin
Hello Sebastian, Wednesday, November 23, 2005, 6:46:54 PM, you wrote: They work, even in a context switching regime, but I can't exploit all the CPU's on my computer. Always is active just one thread SS Did you compile it with -threaded? this will not help. multi-processing support will be

[Haskell-cafe] Re: Re[2]: Uses forkOS all CPUS on-board?

2005-11-23 Thread Shae Matijs Erisson
Bulat Ziganshin [EMAIL PROTECTED] writes: They work, even in a context switching regime, but I can't exploit all the CPU's on my computer. Always is active just one thread this will not help. multi-processing support will be added in GHC 6.6, which must roll out due 6 months, as HCAR says

[Haskell-cafe] Re: Records vs HList

2005-11-23 Thread David Menendez
Keean Schupke writes: HList can do O(log n) by the way, if the labels have order, you can implement a binary search tree of labels (Of course all the accessor functions would need to be rewritten). The idea of writing a type-level balanced binary search tree fills me with an uncertain mixture

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Cale Gibbard
On 23/11/05, Scherrer, Chad [EMAIL PROTECTED] wrote: Bill Wood [EMAIL PROTECTED] writes: Interesting note: in Richard Bird and Oege de Moor, _Algebra of Programming_, pp. 2-3, the authors write As a departure from tradition, we write f : A - B rather than f : B - A to indicate

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Bill Wood
On Wed, 2005-11-23 at 21:21 -0500, Cale Gibbard wrote: . . . Hmm, which edition? My copy (5th ed.) uses the ordinary notation: f(x). x f does perhaps make more sense, especially with the current categorical view of functions, but there would have to be a really hugely good reason to

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread jerzy . karczmarczuk
Cale Gibbard: x f does perhaps make more sense, especially with the current categorical view of functions, but there would have to be a really hugely good reason to change notation, as almost all current work puts things the other way around. Almost all? Well, excluding the Smalltalkers,

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Cale Gibbard
On 24/11/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Cale Gibbard: x f does perhaps make more sense, especially with the current categorical view of functions, but there would have to be a really hugely good reason to change notation, as almost all current work puts things the other