Re: [Haskell-cafe] How can I avoid buffered reads?

2012-11-29 Thread Leon Smith
Well, I took Bardur's suggestion and avoided all the complexities of GHC's IO stack and simply used System.Posix.IO and Foreign.This appears to work, but for better or worse, it is using blocking calls to the read system call and is not integrated with GHC's IO manager. This shouldn't be

Re: [Haskell-cafe] Can not use ST monad with polymorphic function

2012-11-29 Thread Dmitry Kulagin
Thank you, MigMit! If I replace your type FoldSTVoid with: data FoldMVoid = FoldMVoid {runFold :: Monad m = (Int - m ()) - m ()} then everything works magically with any monad! That is exactly what I wanted, though I still do not quite understand why wrapping the type solves the problem Dmitry

Re: [Haskell-cafe] SOX - play simple

2012-11-29 Thread Antoine Latter
The example is assuming you have an import statement like this: import qualified Sound.Sox.Option.Format as Option On Wed, Nov 28, 2012 at 8:48 AM, Gary Klindt gary.kli...@googlemail.com wrote: Dear Cafe, after installing the Sox library (cabal install sox) I wanted to let run a minimal

[Haskell-cafe] Simple GUI Form

2012-11-29 Thread Rune Harder Bak
Hi I have some input parameters data Input = ... that I need the user to enter in a gui pop-up. (windows people...) The rest of the app is not gui (or perhaps progress could be displayed in a log-window) What is the easiest way to make such a GUI form? It need to compile for both Linux and

Re: [Haskell-cafe] Simple GUI Form

2012-11-29 Thread Ertugrul Söylemez
Hi there Rune, if you want to get started with declarative GUI programming in Haskell, I really recommend taking the FRP route. Check out the reactive-banana-wx [1] library instead of using wxHaskell directly. If you manage to get wxHaskell working on Windows, then reactive-banana will work as

Re: [Haskell-cafe] delete http://www.haskell.org/haskellwiki/Haskell_IDE

2012-11-29 Thread Roman Beslik
Good point. Done. On 29.11.12 06:16, Conrad Parker wrote: #REDIRECT [[IDEs]] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Simple GUI Form

2012-11-29 Thread Rune Harder Bak
I'm very interested in FRP, but all the examples I could see was forms with live feedback gui like a real-time calculator. This is a one-time form where the user fills everything in, clicks on a button, where after the computations might take a long time, perhaps display some console-info. But

Re: [Haskell-cafe] Simple GUI Form

2012-11-29 Thread Ertugrul Söylemez
Rune Harder Bak r...@bak.dk wrote: I'm very interested in FRP, but all the examples I could see was forms with live feedback gui like a real-time calculator. This is a one-time form where the user fills everything in, clicks on a button, where after the computations might take a long time,

Re: [Haskell-cafe] Observer pattern in haskell FRP

2012-11-29 Thread Heinrich Apfelmus
Nathan Hüsken wrote: Heinrich Apfelmus wrote: Personally, I would recommend is a complete change in perspective. The main idea of FRP is that it is a method to describe the evolution of values in time. What is a game? It's just a picture that evolves in time. The user can exert influence on

[Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-11-29 Thread Jon Fairbairn
Ben Franksen ben.frank...@online.de writes: just wanted to drop by to say how much I like the new lambda case extension. I use it all the time and I just *love* how it relieves me from conjuring up dummy variables, which makes teh code not only esier to write but also to read. […] should

[Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Fixie Fixie
Hi all haskellers I every now and then get the feeling that doing my job code in Haskell would be a good idea. I have tried a couple of times, but each time I seem to run into performance problems - I do lots of heavy computing. The problem seems to be connected to lazy loading, which makes

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Alfredo Di Napoli
Hi there, I'm only an amateur so just my 2 cent: Haskell can be really fast, but reaching that speed can be all but trivial: you need to use different data types (e.g. ByteString vs. the normal String type) relies on unconventional IO (e.g. Conduit, Iterateee) and still be ready to go out of the

Re: [Haskell-cafe] Simple GUI Form

2012-11-29 Thread timothyhobbs
I know it's not wx, but if you were willing to use GTK, you could simply install: http://hackage.haskell.org/package/gtk-jsinput and generate the form automatically as described in: https://github.com/timthelion/gtk-jsinput/blob/master/Graphics/UI/Gtk/ Custom/JSInput.hs Timothy

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Johan Tibell
Hi Felix, On Thu, Nov 29, 2012 at 10:09 AM, Fixie Fixie fixie.fi...@rocketmail.com wrote: The problem seems to be connected to lazy loading, which makes my programs so slow that I really can not show them to anyone. I have tried all tricks in the books, like !, seq, non-lazy datatypes... My

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Ivan Salazar
I hear you, my friend. What I love of Haskell is that a lot of algorithms are very clean to express and understand compared to, say, Lisp or C. Compared to Lisp, function manipulation is also very clean (even compared to Racket). A great plus is also type inference. The bad side is that direct

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Clark Gaebel
If you can give an example of some underperforming code, I'm sure someone (or several people) on this list would be more than happy to help you make it more performant. Generally, it doesn't take much. It's all in knowing where to look. Also, if you know performance is key, you should be using

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Fixie Fixie
Oh, my - what an indentation :-) New try: - Videresendt melding Fra: Fixie Fixie fixie.fi...@rocketmail.com Til: haskell-cafe@haskell.org haskell-cafe@haskell.org  Kopi: Clark Gaebel cgae...@uwaterloo.ca  Sendt: Torsdag, 29. november 2012 20.57 Emne: Vedr: [Haskell-cafe] To my boss: The

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Johan Tibell
Ack, it seems like you're running into one of these bugs (all now fixed, but I don't know in which GHC version): http://hackage.haskell.org/trac/ghc/search?q=doubleFromInteger ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Vedr: To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Fixie Fixie
The program seems to take around 6 seconds on my linux-box, while the c version goes for 0.06 sekcond. That is really some regression bug :-) Anyone with a more recent version thatn 7.4.1? Felix Fra: Johan Tibell johan.tib...@gmail.com Til: Fixie Fixie

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Johan Tibell
On Thu, Nov 29, 2012 at 1:00 PM, Fixie Fixie fixie.fi...@rocketmail.com wrote: The program seems to take around 6 seconds on my linux-box, while the c version goes for 0.06 sekcond. That is really some regression bug :-) Anyone with a more recent version thatn 7.4.1? On 7.4.2: $ time

[Haskell-cafe] Vedr: To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Fixie Fixie
That's really an argument for upgrading to 7.4.2 :-) Another reason for doing things with haskell is this mailing list. Thanks! Felix Fra: Johan Tibell johan.tib...@gmail.com Til: Fixie Fixie fixie.fi...@rocketmail.com Kopi: Haskell cafe

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Johan Tibell
On Thu, Nov 29, 2012 at 1:23 PM, Fixie Fixie fixie.fi...@rocketmail.com wrote: That's really an argument for upgrading to 7.4.2 :-) Another reason for doing things with haskell is this mailing list. FYI I'm still looking into this issue as I'm not 100% happy with the code GHC generates.

Re: [Haskell-cafe] Vedr: To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Daniel Fischer
On Donnerstag, 29. November 2012, 21:00:36, Fixie Fixie wrote: The program seems to take around 6 seconds on my linux-box, while the c version goes for 0.06 sekcond. That is really some regression bug :-) Anyone with a more recent version thatn 7.4.1? I don't even have a problem with

Re: [Haskell-cafe] Vedr: To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Johan Tibell
On Thu, Nov 29, 2012 at 1:32 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: We have an unpleasant regression in comparison to 7.2.* and the 7.4.* were slower than 7.6.1 is, but it's all okay here (not that it wouldn't be nice to have it faster still). Are you on a 32-bit system?

Re: [Haskell-cafe] Vedr: To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Johan Tibell
On Thu, Nov 29, 2012 at 1:40 PM, Johan Tibell johan.tib...@gmail.com wrote: This version works around the Word-Double conversion bug and shows good performance: I'd also like to point out that I've removed lots of bang patterns that weren't needed. This program runs fine without any bang

Re: [Haskell-cafe] Vedr: To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Daniel Fischer
On Donnerstag, 29. November 2012, 13:40:42, Johan Tibell wrote: word2Double :: Word - Double word2Double (W# w) = D# (int2Double# (word2Int# w)) On my (64-bit) machine the Haskell and C versions are on par. Yes, but the result is very different.

[Haskell-cafe] Is anyone working on a sparse matrix library in Haskell?

2012-11-29 Thread Mark Flamer
I am looking to continue to learn Haskell while working on something that might eventually be useful to others and get posted on Hackage. I have written quite a bit of Haskell code now, some useful and a lot just throw away for learning. In the past others have expressed interest in having a

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Stephen Tetley
On 29 November 2012 18:09, Fixie Fixie fixie.fi...@rocketmail.com wrote: What is your experience, dear haskellers? To me it seems this beautiful language is useless without a better lazy/eager-analyzer. Since when has speed been the sole arbiter of utility? 10 years ago I switched from

Re: [Haskell-cafe] Vedr: To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Daniel Fischer
On Donnerstag, 29. November 2012, 13:40:42, Johan Tibell wrote: word2Double :: Word - Double word2Double (W# w) = D# (int2Double# (word2Int# w)) On my (64-bit) machine the Haskell and C versions are on par. On my box, the Haskell is even faster then, but, as said, the result is incorrect

Re: [Haskell-cafe] Vedr: To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Johan Tibell
On Thu, Nov 29, 2012 at 2:02 PM, Johan Tibell johan.tib...@gmail.com wrote: On Thu, Nov 29, 2012 at 2:01 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Donnerstag, 29. November 2012, 13:40:42, Johan Tibell wrote: word2Double :: Word - Double word2Double (W# w) = D# (int2Double#

Re: [Haskell-cafe] Why Kleisli composition is not in the Monad signature?

2012-11-29 Thread Brent Yorgey
On Thu, Nov 29, 2012 at 03:52:58AM +0100, Ben Franksen wrote: Tony Morris wrote: As a side note, I think a direct superclass of Functor for Monad is not a good idea, just sayin' class Functor f where fmap :: (a - b) - f a - f b class Functor f = Apply f where (*) :: f (a -

Re: [Haskell-cafe] Recursive timezone-loading function

2012-11-29 Thread Yitzchak Gale
Hi David, David Thomas wrote: https://github.com/dlthomas/tzcache A small bit of code, but seems likely to be useful enough that I figured I should share. Thanks for sharing this! 1) Does this already exist somewhere I missed? I haven't seen it anywhere. 2) It seems silly to make

Re: [Haskell-cafe] Recursive timezone-loading function

2012-11-29 Thread Roman Cheplyaka
* Yitzchak Gale g...@sefer.org [2012-11-30 00:28:45+0200] I think the proper abstraction would be a more general fold or traversal over a directory structure. Some languages have something like that (e.g., os.walk in Python). Check out

Re: [Haskell-cafe] Why Kleisli composition is not in the Monad signature?

2012-11-29 Thread Ben Franksen
Brent Yorgey wrote: On Thu, Nov 29, 2012 at 03:52:58AM +0100, Ben Franksen wrote: Tony Morris wrote: As a side note, I think a direct superclass of Functor for Monad is not a good idea, just sayin' class Functor f where fmap :: (a - b) - f a - f b class Functor f = Apply f

Re: [Haskell-cafe] Is anyone working on a sparse matrix library in Haskell?

2012-11-29 Thread Andreas Abel
Hi Mark, I might become your user. Currently, for Agda I have rolled my own sparse matrix implementation, see http://hackage.haskell.org/packages/archive/Agda/latest/doc/html/src/Agda-Termination-SparseMatrix.html Cheers, Andreas On 29.11.12 5:03 PM, Mark Flamer wrote: I am looking to

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-11-29 Thread Andreas Abel
I had been missing a pattern matching lambda in Haskell for a long time (SML had fn since ages) and my typical use will be monadic_expr = \case branches I think \case is not the worst choice, certainly better than of ... Thanks to the GHC 7.6 developers! Cheers, Andreas On 29.11.12