Re: Constr and Eq

2005-12-29 Thread Frederik Eaton
I see. Maybe there should be a separate function efficientConstrEq :: Constr - Constr - Bool so that people don't get confused with the standard Eq definition? How often is the efficient version needed? In any case, it seems like we should document the fact that the Constr Eq instance doesn't

missing Data instances

2005-12-29 Thread Frederik Eaton
These don't seem to have Data instances in 6.4.1: Language.Haskell.TH.Exp Data.Tree.Tree I guess there are probably a lot more, I just ran into these today. Is there anything which prevents proper 'deriving' clauses from being added to their definitions? Frederik

RE: missing Data instances

2005-12-29 Thread Ralf Lammel
Simon PJ, Is that Ok? Should I? Ralf -Original Message- From: [EMAIL PROTECTED] [mailto:glasgow-haskell- [EMAIL PROTECTED] On Behalf Of Frederik Eaton Sent: Thursday, December 29, 2005 11:39 AM To: glasgow-haskell-bugs@haskell.org Subject: missing Data instances These don't

Re: storing highly shared data structures

2005-12-29 Thread Christian Maeder
Einar Karttunen wrote: On 22.12 14:43, Christian Maeder wrote: How can I detect this sharing in order to avoid traversing the very same symbol table for every symbol? By using System.Mem.StableName SerTH (http://cs.helsinki.fi/u/ekarttun/SerTH/) implements this, so you can look at the source

RE: [Haskell] Boxing (Day) Question

2005-12-29 Thread Simon Peyton-Jones
Ashley I think Lennart answered your question rather well. As he says, the restriction is that an unboxed type must not instantiate a polymorphic type variable (and that polymorphic type variables may not have an unboxed kind). You may like to read the paper Unboxed types as first-class

RE: [Haskell] A question about fundeps - GADT interaction

2005-12-29 Thread Simon Peyton-Jones
Tomasz Intriguing! I'm afraid it'll be some time before your code works, though. First I have to get GADTs and type classes to play together nicely, which I am hoping to do during Jan/Feb. Then I'll have to think about the interaction between GADTs and fundeps. As of today, if it works at

RE: [Haskell] GADTs and GHC

2005-12-29 Thread Simon Peyton-Jones
| My current uses of GADTs belong to the company I work for, so it would | be easier for me if *I* could check from time to time. Is the code | publicly available? Not yet, I'm afraid. But it will be soon. Simon ___ Haskell mailing list

Re: [Haskell] A question about fundeps - GADT interaction

2005-12-29 Thread Tomasz Zielonka
On Thu, Dec 29, 2005 at 09:48:04AM -, Simon Peyton-Jones wrote: Intriguing! I'm afraid it'll be some time before your code works, though. No problem, I can wait. First I have to get GADTs and type classes to play together nicely, which I am hoping to do during Jan/Feb. Then I'll have

RE: [Haskell] A question about fundeps - GADT interaction

2005-12-29 Thread Bruno Oliveira
Hello Tomasz, Unfortunatelly I have only seen your message after Simon answered to it. I am sorry for the late answer! | If there is another way to do this right now (conveniently, Oleg! ;-), I | would be more than happy to hear about it. | | If this worked, it would be a cool trick and a nice

Re: [Haskell] A question about fundeps - GADT interaction

2005-12-29 Thread Tomasz Zielonka
On Thu, Dec 29, 2005 at 12:39:01PM +, Bruno Oliveira wrote: A second alternative would be to simulate your GADT with a type class and your constructors with the functions of that type class: [...] As a remark, this is a church encoding of the GADT. [...] Now you can encode

[Haskell] more newbie questions regarding do syntax, mondic context Data.HashTable

2005-12-29 Thread Hunter Kelly
Hi there, I'm having some trouble trying to get information out of a HashTable. I'm using it to represent a set (I'm using a hash table for O(1) speed reasons to compare against Data.Sets O(lgN) operations). I'm trying to write a simple function, member, which returns whether or not a key is in

Re: [Haskell] more newbie questions regarding do syntax, mondic context Data.HashTable

2005-12-29 Thread Christian Maeder
Hunter Kelly wrote: How can I get at the underlying value? Can I only access it from within a do construct? Yes, I'm afraid so Is there anyway to get at this function to return just True or False? No, (unless you use something unsafe that I would not recommend) Or has using something

Re: [Haskell] more newbie questions regarding do syntax, mondic context Data.HashTable

2005-12-29 Thread Robert Dockins
On Dec 29, 2005, at 9:06 AM, Hunter Kelly wrote: Hi there, I'm having some trouble trying to get information out of a HashTable. I'm using it to represent a set (I'm using a hash table for O(1) speed reasons to compare against Data.Sets O(lgN) operations). I'm trying to write a simple

[Haskell] ANN: hdbc-missingh

2005-12-29 Thread John Goerzen
Hello, I'm pleased to announce the first release of HDBC-MissingH, a library to add database features to MissingH. At the present time, this allows any HDBC database to act as a backend for the MissingH.AnyDBM architecture. As such, you can use a SQL database as storage for a simple DBM-like

[Haskell] Re: A few newbie questions about tracing/debugging andorder of execution

2005-12-29 Thread Srinivas Nedunuri
I agree with the suggestions of the other posters. Sometimes I'll also use error data to print to get a one time breakpoint :-) cheers Hunter Kelly [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Yes, thank you, that did the trick! It produced the output for all steps, and in the

[Haskell] Re: Boxing (Day) Question

2005-12-29 Thread Ashley Yakeley
In article [EMAIL PROTECTED] ft.com, Simon Peyton-Jones [EMAIL PROTECTED] wrote: The .NET CLR lifts the restriction by specialising code, so that it can adapt to whether it is moving Int# or Double# values around. In Haskell, though, it's not possible to statically generate all the

RE: Erlang vs. Haskell (was Re: [Haskell-cafe] binary IO)

2005-12-29 Thread Simon Peyton-Jones
| Using Haskell for this networking app forced me to focus on all the | issues _but_ the business logic. Type constraints, binary IO and | serialization, minimizing memory use and fighting laziness, timers, | tweaking concurrency and setting up message channels, you name it. That's a

Re: [Haskell-cafe] Can this be improved?

2005-12-29 Thread Bruno Oliveira
Hello, On Tue, 27 Dec 2005 16:39:34 +, Chris Kuklewicz wrote: Happy Holidays, I was wondering if it this small snippet of code could be altered to require fewer OPTIONS -fallow-... switches. Here is a partial solution using only -fglasgow-exts: module MyShow where class MyShow t where

[Haskell-cafe] RE: GHC optimization issue

2005-12-29 Thread Simon Peyton-Jones
I did look into this a little. There are several things going on * GHC doesn't really expect you to use INLINE and SPECIALISE together. INLINE says to inline a copy of the function at every call site, which is the best possible form of specialisation, so SPECIALISE is a bit redundant if you are

[Haskell-cafe] Re: OpenAL bindings / compiling ghc 6.5

2005-12-29 Thread Simon Marlow
Michael Benfield wrote: I see here: http://www.haskell.org/HOpenGL/newAPI/ OpenAL bindings listed as part of the Hierachical Libraries. And when I download the source to a development snapshot of GHC, there they are. Is there a way to install this on GHC 6.4? Alternatively... I can't get

Re: [Haskell-cafe] strange stack overflow with Data.Map

2005-12-29 Thread Bulat Ziganshin
Hello David, Thursday, December 29, 2005, 3:42:05 AM, you wrote: stats elems = foldl add_elem Map.empty elems DR This program has a space leak and runs out of stack space. I'm guessing DR that I'm being bit here by an unnatural amount of laziness in DR Map.insertWith stack overflows AFAIK is

Re: [Haskell-cafe] strange stack overflow with Data.Map

2005-12-29 Thread Tomasz Zielonka
On Thu, Dec 29, 2005 at 11:22:11AM +0300, Bulat Ziganshin wrote: stack overflows AFAIK is never occur because of laziness, but only because your recursion is not tail-optimized. AFAIK, evaluating a thunk in GHC-compiled code does use the stack - update frames are being put on it. There is a

[Haskell-cafe] Joels Time Leak

2005-12-29 Thread Adrian Hey
Hello, I haven't followed everything that's happened on the Binary IO thread, but has anybody else actually tried Joels code? .. http://wagerlabs.com/timeleak.tgz I can reproduce the problem (ghc/Linux), but can't explain it. It seems very strange that friggin about with an otherwise

RE: [Haskell-cafe] Joels Time Leak

2005-12-29 Thread Simon Peyton-Jones
Thanks for looking, Adrian, It'd be great if someone was able to find out more about what's going on here. Bandwidth at GHC HQ is always tight, so the more precisely someone can pinpoint what's happening, the faster we can fix it. Joel has done a lot by making a repro case. Maybe others can

Re: [Haskell-cafe] Joels Time Leak

2005-12-29 Thread Joel Reymont
Adrian, There's no mistery here. Threads take a while to unpickle the large server info packet when the gang up on it all together. By adding the MVar you are basically installing a door in front of the packet and only letting one thread come through. The end result is that you are

Re: [Haskell-cafe] strange stack overflow with Data.Map

2005-12-29 Thread Christian Maeder
David Roundy wrote: stats elems = foldl add_elem Map.empty elems add_elem m x = Map.insertWith (+) x 1 m main = print $ stats $ take 100 $ repeat 1 This program has a space leak and runs out of stack space. I'm guessing that I'm being bit here by an unnatural amount of laziness in

Re: [Haskell-cafe] Joels Time Leak

2005-12-29 Thread Tomasz Zielonka
On Thu, Dec 29, 2005 at 01:02:45PM +, Adrian Hey wrote: I haven't followed everything that's happened on the Binary IO thread, but has anybody else actually tried Joels code? .. http://wagerlabs.com/timeleak.tgz I have and I am puzzled too. I can reproduce the problem (ghc/Linux), but

Re: [Haskell-cafe] Joels Time Leak

2005-12-29 Thread Tomasz Zielonka
On Thu, Dec 29, 2005 at 01:20:41PM +, Joel Reymont wrote: Why does it take a fraction of a second for 1 thread to unpickle and several seconds per thread for several threads to do it at the same time? I think this is where the mistery lies. Have you considered any of this: - too big

Re: [Haskell-cafe] strange stack overflow with Data.Map

2005-12-29 Thread David Roundy
On Thu, Dec 29, 2005 at 01:42:29PM +0100, Christian Maeder wrote: David Roundy wrote: stats elems = foldl add_elem Map.empty elems add_elem m x = Map.insertWith (+) x 1 m main = print $ stats $ take 100 $ repeat 1 This program has a space leak and runs out of stack space. I'm

[Haskell-cafe] Re: binary IO

2005-12-29 Thread Peter Simons
Bulat Ziganshin writes: your BlockIO library is great, but it's usage is limited to very specific sutuations - when we can save pass state between processing of individual bytes In my experience, any other approach to I/O is slow. If you don't have an explicit state between processing of

Re: [Haskell-cafe] strange stack overflow with Data.Map

2005-12-29 Thread David Roundy
On Thu, Dec 29, 2005 at 04:24:02PM +0100, Jean-Philippe Bernardy wrote: On 12/29/05, David Roundy [EMAIL PROTECTED] wrote: On Thu, Dec 29, 2005 at 01:42:29PM +0100, Christian Maeder wrote: David Roundy wrote: stats elems = foldl add_elem Map.empty elems add_elem m x = Map.insertWith

[Haskell-cafe] How to read this syntax?

2005-12-29 Thread David F. Place
Hi, I am trying to read _Arrows, Robots, and Functional Reactive Programming_ by Hudak, et al. http://www.haskell.org/yampa/AFPLectureNotes.pdf In section 2.1 there are a number of equations of the form: g’ :: SF A C g’ = arr g = arr f1 arr f2 and i’ :: SF (A,C) (B,D) i’ = arr i

Re: [Haskell-cafe] How to read this syntax?

2005-12-29 Thread Robert Dockins
On Dec 29, 2005, at 11:26 AM, David F. Place wrote: Hi, I am trying to read _Arrows, Robots, and Functional Reactive Programming_ by Hudak, et al. http://www.haskell.org/yampa/AFPLectureNotes.pdf In section 2.1 there are a number of equations of the form: g’ :: SF A C g’ = arr g =

Re: [Haskell-cafe] Joels Time Leak

2005-12-29 Thread Tomasz Zielonka
On Thu, Dec 29, 2005 at 03:34:10PM -0500, Cale Gibbard wrote: The issue with it taking too long seems to basically be as Joel said, only one of the threads can take that MVar at a time. Even if the time that it's taken is fairly short, if one is running faster than the others, it tries to take

[Haskell-cafe] Re: Haskell Speed

2005-12-29 Thread Peter Simons
Albert Lai writes: For almost a decade, most (I dare claim even all) Pascal and C compilers were three-pass or two-pass. It means perhaps the compiler reads the input two or three times [...], or perhaps the compiler reads the input once, produces an intermediate form and saves it to

Re: [Haskell-cafe] Re: Haskell Speed

2005-12-29 Thread Bill Wood
On Thu, 2005-12-29 at 15:56 -0500, Albert Lai wrote: . . . one-pass fast method, since for almost a decade no one did it. Most of us had to wait until someone figured it out and then we had Turbo Judging from comments by U. Ammann [1],[2], part of the original Pascal implementation team at

Re: [Haskell-cafe] strange stack overflow with Data.Map

2005-12-29 Thread Cale Gibbard
Laziness and strictness are both important depending on the situation. I'd recommend keeping both variants around. Having to wrap values in an extra data type just to keep laziness sort of defeats the point of Haskell being lazy in the first place. It also makes it somewhat awkward to use in the

Re: [Haskell-cafe] Mixing IO and STM

2005-12-29 Thread Jared Updike
Also, if you are trying to display a line that looks like insert 5 or consume 6 then consider using putStrLn (insert ++ show r) putStrLn (consume ++ show r) instead of print (insert ++ show r) print

Re: [Haskell-cafe] Haskell vs OCaml

2005-12-29 Thread Albert Lai
I particularly like OCaml's provision of subtyping. As a member of the ML family, it's module system is also quite formidable. Of course the imperative constructs are also pretty convenient when you just want to be quirky. But I miss the monad do-notation.

Re: [Haskell-cafe] Mixing IO and STM

2005-12-29 Thread Brian Sniffen
Here's a version that provides clean output with no delays. It uses a single-entry mailbox (the TMVar output) to ensure the processing doesn't run too far ahead of the log. module Test where import System.Random import Control.Concurrent import Control.Concurrent.STM test :: IO () test = do

Re: [Haskell-cafe] Arrows for invertible programming: Notation, question

2005-12-29 Thread Alexey Rodriguez Yakushev
On Dec 23, 2005, at 11:53, Arjen wrote: On Fri, 23 Dec 2005, Joel Reymont wrote: Folks, I have been looking at the code for the Arrows for invertible programming paper (http://www.cs.ru.nl/A.vanWeelden/bi-arrows/) and I have a question about syntax. ghci surely does not like it. I've

Re: [Haskell-cafe] RE: module names

2005-12-29 Thread Remi Turk
On Fri, Dec 16, 2005 at 07:55:50AM -0800, Scherrer, Chad wrote: From: S Koray Can [mailto:[EMAIL PROTECTED] Why not do this: name none of those modules Main.hs, and have an empty module Main.hs with only import MainDeJour and main = MainDeJour.main so you can just edit just that file.

RE: [Haskell-cafe] Re: Haskell Speed

2005-12-29 Thread Branimir Maksimovic
From: Isaac Gouy [EMAIL PROTECTED] To: haskell-cafe@haskell.org Subject: [Haskell-cafe] Re: Haskell Speed Date: Thu, 29 Dec 2005 13:00:15 -0800 (PST) --- Isaac Gouy [EMAIL PROTECTED] wrote: We'll be happy to also show a Haskell program that uses Data.HashTable - first, someone needs to

Re: [Haskell-cafe] Re: Haskell Speed

2005-12-29 Thread Jan-Willem Maessen
On Dec 29, 2005, at 7:44 PM, Branimir Maksimovic wrote: To comment some observation on this program. Most of the pressure now is on Data.HashTable. I've susspected such large memory usage on substring from array conversions, so mad version with data MyString = MakeMyStrinf { buf :: Ptr Char,

RE: [Haskell-cafe] RE: module names

2005-12-29 Thread Scherrer, Chad
Yes, good point. I suppose there's really no need to re-declare main once it's been imported. Thanks! -Original Message- From: Remi Turk [mailto:[EMAIL PROTECTED] Sent: Thu 12/29/2005 4:34 PM To: Scherrer, Chad Cc: S Koray Can; haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] RE:

Re: [Haskell-cafe] Joels Time Leak

2005-12-29 Thread Tomasz Zielonka
On Thu, Dec 29, 2005 at 10:36:37PM +0100, Tomasz Zielonka wrote: On Thu, Dec 29, 2005 at 03:34:10PM -0500, Cale Gibbard wrote: The issue with it taking too long seems to basically be as Joel said, only one of the threads can take that MVar at a time. Even if the time that it's taken is