Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread Udo Stenzel
Yitzchak Gale wrote: Here is a concrete example: Let's say you want to shuffle a large list randomly, within a larger application that lives inside some MTL monad stack. Among other things, your monad m satisfies (RandomGen g, MonadState g m), perhaps after a lift. Well, it turns out

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread Seth Gordon
Simon Peyton-Jones wrote: Conor and others are right; it's all to do with type inference. There is nothing wrong with the program you are writing, but it's hard to design a type inference algorithm that can figure out what you are doing. The culprit is that you want to instantiate a

Re: [Haskell-cafe] Re: Possible (GHC or HGL) bug or ??

2007-01-03 Thread Calvin Smith
[EMAIL PROTECTED] wrote: Calvin Smith wrote: When the problem occurs, there is a message to the console that says: thread blocked indefinitely. I can reproduce this on OS X with ghc-6.4.2, X11-1.1 and HGL-3.1. The console message is rare but I also got it once. This looks like a bug in HGL,

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread David House
On 03/01/07, Seth Gordon [EMAIL PROTECTED] wrote: So I can't just tell someone who's just starting to learn Haskell that f $ g y is equivalent to f (g y); I have to say those two are *almost always* equivalent, but if you use $ and the compiler complains about not being able to match the

[Haskell-cafe] darcs repo for yampa + gadt

2007-01-03 Thread Joel Reymont
Folks, I have a version of Yampa with Henrik Nilsson's GADT optimizations that I cleaned up for ghc 6.6 and cabalized. Would it be possible to set it up at darcs.haskell.org and if so how should I go about it? Thanks, Joel -- http://wagerlabs.com/

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread Seth Gordon
David House wrote: So I can't just tell someone who's just starting to learn Haskell that f $ g y is equivalent to f (g y); I have to say those two are *almost always* equivalent, but if you use $ and the compiler complains about not being able to match the expected and the inferred type and

Re: [Haskell-cafe] Glasgow Distributed Haskell

2007-01-03 Thread Paul Johnson
Joel Reymont [EMAIL PROTECTED] wrote: I'm after Erlang in Haskell, if you will, for fault-tolerance and scalability. I think the way to do Erlang in Haskell is to build a middleware layer on top of the language, not try to make the language into something it is not. In this kind of

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread Sebastian Sylvan
On 1/3/07, David House [EMAIL PROTECTED] wrote: On 03/01/07, Seth Gordon [EMAIL PROTECTED] wrote: So I can't just tell someone who's just starting to learn Haskell that f $ g y is equivalent to f (g y); I have to say those two are *almost always* equivalent, but if you use $ and the compiler

Re: [Haskell-cafe] Arrays performance

2007-01-03 Thread Paolo Veronelli
Quoting Udo Stenzel [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: It isn't, but not for the reasons you might suspect. You're using 'nub', which is quadratic, and your 'coupage' is also quadratic because it uses 'lookup' on a list, which is linear, a linear number of times. You can get this

Re: [Haskell-cafe] Socket Programming

2007-01-03 Thread Reilly Hayes
Or you could ignore the problem of shutdown altogether: http://swig.stanford.edu/~candea/papers/crashonly/ On Jan 2, 2007, at 12:20 PM, Chris Kuklewicz wrote: Mark Goldman wrote: I am trying to write a toy echo server that can handle multiple connections. I would like to be able to test

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread C.M.Brown
Hi, It's true that this is the typical way of learning Haskell, but I for one think it's a bad way of learning Haskell. Very few real world programs get by without the impure stuff, so if you give the newbie the impression that it isn't there (by postponing it) there's a chance he'll run

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread Thomas Davie
It's true that this is the typical way of learning Haskell, but I for one think it's a bad way of learning Haskell. Very few real world programs get by without the impure stuff, so if you give the newbie the impression that it isn't there (by postponing it) there's a chance he'll run into a

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread Neil Mitchell
Hi On the contrary, I think it's an excellent way of learning Haskell. I'm writing a lot of useful Haskell code with only one IO action (interact). I don't think I could reasonably construct an introductory problem that couldn't be solved with it, and I haven't yet found an application for

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread C.M.Brown
Hi, On the contrary, I think it's an excellent way of learning Haskell. I'm writing a lot of useful Haskell code with only one IO action (interact). I don't think I could reasonably construct an introductory problem that couldn't be solved with it, and I haven't yet found an application for

Re: [Haskell-cafe] State separation/combination pattern question

2007-01-03 Thread Ian Lynagh
Hi Reto, On Thu, Dec 21, 2006 at 10:11:22PM -0800, Reto Kramer wrote: I've tried to thread the two states (StateA and StateB) using a chain of StateT ... StateT ..., but couldn't really make that work. That is how I would write it; I have attached code for your example. It seems

[Haskell-cafe] Monad Set via GADT

2007-01-03 Thread Roberto Zunino
To improve my understanding of GADT, I tried to define a Set datatype, with the usual operations, so that it can be made a member of the standard Monad class. Here I report on my experiments. First, I recap the problem. Data.Set.Set can not be made a Monad because of the Ord constraint on its

Re: [Haskell-cafe] darcs repo for yampa + gadt

2007-01-03 Thread Donald Bruce Stewart
joelr1: Folks, I have a version of Yampa with Henrik Nilsson's GADT optimizations that I cleaned up for ghc 6.6 and cabalized. Would it be possible to set it up at darcs.haskell.org and if so how should I go about it? There are some details here:

[Haskell-cafe] GADT proofs of FunDeps?

2007-01-03 Thread Roberto Zunino
I am investigating mixing FunDeps with the type equality GADT data Teq a b where Teq :: Teq a a Basically, I would like to write something like proof :: (C a b1, C a b2) = Teq b1 b2 proof = unsafeCoerce# Teq provided the FunDep class C a b | a - b Is this safe? Any caveat?