Re: [Haskell-cafe] grapefruit on windows or osX

2010-02-23 Thread Wolfgang Jeltsch
Am Sonntag, 21. Februar 2010 21:57:45 schrieb gladst...@gladstein.com: I'm unable to get grapefruit going on osx or windows because (I think) I can't get the underlying GTK installed. Hi, thank you for giving Grapefruit a try. Yes, you are most likely right that Gtk2Hs is the stumbling block.

[Haskell-cafe] Alex Lexer: Trying to get rid of Alex

2010-02-23 Thread Amit Deshwar
Hi Haskell-cafe My problem: I'm trying to obtain the current position of the lexer once it reaches the end of the file (line and row number). I'm trying to do this in a function: getEndPosition = do (a,b,c) - alexGetInput return a Unfortunately, the type of a is 'Alex AlexPosn' instead of

Re: [Haskell-cafe] Alex Lexer: Trying to get rid of Alex

2010-02-23 Thread Bernie Pope
On 23 February 2010 20:15, Amit Deshwar amit.desh...@gmail.com wrote: Hi Haskell-cafe My problem:  I'm trying to obtain the current position of the lexer once it reaches the end of the file (line and row number). I'm trying to do this in a function: getEndPosition = do   (a,b,c) -

Re: [Haskell-cafe] Parsing of bytestrings with non-String errors?

2010-02-23 Thread Magnus Therning
On Tue, Feb 23, 2010 at 00:39, Bryan O'Sullivan b...@serpentine.com wrote: On Mon, Feb 22, 2010 at 2:38 PM, Magnus Therning mag...@therning.org wrote: My thoughts went more like a parser type like    data Parser e a = ... Yes, I knew that's where you were going :-) The trouble is, you'd

[Haskell-cafe] Function to detect duplicates

2010-02-23 Thread Rafael Gustavo da Cunha Pereira Pinto
Hi folks, While solving a puzzle, I was posed the problem of finding if there was no duplicates on a list. First I used: noneRepeated=null.(filter (1)).(map length).group.sort But this seemed very unneficient, so I thought that I could detect the duplicates while sorting, and devised this:

Re: [Haskell-cafe] Function to detect duplicates

2010-02-23 Thread Jonas Almström Duregård
Hi Rafael, I assume you will perform this operation on some very large lists, or performance would not be an issue. Have you tested if your optimized version is better than your initial one? You should compare your implementation against something like this: import qualified Data.Set as Set

[Haskell-cafe] Profiling OpenGL applications

2010-02-23 Thread Sönke Hahn
On Sunday, Andrew Coppin asked: Is Thread Scope any use for profiling single-threaded programs? I used threadscope to look at eventlogs from a program that uses OpenGL to render multiple frames per second (compiled without -threaded). That means, there is CPU activity regularly (multiple

[Haskell-cafe] Re: Function to detect duplicates

2010-02-23 Thread Ertugrul Soeylemez
Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com wrote: While solving a puzzle, I was posed the problem of finding if there was no duplicates on a list. First I used: noneRepeated=null.(filter (1)).(map length).group.sort But this seemed very unneficient, so I thought that

Re: [Haskell-cafe] Re: Function to detect duplicates

2010-02-23 Thread Daniel Fischer
Am Dienstag 23 Februar 2010 13:03:45 schrieb Ertugrul Soeylemez: Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com wrote: While solving a puzzle, I was posed the problem of finding if there was no duplicates on a list. First I used: noneRepeated=null.(filter (1)).(map

Re: [Haskell-cafe] Re: Function to detect duplicates

2010-02-23 Thread Jonas Almström Duregård
Ertugrul: while your solution is minimalistic, Rafael deemed his ~n*log n implementation too inefficient. Thus your ~n^3 implementation is hardly an improvement... /Jonas On 23 February 2010 13:03, Ertugrul Soeylemez e...@ertes.de wrote: Rafael Gustavo da Cunha Pereira Pinto

Re: [Haskell-cafe] Function to detect duplicates

2010-02-23 Thread Ketil Malde
Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com writes: First I used: noneRepeated=null.(filter (1)).(map length).group.sort But this seemed very unneficient, so I thought that I could detect the duplicates while sorting, and devised this: [...] 1) Is there any

[Haskell-cafe] Re: Function to detect duplicates

2010-02-23 Thread Ertugrul Soeylemez
Jonas Almström Duregård jonas.dureg...@gmail.com wrote: Ertugrul: while your solution is minimalistic, Rafael deemed his ~n*log n implementation too inefficient. Thus your ~n^3 implementation is hardly an improvement... My variant has an advantage, though. It is completely lazy, so it will

Re: [Haskell-cafe] Re: Function to detect duplicates

2010-02-23 Thread Daniel Fischer
Am Dienstag 23 Februar 2010 13:59:49 schrieb Ertugrul Soeylemez: Jonas Almström Duregård jonas.dureg...@gmail.com wrote: Ertugrul: while your solution is minimalistic, Rafael deemed his ~n*log n implementation too inefficient. Thus your ~n^3 implementation is hardly an improvement... Not

[Haskell-cafe] Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Andy Gimblett
Hi all, Short version: How can I pretty print and parse values of type Double such that those operations are each other's inverse? Long version: I'm writing and QuickCheck-testing a parser using the approach set out here:

Re: [Haskell-cafe] Re: Function to detect duplicates

2010-02-23 Thread Jonas Almström Duregård
noneRepeated xs = xs == nub xs Not quite as bad, nub is O(n^2) You are correct of course. Still, it will probably be a bit less inefficient if the length of the lists are compared (as opposed to the elements): noneRepeated xs = length xs == length (nub xs) On 23 February 2010 14:09, Daniel

Re: [Haskell-cafe] Re: Function to detect duplicates

2010-02-23 Thread Daniel Fischer
Am Dienstag 23 Februar 2010 14:54:36 schrieb Jonas Almström Duregård: You are correct of course. Still, it will probably be a bit less inefficient if the length of the lists are compared (as opposed to the elements): noneRepeated xs = length xs == length (nub xs) Only if no repeated elements

Re: [Haskell-cafe] Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Daniel Fischer
Am Dienstag 23 Februar 2010 14:44:50 schrieb Andy Gimblett: Hi all, Short version: How can I pretty print and parse values of type Double such that those operations are each other's inverse? Long version: I'm writing and QuickCheck-testing a parser using the approach set out here:

[Haskell-cafe] Re: Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Christian Maeder
Andy Gimblett schrieb: Hi all, Short version: How can I pretty print and parse values of type Double such that those operations are each other's inverse? Maybe you have more luck with show and read (without Parsec.Token). Your example: x = 9.91165677454629 fails because the computation

[Haskell-cafe] Re: Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Andy Gimblett
Short version: How can I pretty print and parse values of type Double such that those operations are each other's inverse? Maybe you have more luck with show and read (without Parsec.Token). Your example: x = 9.91165677454629 fails because the computation performed by the parser 9.0 +

[Haskell-cafe] Problems linking hsql-mysql

2010-02-23 Thread Maciej Podgurski
Hi, I have problems linking a simple test program that imports Database.HSQL.MySQL via ghc --make Test.hs. The error only occurs when importing this module of hsql-mysql-1.7.1. I pasted the building output here: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=22911 (actually it was even longer

Re: [Haskell-cafe] Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Lennart Augustsson
If you use read (reads) and show for the actual conversion it will round trip. It appears to be non-trivial since most languages and libraries get it wrong. :) -- Lennart On Tue, Feb 23, 2010 at 1:44 PM, Andy Gimblett hask...@gimbo.org.uk wrote: Hi all, Short version: How can I pretty print

Re: [Haskell-cafe] Re: Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Andy Gimblett
For the record, here's the final improved version: float' :: TokenParser st - GenParser Char st Double float' t = do n - liftCtoS '-' w - many1 digit char '.' f - many1 digit e - option $ do char 'e' n' -

Re: [Haskell-cafe] Problems linking hsql-mysql

2010-02-23 Thread Nick Rudnick
Hi Maciej, I will try to reproduce the error -- could you send me your both *.cabal files (for hsql hsql-mysql), if you have changed anything, and your system configuration. Is this extremely urgent? I ask this, as these days exactly the end phase of the projects of about 100 beginner

Re: [Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-23 Thread Brandon S. Allbery KF8NH
On Feb 21, 2010, at 20:17 , Jeremy Shaw wrote: The PS3 does do something though. If we were doing a write *and* read select on the socket, the read select would wakeup. So, it is trying to notify us that something has happened, but we are not seeing it because we are only looking at the

Re: [Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-23 Thread Donn Cave
Quoth Brandon S. Allbery KF8NH allb...@ece.cmu.edu, On Feb 21, 2010, at 20:17 , Jeremy Shaw wrote: The PS3 does do something though. If we were doing a write *and* read select on the socket, the read select would wakeup. So, it is trying to notify us that something has happened, but we are

Re: [Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-02-23 Thread Brandon S. Allbery KF8NH
On Feb 23, 2010, at 23:47 , Donn Cave wrote: My prediction is that on the contrary, the transition between functional and defunct will not be not announced in any way by the peer, but that's just guessing. It would be a lot less interesting. But that's not the issue. The *kernel* is

Re: [Haskell-cafe] Optimizing hash array mapped tries

2010-02-23 Thread Brandon S. Allbery KF8NH
On Feb 22, 2010, at 02:15 , Edward Z. Yang wrote: * i-Full-update essentially copies a 32-size vector, with a change to one element. I think I am getting brutally punished for this, in terms of both memory usage as well as runtime. What I'm curious is whether or not this is intrinsic to the

Re: [Haskell-cafe] GHC RTS question

2010-02-23 Thread Brandon S. Allbery KF8NH
On Feb 22, 2010, at 03:36 , Roman Cheplyaka wrote: * Anthony Cowley acow...@seas.upenn.edu [2010-02-21 14:15:00-0500] #! /usr/bin/env bash ./prog --RTS $* ./prog --RTS $@ Otherwise it will work wrong if arguments contain quoted field separators (e.g. spaces). #! /bin/sh ./prog --RTS

Re: [Haskell-cafe] Linux ghci vs Windows ghci

2010-02-23 Thread Brandon S. Allbery KF8NH
On Feb 21, 2010, at 06:27 , Donghee Nah wrote: I'm using Windows 7 32bit Host OS(ghc 6.8.3) and Virtualbox Archlinux Guest OS(ghc 6.8.4) I feel that ghci code executing speed in guest os is 1.5~2x faster than host os My guess is that GHC (and the GHC RTS) on win32 is using a POSIX

[Haskell-cafe] [offtopic] UNIX Shell (was: GHC RTS question)

2010-02-23 Thread Roman Cheplyaka
* Brandon S. Allbery KF8NH allb...@ece.cmu.edu [2010-02-24 00:02:12-0500] On Feb 22, 2010, at 03:36 , Roman Cheplyaka wrote: * Anthony Cowley acow...@seas.upenn.edu [2010-02-21 14:15:00-0500] #! /usr/bin/env bash ./prog --RTS $* ./prog --RTS $@ Otherwise it will work wrong if arguments