[Haskell-cafe] Bizarre garbage collection behaviour

2006-10-09 Thread Guillaume Theoret
I'm using Hugs98 for .NET and I'm running into some bizarre garbage collection issues. I hope I'm posting at the right spot. I didn't want to post this in Hugs bugs since I'm pretty new to Haskell and it's entirely possible I'm doing something a way I shouldn't. Back to the problem at hand. My

Re: [Haskell-cafe] Haskell performance (again)!

2006-10-09 Thread Yang
On 10/8/06, Udo Stenzel u.stenzel-at-web.de |haskell-cafe| ... wrote: Yang wrote: type Poly = [(Int,Int)] addPoly1 :: Poly - Poly - Poly addPoly1 p1@(p1h@(p1c,p1d):p1t) p2@(p2h@(p2c,p2d):p2t) | p1d == p2d = (p1c + p2c, p1d) : addPoly1 p1t p2t | p1d p2d = p1h : addPoly1 p1t p2 |

Re: [Haskell-cafe] Announce: Monad Transformer Tutorial

2006-10-09 Thread Tomasz Zielonka
On Fri, Oct 06, 2006 at 11:40:46AM +0200, Martin Grabmueller wrote: I hereby announce a small tutorial on using monad transformers. In contrast to others found on the web, it concentrates on using them, not on their implementation. I'd like to hear comments, suggestions, etc. about it! I

Re: [Haskell-cafe] Announce: Monad Transformer Tutorial

2006-10-09 Thread Tomasz Zielonka
An errata for my email: On Mon, Oct 09, 2006 at 09:44:47AM +0200, Tomasz Zielonka wrote: No let's get to nitpicking ;-) should be Now let's get to nitpicking ;-) * page 8, at about 85%: you say The state maintained in our example is a simple integer value, but it *can* be any data type

[Haskell-cafe] casting

2006-10-09 Thread Thomas Conway
Hi All I'm having some difficulty with typeclasses. What I'm trying to do should be obvious, but it's still giving me trouble. I want to take a packaged item, and strengthen the constraints on its type. Rather than being just any type that is an instance of A, I want to do a runtime check and

[Haskell-cafe] Re: casting

2006-10-09 Thread Thomas Conway
On 10/9/06, I wrote: So, can anyone suggest how I can achieve my goal? And how many milliolegs of type hackery will it take? ;-) Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] casting

2006-10-09 Thread Misha Aizatulin
Thomas Conway wrote: I'm having some difficulty with typeclasses. What I'm trying to do should be obvious, but it's still giving me trouble. I want to take a packaged item, and strengthen the constraints on its type. Rather than being just any type that is an instance of A, I want to do a

[Haskell-cafe] Vertical tabs in source code and other obscure chars

2006-10-09 Thread Brian Hulley
Hi, In the Haskell98 report at http://haskell.org/onlinereport/lexemes.html section 2.2 has the rule: whitechar - newline | vertab | space | tab | uniWhite Does anyone know what a vertical tab is supposed to do? Is there any reason to allow them as whitespace? (Does anyone in the universe

Re: [Haskell-cafe] Re: Haskell performance (again)!

2006-10-09 Thread Cale Gibbard
On 09/10/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Cale Gibbard wrote: I might also like to point out that by small and large, we're actually referring to the number of ways in which components of the datastructure can be computed separately, which tends to correspond nicely to how one

Re: [Haskell-cafe] casting

2006-10-09 Thread Thomas Conway
Thanks Misha Matthias. I now get what's going on. The mention of the word dictionary revealed it all. I've spent the last 7 years programming in C++, and had dynamic_cast firmly fixed in my head. I totally forgot that Fergus Henderson and I independently reinvented dictionary passing for the

Re: [Haskell-cafe] Vertical tabs in source code and other obscure chars

2006-10-09 Thread Thomas Conway
Mostly hysterical raisins, I think. T. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Strictness, order of IO operations: NewCGI HDBC

2006-10-09 Thread Tim Smith
Hello, Haskell Cafe. I posted a question a while ago about this, but didn't receive any responses. I'd like to try again. I've got a test case which uses John Goerzen's HDBC.ODBC. The problem I have is that it appears too lazy - using the results of a query after disconnecting causes an

[Haskell-cafe] Re: Strictness, order of IO operations: NewCGI HDBC

2006-10-09 Thread John Goerzen
On Mon, Oct 09, 2006 at 04:01:02PM -0600, Tim Smith wrote: main = do dbh - connectODBC DSN=test res - DB.getTables dbh -- print (show ((concat . intersperse , ) res)) DB.disconnect dbh print (show ((concat . intersperse , ) res)) Am I just expecting the wrong thing from

Re: [Haskell-cafe] Haskell performance (again)!

2006-10-09 Thread Lennart Augustsson
I think your first try looks good. The only thing to worry about would be the + being too lazy. But that's easy to fix at the same time as improving your code in another respect. It's usually good to use real types instead of synonyms, so let's do that. data Nom = Nom Int Int type

[Haskell-cafe] a monad for secret information

2006-10-09 Thread Seth Gordon
I finally (think I) understand monads well enough to make one up: module Secret (Secret, classify, declassify) where data Secret a = Secret a classify :: a - Secret a classify x = Secret x declassify :: Secret a - String - Maybe a declassify (Secret x) xyzzy = Just x declassify (Secret x) _

[Haskell-cafe] Re: How would you replace a field in a CSV file?

2006-10-09 Thread John Goerzen
On 2006-10-01, Pete Kazmier [EMAIL PROTECTED] wrote: For those that know python, here is a very simple implementation that happens to be very fast compared to my Haskell version and very short: for line in sys.stdin: fields = line.split(',') Of course, this doesn't handle quoted

Re: [Haskell-cafe] a monad for secret information

2006-10-09 Thread Cale Gibbard
On 09/10/06, Seth Gordon [EMAIL PROTECTED] wrote: I finally (think I) understand monads well enough to make one up: module Secret (Secret, classify, declassify) where data Secret a = Secret a classify :: a - Secret a classify x = Secret x declassify :: Secret a - String - Maybe a

Re: [Haskell-cafe] Haskell performance (again)!

2006-10-09 Thread Brian Hulley
Lennart Augustsson wrote: I think your first try looks good. [snip] ... addPoly1 p1@(p1h@(Nom p1c p1d):p1t) p2@(p2h@(Nom p2c p2d):p2t) | p1d == p2d = Nom (p1c + p2c) p1d : addPoly1 p1t p2t | p1d p2d = p1h : addPoly1 p1t p2 | p1d p2d = p2h : addPoly1 p1 p2t ... The last comparison