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

2007-06-21 Thread Bulat Ziganshin
Hello Duncan, Thursday, June 21, 2007, 8:48:53 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 way in GHC runtime to alloc, say, exactly 37 bytes. a

Re: [Haskell-cafe] Filesystem access

2007-06-21 Thread Bulat Ziganshin
Hello Andrew, Friday, June 22, 2007, 12:19:51 AM, you wrote: > 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! std lib

Re: [Haskell-cafe] Re: Collections

2007-06-21 Thread Thomas Conway
On 6/22/07, Duncan Coutts <[EMAIL PROTECTED]> wrote: You might find that lazy IO is helpful in this case. The primitive that implements lazy IO is unsafeInterleaveIO :: IO a -> IO a Personally, unsafeInterleaveIO is so horribly evil, that even just having typed the name, I'll have to put the ke

[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

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 ind

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 - > ther

Re: [Haskell-cafe] Plugin Problem - Weirder

2007-06-21 Thread Donald Bruce Stewart
daniel.is.fischer: > Am Donnerstag, 21. Juni 2007 10:22 schrieb 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 > >

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: [Haskell-cafe] Odd lack of laziness

2007-06-21 Thread Donald Bruce Stewart
jeff: > 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

Re: [Haskell-cafe] Parsec question

2007-06-21 Thread Levi Stephen
Dave Tapley wrote: 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 nic

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 lpare

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 de

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 referen

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] Parsec question

2007-06-21 Thread Thomas Conway
On 6/21/07, Jules Bean <[EMAIL PROTECTED]> wrote: I would write primary = PrimaryIdentifier `fmap` identifer <|> PrimaryLiteral`fmap` stringLiteral (I prefer fmap to liftM but they are the same for monads). To my mind this fits the general pattern of 'constructor comes before content

RE: [Haskell-cafe] Template Haskell, information about data constructor types

2007-06-21 Thread Simon Peyton-Jones
Sorry to be slow. Instead of | Language.Haskell.TH> $( reify (mkName "Maybe") >>= error . show ) say | Language.Haskell.TH> $( reify ''Maybe >>= error . show ) Which works fine. The notation ''Maybe means "the type constructor Maybe that's in scope". When you use mkName, TH builds a Language

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] 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 repre

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* :: String

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 la

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 h

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

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. > > > >

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 accumula

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 fo

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 h

[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 "at

[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 ti

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

Re: [Haskell-cafe] Collections

2007-06-21 Thread Brent Yorgey
> public class Pair { > 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
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 T

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 03:29:17PM -0400, Mark T.B. Carroll wrote: 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 re

Re: [Haskell-cafe] Collections

2007-06-21 Thread Andrew Coppin
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. I'm still not se

Re: [Haskell-cafe] Collections

2007-06-21 Thread Andrew Coppin
Thomas Conway wrote: On 6/21/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: Lennart Augustsson wrote: > I don't think the collection type (a,b) is best thought of as a loop. True. That's a rather special type; I haven't seen anything remotely like it in any other language. Is it that special? H

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] ___ Haskell-Ca

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 th

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) : (bre

[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, whe

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 09:44:43AM -0700, Bryan O'Sullivan wrote: > 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. > > http://www.haskell.org/mailman/listinfo/haskell-cafe

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 double"s? The Intel CPU seems to use that format internally. As I understand things, that is the effect of

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 -fexcess-p

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 double"s? The Intel CPU seems to use that format internally. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Philip Armstro

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] 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

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[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] 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: [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 ___ H

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] 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. http://www.haskell.org/m

[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

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 an

Re: [Haskell-cafe] Plugin Problem - Weirder

2007-06-21 Thread Daniel Fischer
Am Donnerstag, 21. Juni 2007 10:22 schrieb 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 a

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 pr

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: [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 http://www.haskell.org/mailma

[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: 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,

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 >> ove

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: 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 an

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: [Haskell-cafe] FFI and Excel VBA

2007-06-21 Thread Lewis-Sandy, Darrell
Whoops - I posted the wrong version of the exports list. Compilation with that adder.def will fail (since it the Haskell code doesn't export either suber or hello). Below is the revised example: KEYWORDS: Foreign, Export, Win32, DLL, VBA, Excel, GCH, Example The contents of adder.hs are as foll

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 an

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 ->

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] 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 o

[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 <- ge

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 resul

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

[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

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 <- s

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 C

[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

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 declarat

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.

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 b

[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 = pu

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 w

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] 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. http

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[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

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 p

[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 us

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] 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 -> Int

[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

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 p

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. A

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] 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 <- fdToHan

[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).

[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 descrip

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 . St

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

[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

[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@haske

[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 accou

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 offe

  1   2   >