Re: Type resolution problem

2001-05-28 Thread Marcin 'Qrczak' Kowalczyk
Mon, 28 May 2001 17:53:38 -0700, Juan Carlos Arevalo Baeza <[EMAIL PROTECTED]> pisze: > Uncommenting the type expression above clears the error. > But, why can't the compiler deduce it by itself? Monomorphism restriction strikes again. See section 4.5.5 in the Haskell 98 Report. A pattern bindin

Re: Multithreaded stateful software

2001-05-28 Thread Manuel M. T. Chakravarty
Mark Carroll <[EMAIL PROTECTED]> wrote, > One of the projects I have coming up is a multi-threaded server that > manages many clients in performing a distributed computation using a > number of computers. So, we care about state, and control flow has some > concurrent threads and is partially eve

Type resolution problem

2001-05-28 Thread Juan Carlos Arevalo Baeza
I'm having a little of a problem with a project of mine. Just check out this, which is the minimum piece of code that will show this problem: type MyType a = a (+++) :: MyType a -> MyType a -> MyType a a +++ b = a class MyClass a where baseVal :: a val1 :: MyClass a => MyType a

Re: Why is there a space leak here?

2001-05-28 Thread David Bakin
Ah, thank you for pointing out concat to me. (Oddly, without knowing about concat, I had tried foldr1 (++) and also foldl1 (++) but got the same space problem and so tried to 'factor it out'.) OK, now I see what's going on - your explanation is good, thanks. Which of the various tools built-in

Re: Why is there a space leak here?

2001-05-28 Thread Tom Pledger
Michal Gajda writes: | On Tue, 29 May 2001, Tom Pledger wrote: : | > When you consume the (3N)th cell of v, you can't yet garbage collect | > the Nth cell because it will be needed for generating the (3N+1)th, | > (3N+2)th and (3N+3)th. | > | > So, as you proceed along the list, about two

Re: Why is there a space leak here?

2001-05-28 Thread Michal Gajda
On Tue, 29 May 2001, Tom Pledger wrote: > David Bakin writes: > > a) Look at how much of the list needs to exist at any one time. > > | -- This has a space leak, e.g., when reducing (length (foo1 100)) > | foo1 m > | = take m v > | where > | v = 1 : flatten (map triple v) >

Why is there a space leak here?

2001-05-28 Thread Tom Pledger
David Bakin writes: : | I have been puzzling over this for nearly a full day (getting this | reduced version from my own code which wasn't working). In | general, how can I either a) analyze code looking for a space leak | or b) experiment (e.g., using Hugs) to find a space leak? Thanks! |

RE: Multithreaded stateful software

2001-05-28 Thread Mark Carroll
On Mon, 28 May 2001, Simon Peyton-Jones wrote: (snip) > http://research.microsoft.com/~simonpj/papers/marktoberdorf.htm > > Haskell is a great language for writing concurrent applications. Thanks! That's very interesting. In a way, I guess I'm taking something of a leap of faith: if everyt

RE: Multithreaded stateful software

2001-05-28 Thread Simon Peyton-Jones
| (c) Haskell's monads, concurrency stuff and TCP/IP libraries | are really quite powerful and useful, and I'll be happy I | picked Haskell for the task. Definitely (c). See Simon Marlow's paper about his experience of writing a web server (highly concurrent), and my tutorial "Tackling the awk

Re: Multithreaded stateful software

2001-05-28 Thread Joe English
Mark Carroll wrote: > One of the projects I have coming up is a multi-threaded server that > manages many clients in performing a distributed computation using a > number of computers. [...] > > (a) This really isn't what Haskell was designed for, and if I try to write > this in Haskell I'll nev

Re: Functional programming in Python

2001-05-28 Thread Marcin 'Qrczak' Kowalczyk
Mon, 28 May 2001 10:23:58 +0100, Malcolm Wallace <[EMAIL PROTECTED]> pisze: > It seems that right-associativity is so intuitive that even the > person proposing it doesn't get it right. :-) And even those who correct them :-) >> f x (foldr1 f xs)f x foldr1 f xs > > Wouldn'

Re: Funny type.

2001-05-28 Thread Ken Shan
On 2001-05-27T22:46:37-0500, Jay Cox wrote: > >data S m a = Nil | Cons a (m (S m a)) > > >instance (Show a, Show (m (S m a))) => Show (S m a) where > > show Nil = "Nil" > > show (Cons x y) = "Cons " ++ show x ++ " " ++ show y Here's how I've been handling such situations: data S m a = Ni

Multithreaded stateful software

2001-05-28 Thread Mark Carroll
Often I've found that quite how wonderful a programming language is isn't clear until you've used it for a non-trivial project. So, I'm still battling on with Haskell. One of the projects I have coming up is a multi-threaded server that manages many clients in performing a distributed computation

RE: Funny type.

2001-05-28 Thread Simon Peyton-Jones
You need a language extension. Check out Section 7 of "Derivable type classes" http://research.microsoft.com/~simonpj/Papers/derive.htm Alas, I have not implemented the idea yet. (Partly because no one ever reports it as a problem; you are the first!) Simon | One day I was playing ar

RE: Functional programming in Python

2001-05-28 Thread Malcolm Wallace
It seems that right-associativity is so intuitive that even the person proposing it doesn't get it right. :-) Partial applications are a particular problem: > Haskell Non-Haskell > Left Associative Right Associative > From Prelude--