[Haskell-cafe] Parsec question

2007-06-21 Thread Levi Stephen
Hi, Fairly new to Haskell and trying some parsec. (Also, new to parsers/interpreters) I had come up with this, which works, but I can't help thinking there's a better way :) | newtype Identifier = Identifier String newtype Literal = StringLiteral String -- to be extended later data

Re: [Haskell-cafe] Parsec question

2007-06-21 Thread Tomasz Zielonka
On Thu, Jun 21, 2007 at 03:34:54PM +0930, Levi Stephen wrote: Is there a way through combining types/parsers that the double do block in primary could be avoided? I understand it's necessary right now because the parsers identifier and stringLiteral return different types, so I can't just

Re: [Haskell-cafe] FFI and Excel VBA

2007-06-21 Thread Cyril Schmidt
A while ago I built a Haskell DLL that had to be invoked from Excel. For some reason (I do not remember exactly why) it did not work directly, so I wrote a small wrapper DLL in C++ that invoked Haskell functions. The wrapper DLL was invoked by Excel via COM. As regards your example, the only

Re: [Haskell-cafe] Re: To yi or not to yi, is this really the question? A plea for a cooperative, ubiquitous, distributed integrated development system.

2007-06-21 Thread Pasqualino 'Titto' Assini
Thanks for the explanation. But, doesn't this simply mean that the correct signature would be: serialize :: (Int - Int) - IO String to take in account the fact that serialise really use 'external' information that is not in the domain of pure Haskell functions? Having serialize in the IO

Re: [Haskell-cafe] Reification in Haskell, was: To yi or not to yi

2007-06-21 Thread Pasqualino 'Titto' Assini
Hi Bulat, do you mean that as the type information is used only at compilation time and then thrown away there is no way of getting it back at execution time? best, titto On Wednesday 20 June 2007 16:33:12 Bulat Ziganshin wrote: Hello Pasqualino, Wednesday, June 20, 2007, 11:30:32 AM,

[Haskell-cafe] Re: Orthogonal Persistence in Haskell

2007-06-21 Thread Pasqualino 'Titto' Assini
Hi Claus, On Wednesday 20 June 2007 16:41:16 Claus Reinke wrote: with orthogonal persistence, everything a program touches might persist, but usually, programs talk about the data being persistet (?), not about whether that data is currently temporary or in long-term storage. if you want to

Re: [Haskell-cafe] Re: To yi or not to yi, is this really the question? A plea for a cooperative, ubiquitous, distributed integrated development system.

2007-06-21 Thread Tom Schrijvers
On Thu, 21 Jun 2007, Pasqualino 'Titto' Assini wrote: Thanks for the explanation. But, doesn't this simply mean that the correct signature would be: serialize :: (Int - Int) - IO String to take in account the fact that serialise really use 'external' information that is not in the domain of

RE: [Haskell-cafe] Re: Plugin Problem

2007-06-21 Thread Bayley, Alistair
[mailto:[EMAIL PROTECTED] On Behalf Of Daniel Fischer I suppose in contrast to the version from HackageDB, which I got myself on monday, the darcs version works with ghc = 6.6, or I probably would have heard about it. So I'll try to get me that, only where?

Re: [Haskell-cafe] To yi or not to yi, is this really the question? A plea for a cooperative, ubiquitous, distributed integrated development system.

2007-06-21 Thread Tomasz Zielonka
On Mon, Jun 18, 2007 at 10:05:40PM +0100, Pasqualino 'Titto' Assini wrote: Most languages, even Java, have a reflection capability to dynamically inspect an object. _Even_ Java? That's a strange point of view considering how much money went into this technology. I also find it hard to believe

[Haskell-cafe] 1d-rubik

2007-06-21 Thread Arie Groeneveld
Hi all, I read this on the J -programming forum http://www.jsoftware.com/pipermail/programming/2007-June/007004.html Maybe of interest, especially the part of generating the subgroup or composing a more intelligent solver. quote I found an interesting game, as found on Andrew Nikitin's

Re: [Haskell-cafe] To yi or not to yi, is this really the question? A plea for a cooperative, ubiquitous, distributed integrated development system.

2007-06-21 Thread Tomasz Zielonka
On Thu, Jun 21, 2007 at 10:27:58AM +0200, Tomasz Zielonka wrote: On Mon, Jun 18, 2007 at 10:05:40PM +0100, Pasqualino 'Titto' Assini wrote: Most languages, even Java, have a reflection capability to dynamically inspect an object. It is surprising that Haskell doesn't offer it. I'll just

Re: [Haskell-cafe] Useful IDE features -

2007-06-21 Thread Ketil Malde
On Thu, 2007-06-21 at 00:20 +0100, Claus Reinke wrote: in practice, overloading introduces overhead that might hamper performance. You mean overloading in general, so using type classes? Is this comparable to the Java/C#/C++ overhead with virtual methods, so one extra level of

Re: [Haskell-cafe] Parsec question

2007-06-21 Thread Dave Tapley
I find it's good for the soul to remember what the do notation is doing for us. Also I'm with Einstein on You do not really understand something unless you can explain it to your grandmother :) Personally I think (in this instance) your three 'Parser a' functions read nicer as: primary =

[Haskell-cafe] Re: haskell crypto is reaaaaaaaaaally slow

2007-06-21 Thread apfelmus
Anatoly Yakovenko wrote: I don't think the problem with performance of crypto has anything to do with unpacking ByteStrings. If I unpack the bytestrings first, then run the hash, and just time the hash algorithm, i still get 4 seconds with crypto where the C implementation gives me 0.02

RE: [Haskell-cafe] To yi or not to yi, is this really the question? A plea for a cooperative, ubiquitous, distributed integrated development system.

2007-06-21 Thread Bayley, Alistair
[mailto:[EMAIL PROTECTED] On Behalf Of Tomasz Zielonka On Mon, Jun 18, 2007 at 10:05:40PM +0100, Pasqualino 'Titto' Assini wrote: Most languages, even Java, have a reflection capability to dynamically inspect an object. It is surprising that Haskell doesn't offer it. I'll

[Haskell-cafe] Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Pasqualino 'Titto' Assini
Hi Tom, On Thursday 21 June 2007 08:59:42 Tom Schrijvers wrote: On Thu, 21 Jun 2007, Pasqualino 'Titto' Assini wrote: Thanks for the explanation. But, doesn't this simply mean that the correct signature would be: serialize :: (Int - Int) - IO String to take in account the fact that

[Haskell-cafe] RE: [darcs-devel] advice on GADT type witnesses needed

2007-06-21 Thread Simon Peyton-Jones
Good idea. I'll improve the message by adding the suggestion to use a case expression instead. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Dagit | Sent: 21 June 2007 00:46 | To: Simon Peyton-Jones | Cc: Ian Lynagh;

[Haskell-cafe] Re: To yi or not to yi, is this really the question? A plea for a cooperative, ubiquitous, distributed integrated development system.

2007-06-21 Thread apfelmus
Tom Schrijvers wrote: On Thu, 21 Jun 2007, Pasqualino 'Titto' Assini wrote: But, doesn't this simply mean that the correct signature would be: serialize :: (Int - Int) - IO String to take in account the fact that serialise really use 'external' information that is not in the domain of pure

Re: [Haskell-cafe] Using Template Haskell to automate QuickCheck testing?

2007-06-21 Thread Marc Weber
However, after reading all about TH it doesn't seem like there's a way to do this (reflecting on the current module to pull out the names of certain top-level declarations). I don't know template haskell very well yet. To do introspection there is the function reify which returns

Re: [Haskell-cafe] Parsec question

2007-06-21 Thread Thomas Conway
On 6/21/07, Dave Tapley [EMAIL PROTECTED] wrote: primary = (identifier = (return . PrimaryIdentifier)) | (stringLiteral = (return . PrimaryLiteral)) identifier = (many1 letter) = (return . Identifier) stringLiteral = (char '\'') (manyTill anyChar (char '\'')) = (return . StringLiteral) I

[Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Andrea Rossato
Hello, I have this very simple program that executes an external program, reads its output and prints it (the program is date). The readings is done with pipes. The problem is that memory usage constantly increases over time. Profiling does not show garbage collection of any sort. File

[Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
In odd spare moments, I took John Harrops simple ray tracer[1] made a Haskell version: http://www.kantaka.co.uk/cgi-bin/darcsweb.cgi?r=ray darcs get http://www.kantaka.co.uk/darcs/ray It's pretty much a straight translation into idiomatic Haskell (as far as my Haskell is idiomatic anyway).

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Dougal Stanton
On 21/06/07, Andrea Rossato [EMAIL PROTECTED] wrote: runComLoop :: String - IO () runComLoop command = do (r,w) - createPipe wh - fdToHandle w hSetBuffering wh LineBuffering p - runProcess command [] Nothing Nothing Nothing (Just wh) (Just wh) rh - fdToHandle r

Re[2]: [Haskell-cafe] Reification in Haskell, was: To yi or not to yi

2007-06-21 Thread Bulat Ziganshin
Hello Pasqualino, Thursday, June 21, 2007, 11:22:19 AM, you wrote: more or less. there are Data and Typeable classes that provides this information but to use them you 1) should use GHC 2) should add deriving Typeable clause to declaration of each type you need to inspect 3) have Typeable a

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 12:25:44PM +0100, Sebastian Sylvan wrote: Try using floats for the vector, and strict fields (add a ! to the fields in the data declaration). Because the optimisation page on the haskell wiki is very explicit about never using Float when you can use Double, that's why.

Re: [Haskell-cafe] Re: Plugin Problem

2007-06-21 Thread Hans van Thiel
On Thu, 2007-06-21 at 01:49 +0200, Daniel Fischer wrote: It half worked in ghci. Only all evals failed. That gave me a lead and after a lot of tinkering with the code of plugins-1.0, I found out one major problem. As of 6.6, ghc calls all interfaces interface main:Modulename and so

[Haskell-cafe] Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Pasqualino 'Titto' Assini
Hi, On Thursday 21 June 2007 09:27:58 Tomasz Zielonka wrote: I think the reasons are mostly insufficient resources and not enough interest to justify the effort. I think an interesting lesson about this comes from the effort that went into Template Haskell (which, BTW, offers some kind of

[Haskell-cafe] Re: Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Tom Schrijvers
On Thu, 21 Jun 2007, Pasqualino 'Titto' Assini wrote: Hi Tom, On Thursday 21 June 2007 08:59:42 Tom Schrijvers wrote: On Thu, 21 Jun 2007, Pasqualino 'Titto' Assini wrote: Thanks for the explanation. But, doesn't this simply mean that the correct signature would be: serialize :: (Int -

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Brandon S. Allbery KF8NH
On Jun 21, 2007, at 6:40 , Andrea Rossato wrote: I have this very simple program that executes an external program, reads its output and prints it (the program is date). The readings is done with pipes. The problem is that memory usage constantly increases over time. Profiling does not show

[Haskell-cafe] Functional Data Structures

2007-06-21 Thread Michael T. Richter
Is there a good book or web site outlining decent pure-lazy-functional data structures, with or without code samples? -- Michael T. Richter [EMAIL PROTECTED] (GoogleTalk: [EMAIL PROTECTED]) I'm not schooled in the science of human factors, but I suspect surprise is not an element of a robust

RTTI in Haskell Re[2]: [Haskell-cafe] To yi or not to yi, is this really the question? A plea for a cooperative, ubiquitous, distributed integrated development system.

2007-06-21 Thread Bulat Ziganshin
Hello Tomasz, Thursday, June 21, 2007, 12:27:58 PM, you wrote: I also find it hard to believe that most languages have reflection, especially those which are traditionally focused on efficiency and compilation to native code, like C, C++, Fortran, Pascal, etc. for OOP languages, it is no

Re[2]: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Bulat Ziganshin
Hello Philip, Thursday, June 21, 2007, 3:36:27 PM, you wrote: revision used Float and it was slower than the current one. Making the datatypes strict also makes no difference. don't forget to use either -funpack-strict-fields or {#- UNPACK -#} pragma -- Best regards, Bulat

Re: [Haskell-cafe] Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Bulat Ziganshin
Hello Pasqualino, Thursday, June 21, 2007, 3:55:35 PM, you wrote: I wonder: would it be possible to use the compile time reflection facilities of TH to write a 'serialise' function, keeping the TH AST so that it can be used at run-time? yes. but you will need to find any functions used in

Re: [Haskell-cafe] Functional Data Structures

2007-06-21 Thread Josef Svenningsson
On 6/21/07, Michael T. Richter [EMAIL PROTECTED] wrote: Is there a good book or web site outlining decent pure-lazy-functional data structures, with or without code samples? Chris Okasaki's publication page is a goldmine when it comes to functional data structures, lazy and otherwise.

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 04:23:37PM +0400, Bulat Ziganshin wrote: Thursday, June 21, 2007, 3:36:27 PM, you wrote: revision used Float and it was slower than the current one. Making the datatypes strict also makes no difference. don't forget to use either -funpack-strict-fields or {#- UNPACK

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Jon Harrop
Awesome stuff! On Thursday 21 June 2007 12:36:27 Philip Armstrong wrote: On Thu, Jun 21, 2007 at 12:25:44PM +0100, Sebastian Sylvan wrote: Try using floats for the vector, and strict fields (add a ! to the fields in the data declaration). Because the optimisation page on the haskell wiki is

[Haskell-cafe] Messing around with types [newbie]

2007-06-21 Thread Cristiano Paris
Hi, I'm making my way through Haskell which seems to me one of the languages with steepest learning curve around. Now, please consider this snippet: {-# OPTIONS_GHC -fglasgow-exts #-} module Main where class FooOp a b where foo :: a - b - IO () instance FooOp Int Double where foo x y =

Re: [Haskell-cafe] Parsec question

2007-06-21 Thread Jules Bean
Thomas Conway wrote: p `with` f = p = (return . f) so I can write primary = (identifier `with` PrimaryIdentifier) | (stringLiteral `with` PrimaryLiteral) I would write primary = PrimaryIdentifier `fmap` identifer | PrimaryLiteral`fmap` stringLiteral (I prefer fmap to liftM but

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Andrea Rossato
On Thu, Jun 21, 2007 at 08:18:23AM -0400, Brandon S. Allbery KF8NH wrote: On Jun 21, 2007, at 6:40 , Andrea Rossato wrote: I have this very simple program that executes an external program, reads its output and prints it (the program is date). The readings is done with pipes. The

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 01:39:24PM +0100, Jon Harrop wrote: Awesome stuff! On Thursday 21 June 2007 12:36:27 Philip Armstrong wrote: On Thu, Jun 21, 2007 at 12:25:44PM +0100, Sebastian Sylvan wrote: Try using floats for the vector, and strict fields (add a ! to the fields in the data

[Haskell-cafe] Re: [darcs-devel] advice on GADT type witnesses needed

2007-06-21 Thread David Roundy
On Thu, Jun 21, 2007 at 10:51:25AM +0100, Simon Peyton-Jones wrote: Good idea. I'll improve the message by adding the suggestion to use a case expression instead. Or do notation. I almost always prefer do notation, even if it means something like: fromJust $ do a' : b' - commute (b : a)

Type classes vs C++ overloading Re: [Haskell-cafe] Messing around with types [newbie]

2007-06-21 Thread Bulat Ziganshin
Hello Cristiano, Thursday, June 21, 2007, 4:46:27 PM, you wrote: class FooOp a b where   foo :: a - b - IO () instance FooOp Int Double where   foo x y = putStrLn $ (show x) ++ Double ++ (show y) this is rather typical question :) unlike C++ which resolves any overloading at COMPILE

Re: [Haskell-cafe] Parsec question

2007-06-21 Thread Tillmann Rendel
Levi Stephen wrote: newtype Identifier = Identifier String newtype Literal = StringLiteral String -- to be extended later data Primary = PrimaryLiteral Literal | PrimaryIdentifier Identifier primary = do { i - identifier; return $ PrimaryIdentifier i; } | do { l -

[Haskell-cafe] Re: Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread apfelmus
Tom Schrijvers wrote: I understand that, depending on what the compiler does the result of : do let f = (*) 2 print $ serialise f might differ as, for example, the compiler might have rewritten f as \n - n+n. But, why would that make equational reasoning on serialise not valid?

Re: [Haskell-cafe] Re: Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Tom Schrijvers
Tom Schrijvers wrote: I understand that, depending on what the compiler does the result of : do let f = (*) 2 print $ serialise f might differ as, for example, the compiler might have rewritten f as \n - n+n. But, why would that make equational reasoning on serialise not valid? Isn't

Re: [Haskell-cafe] Re: Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Neil Davies
Ah - The state of the world serialized into your representation. That would be interesting to see Neil ... ah you meant something different? On 21/06/07, apfelmus [EMAIL PROTECTED] wrote: Tom Schrijvers wrote: I understand that, depending on what the compiler does the result of

[Haskell-cafe] formatTime %Q not working

2007-06-21 Thread Bit Connor
Hello, I am using ghc 6.6. I am using the formatTime function from Data.Time.Format. The docs say that the %Q format string gives: decimal point and up to 12 second decimals, without trailing zeros. But I always just get an empty string. Here is what happens when I try using ghci: now -

RE: [Haskell-cafe] FFI and Excel VBA

2007-06-21 Thread Lewis-Sandy, Darrell
I was able to figure out how to get the example in chapter 11 of the GHC manual to work. Since it was not intuitive (to a non C programmer), I thought that I should post this so that others might take advantage of it. KEYWORDS: Foreign, Export, Win32, DLL, VBA, Excel, GCH, Example The contents

Re: [Haskell-cafe] Re: Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Jon Cast
On Thursday 21 June 2007, Tom Schrijvers wrote: That wouldn't make a difference. If, from the pure Haskell point of view we can't tell the difference between two expressions that denote the same function, then operations in the IO monad should not be able to do so either. This doesn't make

Re: [Haskell-cafe] Messing around with types [newbie]

2007-06-21 Thread Bryan Burgers
On 6/21/07, Cristiano Paris [EMAIL PROTECTED] wrote: Hi, I'm making my way through Haskell which seems to me one of the languages with steepest learning curve around. Now, please consider this snippet: {-# OPTIONS_GHC -fglasgow-exts #-} module Main where class FooOp a b where foo :: a - b

Re: [Haskell-cafe] Re: Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Tom Schrijvers
On Thursday 21 June 2007, Tom Schrijvers wrote: That wouldn't make a difference. If, from the pure Haskell point of view we can't tell the difference between two expressions that denote the same function, then operations in the IO monad should not be able to do so either. This doesn't make

Poor man Haskell serialisation using TH, was: Re: [Haskell-cafe] Haskell serialisation

2007-06-21 Thread Pasqualino 'Titto' Assini
Hi Bulat, I was thinking of something like this (warning: I have never used TH before): {-# OPTIONS -fth #-} module SerialiseTest where import Language.Haskell.TH We have an application whose state is a function Int-Int. We want to be able to serialise this state so that, for example, we

Re: Type classes vs C++ overloading Re: [Haskell-cafe] Messing around with types [newbie]

2007-06-21 Thread Dan Weston
Bulat Ziganshin wrote: Hello Cristiano, Thursday, June 21, 2007, 4:46:27 PM, you wrote: class FooOp a b where foo :: a - b - IO () instance FooOp Int Double where foo x y = putStrLn $ (show x) ++ Double ++ (show y) this is rather typical question :) unlike C++ which resolves any

Re: Poor man Haskell serialisation using TH, was: Re: [Haskell-cafe] Haskell serialisation

2007-06-21 Thread Bulat Ziganshin
Hello Pasqualino, Thursday, June 21, 2007, 7:35:47 PM, you wrote: So, the state is both applicable and serialisable (on the receiving side we should naturally have an interpreter for the TH representation). and this interpreter should have a way to find function definition by its name - it's

Re[2]: Type classes vs C++ overloading Re: [Haskell-cafe] Messing around with types [newbie]

2007-06-21 Thread Bulat Ziganshin
Hello Dan, Thursday, June 21, 2007, 7:39:35 PM, you wrote: class FooOp a b where foo :: a - b - IO () instance FooOp Int Double where foo x y = putStrLn $ (show x) ++ Double ++ (show y) this is rather typical question :) unlike C++ which resolves any overloading at COMPILE

Re: Poor man Haskell serialisation using TH, was: Re: [Haskell-cafe] Haskell serialisation

2007-06-21 Thread Pasqualino 'Titto' Assini
Hi Bulat, the receiving side has the option of either interpreting the TH representation or, as you suggested, to just dynamically compile its Haskell source equivalent (as produced by TH's pprint) using GHC API or hs-plugins. Probably not very efficient but quite easy to implement, Best,

[Haskell-cafe] lazy patterns versus where-clauses

2007-06-21 Thread Peter Padawitz
Is f(~p(x))=e(x) semantically equivalent to: f(z)=e(x) where p(x)=z? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] lazy patterns versus where-clauses

2007-06-21 Thread Stefan O'Rear
On Thu, Jun 21, 2007 at 06:13:22PM +0200, Peter Padawitz wrote: Is f(~p(x))=e(x) semantically equivalent to: f(z)=e(x) where p(x)=z? Yes. PS: I saw that twice Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell] Re: [Haskell-cafe] lazy patterns versus where-clauses

2007-06-21 Thread Stefan O'Rear
On Thu, Jun 21, 2007 at 09:18:02AM -0700, Stefan O'Rear wrote: PS: I saw that twice Oops, failed to notice the cross-post - I thought it was a double post, sorry. In the future smallish questions should usually be directed to -cafe@ - haskell@ is treated as an announce list. Stefan

Re[2]: Poor man Haskell serialisation using TH, was: Re: [Haskell-cafe] Haskell serialisation

2007-06-21 Thread Bulat Ziganshin
Hello Pasqualino, Thursday, June 21, 2007, 8:10:30 PM, you wrote: how it can interpret call to foo without loading it? :) the receiving side has the option of either interpreting the TH representation or, as you suggested, to just dynamically compile its Haskell source equivalent (as

Re: Poor man Haskell serialisation using TH, was: Re: [Haskell-cafe] Haskell serialisation

2007-06-21 Thread Pasqualino 'Titto' Assini
Hi Bulat, On Thursday 21 June 2007 17:29:13 Bulat Ziganshin wrote: how it can interpret call to foo without loading it? :) I am not sure if I understand what you mean. It certainly does load it. Calling hspugins eval (or compiling with GHC API) will cause 'AModule.foo to be loaded and

[Haskell-cafe] Re: Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread apfelmus
Tom Schrijvers wrote: On Thursday 21 June 2007, Tom Schrijvers wrote: That wouldn't make a difference. If, from the pure Haskell point of view we can't tell the difference between two expressions that denote the same function, then operations in the IO monad should not be able to do so

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Bryan O'Sullivan
Andrea Rossato wrote: Now I'm going to profile for memory usage: I've seen that some GC happens if you are patient enough. Yes, the process will hit a steady state of a few megabytes of heap after a short time. By the way, your program leaks ProcessHandles. b

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Derek Elkins
On Thu, 2007-06-21 at 13:39 +0100, Jon Harrop wrote: Awesome stuff! On Thursday 21 June 2007 12:36:27 Philip Armstrong wrote: On Thu, Jun 21, 2007 at 12:25:44PM +0100, Sebastian Sylvan wrote: Try using floats for the vector, and strict fields (add a ! to the fields in the data

Re: [Haskell-cafe] Functional Data Structures

2007-06-21 Thread Derek Elkins
On Thu, 2007-06-21 at 20:21 +0800, Michael T. Richter wrote: Is there a good book or web site outlining decent pure-lazy-functional data structures, with or without code samples? http://www.google.com/search?q=purely+functional+data+structures ___

Re: [Haskell-cafe] FFI and Excel VBA

2007-06-21 Thread Jason Dagit
Darrell, Would you be willing to put your step by step instructions on the wiki? I think having them on the wiki would benefit the largest audience. Thanks! Jason On 6/21/07, Lewis-Sandy, Darrell [EMAIL PROTECTED] wrote: Whoops - I posted the wrong version of the exports list. Compilation

Re[2]: Poor man Haskell serialisation using TH, was: Re: [Haskell-cafe] Haskell serialisation

2007-06-21 Thread Bulat Ziganshin
Hello Pasqualino, Thursday, June 21, 2007, 8:43:20 PM, you wrote: how it can interpret call to foo without loading it? :) What am I missing? i mean that there are no either .. or .. alternatives as you said - we can't interpret AST without function bindings -- Best regards, Bulat

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Mark T.B. Carroll
Philip Armstrong [EMAIL PROTECTED] writes: (snip) Because the optimisation page on the haskell wiki is very explicit about never using Float when you can use Double, that's why. (snip) Is that still true if you use -fexcess-precision ? -- Mark ___

Re: [Haskell-cafe] Messing around with types [newbie]

2007-06-21 Thread Roberto Zunino
Cristiano Paris wrote: class FooOp a b where foo :: a - b - IO () instance FooOp Int Double where foo x y = putStrLn $ (show x) ++ Double ++ (show y) partialFoo = foo (10::Int) bar = partialFoo (5.0::Double) The Haskell type classes system works in an open world assumption: while the

Re: [Haskell-cafe] Re: Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Brandon Michael Moore
On Thu, Jun 21, 2007 at 04:37:20PM +0200, Tom Schrijvers wrote: That wouldn't make a difference. If, from the pure Haskell point of view we can't tell the difference between two expressions that denote the same function, then operations in the IO monad should not be able to do so either.

RE: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread peterv
So float math in *slower* than double math in Haskell? That is interesting. Why is that? BTW, does Haskell support 80-bit long doubles? The Intel CPU seems to use that format internally. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Philip

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 01:29:56PM -0400, Mark T.B. Carroll wrote: Philip Armstrong [EMAIL PROTECTED] writes: (snip) Because the optimisation page on the haskell wiki is very explicit about never using Float when you can use Double, that's why. (snip) Is that still true if you use

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Philip Armstrong
On Thu, Jun 21, 2007 at 08:15:36PM +0200, peterv wrote: So float math in *slower* than double math in Haskell? That is interesting. Why is that? BTW, does Haskell support 80-bit long doubles? The Intel CPU seems to use that format internally. As I understand things, that is the effect of

[Haskell-cafe] Odd lack of laziness

2007-06-21 Thread Jefferson Heard
Alright, I've been hacking away at what I posted the other day, and I have something that works for files that will fit entirely into memory. And then I figured out why I've been restricted to files that fit entirely into memory... One of my functions is causing the entire thing to be read in,

Re: [Haskell-cafe] Odd lack of laziness

2007-06-21 Thread Chris Kuklewicz
The (BS.length f) can only be computed by reading until the end of the file! breakIntoDocuments :: RawDocument - [RawDocument] breakIntoDocuments f | BS.length f 0 = if len 0 then (BS.take bytes f) :

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Mark T.B. Carroll
Philip Armstrong [EMAIL PROTECTED] writes: (snip) Why on earth would you use -fexcess-precision if you're using Floats? The excess precision only apples to Doubles held in registers on x86 IIRC. (If you spill a Double from a register to memory, then you lose the extra precision bits in the

Re: [Haskell-cafe] lazy patterns versus where-clauses

2007-06-21 Thread David House
Peter Padawitz writes: Is f(~p(x))=e(x) semantically equivalent to: f(z)=e(x) where p(x)=z? Yep. See also http://en.wikibooks.org/wiki/Haskell/Laziness#Lazy_pattern_matching regarding lazy patterns. -- -David House, [EMAIL PROTECTED] ___

Re: [Haskell-cafe] Collections

2007-06-21 Thread Andrew Coppin
Tillmann Rendel wrote: Andrew Coppin wrote: [...] type (a,b) [...] That's a rather special type; I haven't seen anything remotely like it in any other language. This type isn't that special in Haskell (apart from being syntax-sugared), it could be defined as data Pair a b = Pair a b

Re: [Haskell-cafe] Collections

2007-06-21 Thread Brent Yorgey
public class PairA, B { public A fst; public B snd; public Pair(A fst, B snd) { this.fst = fst; this.snd = snd; } } OK, I don't even understand that syntax. Have they changed the Java language spec or something? Yes. As of version 5 (or 1.5, or whatever you want to

Re: [Haskell-cafe] Collections

2007-06-21 Thread Andrew Coppin
Brent Yorgey wrote: OK, I don't even understand that syntax. Have they changed the Java language spec or something? Yes. As of version 5 (or 1.5, or whatever you want to call it), Java has parametric polymorphism. Do a Google search for Java generics. OMG - they actually added

[Haskell-cafe] Telling the time

2007-06-21 Thread Andrew Coppin
Greetings. Is there a standard library function anywhere which will parse a string into some kind of date/time representation? And, further, is there some function that will tell me how many seconds elapsed between two such times? (I see there's a giant pile of modules to do with dates and

[Haskell-cafe] Filesystem access

2007-06-21 Thread Andrew Coppin
OK, a few questions... 1. Is there *any* way to determine how large a file is *without* opening it? The only library function I can find to do with file sizes is hFileSize; obviously this only works for files that you have permission to open! 2. Is there any way to discover Windoze-style

Re: [Haskell-cafe] Filesystem access

2007-06-21 Thread Andrea Rossato
On Thu, Jun 21, 2007 at 09:19:51PM +0100, Andrew Coppin wrote: OK, a few questions... 1. Is there *any* way to determine how large a file is *without* opening it? The only library function I can find to do with file sizes is hFileSize; obviously this only works for files that you have

Re: [Haskell-cafe] Filesystem access

2007-06-21 Thread Andrew Coppin
Andrea Rossato wrote: On Thu, Jun 21, 2007 at 09:19:51PM +0100, Andrew Coppin wrote: OK, a few questions... 1. Is there *any* way to determine how large a file is *without* opening it? The only library function I can find to do with file sizes is hFileSize; obviously this only works

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Bryan O'Sullivan
Andrea Rossato wrote: Still I do not understand you reference to the leak problem. Could you please elaborate a bit? The runProcess function returns a ProcessHandle. If you don't call waitForProcess on that handle, you'll leak those handles. On Unix-like systems, this means you'll

Re: [Haskell-cafe] Filesystem access

2007-06-21 Thread Andrea Rossato
On Thu, Jun 21, 2007 at 09:38:49PM +0100, Andrew Coppin wrote: Andrea Rossato wrote: On Thu, Jun 21, 2007 at 09:19:51PM +0100, Andrew Coppin wrote: 2. Is there any way to discover Windoze-style attributes for files? The module before, if I understand correctlu. No, AFAIK the

Re: [Haskell-cafe] Collections

2007-06-21 Thread Calvin Smith
Andrew Coppin wrote: Dan Piponi wrote: On 6/20/07, Andrew Coppin [EMAIL PROTECTED] wrote: Yes... graph and network are virtually synonymous. I'm still wondering what you'd use a network for in a computer program. Writing a Haskell compiler. True enough - but that's a rather specific task.

Re: [Haskell-cafe] memory usage in repeated reading of an external program's output

2007-06-21 Thread Andrea Rossato
On Thu, Jun 21, 2007 at 01:36:16PM -0700, Bryan O'Sullivan wrote: Andrea Rossato wrote: Still I do not understand you reference to the leak problem. Could you please elaborate a bit? The runProcess function returns a ProcessHandle. If you don't call waitForProcess on that handle,

Re: [Haskell-cafe] Telling the time

2007-06-21 Thread Rich Neswold
On 6/21/07, Andrew Coppin [EMAIL PROTECTED] wrote: Is there a standard library function anywhere which will parse a string into some kind of date/time representation? In Data.Time.Format, there's parseTime. parseTime takes a format string that describes the layout. Since you have varying

Re: [Haskell-cafe] Filesystem access

2007-06-21 Thread Fraser Wilson
I don't use Haskell on Windows, but if you go to http://www.haskell.org/ghc/docs/latest/html/libraries/index.html you'll find a package called System.Win32.File, which has these functions: *getFileAttributes* ::

Re: [Haskell-cafe] Collections

2007-06-21 Thread Tillmann Rendel
Andrew Coppin wrote: I don't even understand that... :-S Ok, I'll try to explain it: I represent sets by their characteristic function, wich returns True for members of the set, and False for other values. type Set a = a - Bool For example, the set of numbers containing only 42 is

Re: [Haskell-cafe] Telling the time

2007-06-21 Thread Marc Weber
On Thu, Jun 21, 2007 at 09:15:12PM +0100, Andrew Coppin wrote: Greetings. Is there a standard library function anywhere which will parse a string into some kind of date/time representation? And, further, is there some function that will tell me how many seconds elapsed between two such

Re: [Haskell-cafe] Odd lack of laziness

2007-06-21 Thread Chaddaï Fouché
You should be using BS.null f rather than BS.length f 0. -- Jedaï ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Orthogonal Persistence in Haskell

2007-06-21 Thread Claus Reinke
with orthogonal persistence, everything a program touches might persist, but usually, programs talk about the data being persistet (?), not about whether that data is currently temporary or in long-term storage. if you want to move such data between processes or storage areas, you move the

Re: [Haskell-cafe] Re: Collections

2007-06-21 Thread Thomas Conway
On 6/20/07, apfelmus [EMAIL PROTECTED] wrote: Eh, why not a simple mergesort that also deletes duplicates? I had to sit down and think about this, and while for the simple case that I showed, your equivalent code is definitely simpler, and probably more efficient. The actual case that I'm

Re: [Haskell-cafe] Parsec question

2007-06-21 Thread Levi Stephen
Tillmann Rendel wrote: My self-defined monadic combinator of choice to use with parsec is a ~ b = a = \x - b return x It works like (), but returns the result of the first instead of the result of the second computation. It is kind of an alternative for between: between lparen rparen

Re: [Haskell-cafe] Filesystem access

2007-06-21 Thread Esa Ilari Vuokko
On 6/21/07, Andrew Coppin [EMAIL PROTECTED] wrote: OK, a few questions... 1. Is there *any* way to determine how large a file is *without* opening it? The only library function I can find to do with file sizes is hFileSize; obviously this only works for files that you have permission to open!

Re: Re[2]: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-21 Thread Duncan Coutts
On Thu, 2007-06-21 at 08:14 +0400, Bulat Ziganshin wrote: Hello Duncan, Thursday, June 21, 2007, 7:36:13 AM, you wrote: The smallest possible would be 2 words overhead by just using a ByteArray#, i tried it once and found that ByteArray# size is returned rounded to 4 - there is no

Re: [Haskell-cafe] Re: Collections

2007-06-21 Thread Duncan Coutts
On Fri, 2007-06-22 at 09:38 +1000, Thomas Conway wrote: The actual case that I'm dealing with, where I believe Data.Map (or similar, incl finger trees) has a benefit is one in which it's not simply a case of lists of items, yielding a list of items. I'm manipulating an on-disk inverted index,

[Haskell-cafe] WMI via Haskell?

2007-06-21 Thread Dean Herington
Has anyone built a library providing an interface to WMI (Windows Management Instrumentation) in Haskell? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

  1   2   >