Re: [Haskell-cafe] Storable class?

2008-04-23 Thread Magnus Therning
Galchin, Vasili wrote: Hello, Examples of instances of the Storable class please. I believe this is linked from the Haskell Wiki: http://therning.org/magnus/archives/315 There are a few comments on the alignment as well. /M -- Magnus Therning (OpenPGP:

[Haskell-cafe] Re: Laziness and Either

2008-04-23 Thread apfelmus
John Goerzen wrote: On Mon April 21 2008 3:26:04 pm Magnus Therning wrote: In order to allow lazy decoding I ended up exporting decode' as well: decode' :: String - [Maybe Word8] I take it that in a situation like this, you'd have either: [] -- success with empty result a list full of

Re: [Haskell-cafe] Re: Laziness and Either

2008-04-23 Thread David Roundy
On Wed, Apr 23, 2008 at 01:12:16PM +0200, apfelmus wrote: I think that using [Maybe a] for this purpose is too fine-grained, I would use a custom list type data River a = a : (River a) | Done | Error (I didn't want to call it Stream because that name is too overloaded already and

[Haskell-cafe] Re: [Haskell] ANNOUNCE: Generic Haskell 1.80 (Emerald)

2008-04-23 Thread Adrian Hey
Thomas van Noort wrote: As you already noticed, there is no Windows binary available for the Emerald release. However, there is one for the Coral release, available from: http://www.generic-haskell.org Although this is an old release of Generic Haskell, this release already supports generic

Re: [Haskell-cafe] Processing XML with HXT

2008-04-23 Thread rodrigo.bonifacio
Hi Uwe Schmidt, thanks a lot. Just one more question, I didn't find any example describing how to get the text information of a XML element in the picklers tutorial. So, if the use case element is described as follwing: useCase idUC_01/id nameOpening .../name descriptionThis use case

RE: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Tim Harris (RESEARCH)
Hi, I think this could be a nice addition. What do you think about a slight change: readTVarWhen :: TVar a - (a - bool) - STM a This would retry until the (a-bool) function returns true (and, of course, as with a normal retry, the implementation would need to watch all of the TVars that

Re: [Haskell-cafe] Laziness and Either

2008-04-23 Thread David Menendez
On Mon, Apr 21, 2008 at 2:18 PM, John Goerzen [EMAIL PROTECTED] wrote: Back when I was working on the logic for the bin-packing solver that I added to MissingH (for use with datapacker), I had a design decision to make: do I raise runtime errors with the input using error, or do I use an

[Haskell-cafe] Re: Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Chris Smith
On Wed, 23 Apr 2008 15:54:15 +0100, Tim Harris (RESEARCH) wrote: What do you think about a slight change: readTVarWhen :: TVar a - (a - bool) - STM a This would retry until the (a-bool) function returns true (and, of course, as with a normal retry, the implementation would need to watch

Re: [Haskell-cafe] ANNOUNCE: Galois web libraries for Haskell released

2008-04-23 Thread David Menendez
On Tue, Apr 22, 2008 at 11:57 AM, Aaron Tomb [EMAIL PROTECTED] wrote: On Apr 22, 2008, at 6:20 AM, John Goerzen wrote: * xml A simple, lightweight XML parser/generator. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xml Can you describe how this

Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: Generic Haskell 1.80 (Emerald)

2008-04-23 Thread Alexey Rodriguez
On Wed, Apr 23, 2008 at 3:40 PM, Adrian Hey [EMAIL PROTECTED] wrote: Thomas van Noort wrote: As you already noticed, there is no Windows binary available for the Emerald release. However, there is one for the Coral release, available from: http://www.generic-haskell.org Although

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Ryan Ingram
On Wed, Apr 23, 2008 at 7:54 AM, Tim Harris (RESEARCH) [EMAIL PROTECTED] wrote: What do you think about a slight change: readTVarWhen :: TVar a - (a - bool) - STM a This seems strictly less powerful than retryUntil: readTVarWhen v p = retryUntil v p readTVar v Consider the following

[Haskell-cafe] Re: [Haskell] Matrix multiplication

2008-04-23 Thread Sebastian Sylvan
On Wed, Apr 23, 2008 at 5:01 PM, Tillmann Vogt [EMAIL PROTECTED] wrote: Hi, I am currently experimenting with parallelizing C-programs. I have therefore written a matrix vector multiplication example that needs 13 seconds to run (5 seconds with OpenMP). Because I like Haskell I did the same

Re: [Haskell-cafe] announce: Glome.hs-0.3 (Haskell raytracer)

2008-04-23 Thread Derek Elkins
On Fri, 2008-04-18 at 14:34 -0700, David Roundy wrote: On Fri, Apr 18, 2008 at 02:09:28PM -0700, Jim Snow wrote: On a particular scene with one instance of the single-threaded renderer running, it takes about 19 seconds to render an image. With two instances running, they each take about

[Haskell-cafe] Re: [darcs-devel] announcing franchise 0.0

2008-04-23 Thread Marc Weber
On Fri, Apr 18, 2008 at 08:37:06AM -0700, David Roundy wrote: I'm pleased to announce the existence (not release, properly) of franchise, a new configuration/build system for Haskell programs and packages. Hi David! I like this idea.. ( I had it myself in another context : Generating nix

Re: [Haskell-cafe] Processing XML with HXT

2008-04-23 Thread Uwe Schmidt
Hi Rodrigo, Just one more question, I didn't find any example describing how to get the text information of a XML element in the picklers tutorial. So, if the use case element is described as follwing: ... here is a complete example for your use case. Take the following XML data in file

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Jan-Willem Maessen
On Apr 23, 2008, at 12:13 PM, Ryan Ingram wrote: On Wed, Apr 23, 2008 at 7:54 AM, Tim Harris (RESEARCH) [EMAIL PROTECTED] wrote: What do you think about a slight change: readTVarWhen :: TVar a - (a - bool) - STM a This seems strictly less powerful than retryUntil: readTVarWhen v p =

Re: [Haskell-cafe] ANNOUNCE: Galois web libraries for Haskell released

2008-04-23 Thread Don Stewart
dave: On Tue, Apr 22, 2008 at 11:57 AM, Aaron Tomb [EMAIL PROTECTED] wrote: On Apr 22, 2008, at 6:20 AM, John Goerzen wrote: * xml A simple, lightweight XML parser/generator. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xml Can you

[Haskell-cafe] Re: Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread apfelmus
Ryan Ingram wrote: Consider the following transaction: intV :: TVar Int boolV :: TVar Bool interesting = atomically $ do retryUntil intV ( 50) retryUntil boolV id Lets say that intV contains 100 and boolV contains False. Then this transaction retries. Now, if intV changes to 101,

[Haskell-cafe] Cabalizing darcs

2008-04-23 Thread Gwern Branwen
So recently I spent a bit of time working on a cabalization of Darcs. It works well for me, and is reasonably easy to apply (attached are three files; do a 'darcs get --lazy http://darcs.net' with Darcs-2 to get the latest, and copy the files into it, the usual autoconf, and it should then work

Re: [Haskell-cafe] Re: [Haskell] Matrix multiplication

2008-04-23 Thread David Roundy
On Wed, Apr 23, 2008 at 05:24:20PM +0100, Sebastian Sylvan wrote: On Wed, Apr 23, 2008 at 5:01 PM, Tillmann Vogt [EMAIL PROTECTED] wrote: Hi, I am currently experimenting with parallelizing C-programs. I have therefore written a matrix vector multiplication example that needs 13

[Haskell-cafe] Re: [darcs-devel] announcing franchise 0.0

2008-04-23 Thread David Roundy
On Wed, Apr 23, 2008 at 06:43:42PM +0200, Marc Weber wrote: On Fri, Apr 18, 2008 at 08:37:06AM -0700, David Roundy wrote: I'm pleased to announce the existence (not release, properly) of franchise, a new configuration/build system for Haskell programs and packages. Hi David! I like this

Re: [Haskell-cafe] Re: Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Ryan Ingram
On 4/23/08, apfelmus [EMAIL PROTECTED] wrote: I don't quite understand what you want to do but I presume it's related to the following: given an expression like readTVar intV = (\ - ... readTVar boolV = (\_ - ... retry)) The ... indicate branches that are there have not been taken in our

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Ryan Ingram
On 4/23/08, Jan-Willem Maessen [EMAIL PROTECTED] wrote: I've been trying to decide whether either of these is implementable in terms of `orElse`, in such a way that we immediately check the predicate upon retry before doing anything else. I can't quite make up my mind whether this is

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread David Roundy
On Wed, Apr 23, 2008 at 12:12:15PM -0700, Ryan Ingram wrote: On 4/23/08, Jan-Willem Maessen [EMAIL PROTECTED] wrote: I've been trying to decide whether either of these is implementable in terms of `orElse`, in such a way that we immediately check the predicate upon retry before doing

Re: [Haskell-cafe] Cabalizing darcs

2008-04-23 Thread Philip Weaver
It looks quite clean (no funny business in Setup.lhs). I would favor using this cabalized version over the other. Thanks! So, autoconf/configure generate cryptol.buildinfo from cryptol.buildinfo.in. Did you change configure.ac much? And the Makefile is no longer needed at all, right? - Phil

Re: [Haskell-cafe] Cabalizing darcs

2008-04-23 Thread David Roundy
On Wed, Apr 23, 2008 at 02:55:49PM -0400, Gwern Branwen wrote: So recently I spent a bit of time working on a cabalization of Darcs. It works well for me, and is reasonably easy to apply (attached are three files; do a 'darcs get --lazy http://darcs.net' with Darcs-2 to get the latest, and

[Haskell-cafe] PLMMS - Last call for papers

2008-04-23 Thread Jacques Carette
LAST CALL FOR PAPERS Second Workshop on Programming Languages for Mechanized Mathematics (PLMMS 2008) http://events.cs.bham.ac.uk/cicm08/workshops/plmms/ As part of

Re: [Haskell-cafe] Re: [Haskell] Matrix multiplication

2008-04-23 Thread Henning Thielemann
On Wed, 23 Apr 2008, Sebastian Sylvan wrote: On Wed, Apr 23, 2008 at 5:01 PM, Tillmann Vogt [EMAIL PROTECTED] wrote: I am currently experimenting with parallelizing C-programs. I have therefore written a matrix vector multiplication example that needs 13 seconds to run (5 seconds with

[Haskell-cafe] zipper for rose trees? (Data.Tree)

2008-04-23 Thread Graham Fawcett
Hi folks, Is there a common zipper implementation for the Tree a datatype, defined in Data.Tree? The wiki gives examples for binary trees and B-trees, but not for these. Thanks, Graham ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] lookup tables style guidelines

2008-04-23 Thread Cetin Sert
Dear Haskell Devs ^_^, 1) what is the most performant lookup table/hashtable/dictionary solution for Haskell? 1.1) should I use size-balanced binary trees for that or is there a more common way? 2) are there any established style guidelines for haskell code? Best Regards, Cetin Sert

Re: [Haskell-cafe] lookup tables style guidelines

2008-04-23 Thread Don Stewart
cetin.sert: Dear Haskell Devs ^_^, 1) what is the most performant lookup table/hashtable/dictionary solution for Haskell? Data.IntMap is awfully good. 1.1) should I use size-balanced binary trees for that or is there a more common way? I would. Data.Map/Data.IntMap 2)

Re: [Haskell-cafe] zipper for rose trees? (Data.Tree)

2008-04-23 Thread Krasimir Angelov
Hi Graham, There is one implementation here: http://code.haskell.org/yi/Data/Tree/ I wrote it for Yi but it is quite general. It is a pity that we don't have it in the standard libraries. It is not completely tested but it seems to work for me. Regards, Krasimir 2008/4/23 Graham Fawcett

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Ryan Ingram
On 4/23/08, David Roundy [EMAIL PROTECTED] wrote: I'm confused as to how your retryUntil gains you anything. If any of the TVars used in the expensive_computation change while waiting for a retry, then the expensive_computation will need to be done again. If none of them change, then we can

Re: [Haskell-cafe] lookup tables style guidelines

2008-04-23 Thread Cetin Sert
Thanks Don... You are amazing... o_O always so quick with replies... I was using GraphViz to generate some directed graphs*, knowing what to use for a dict/map will help speed things up! Cetin * (for analytic tableaux in Okitsune+) + (need a better name, maybe I should ask Haskell-Cafe for one in

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread David Roundy
On Wed, Apr 23, 2008 at 01:46:53PM -0700, Ryan Ingram wrote: On 4/23/08, David Roundy [EMAIL PROTECTED] wrote: I'm confused as to how your retryUntil gains you anything. If any of the TVars used in the expensive_computation change while waiting for a retry, then the expensive_computation

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Sterling Clover
-- non-primitive retryUntil: retryUntil v p = do x - readVar v unless (p x) retry broken2 = atomically $ do (v1, v2) - expensive_computation :: STM (TVar Int, TVar Int) retryUntil v1 ( 50) x - expensive_computation2 :: STM Int retryUntil v2 ( x) If v1 succeeds and v2 fails,

Re: [Haskell-cafe] zipper for rose trees? (Data.Tree)

2008-04-23 Thread Graham Fawcett
On Wed, Apr 23, 2008 at 4:40 PM, Krasimir Angelov [EMAIL PROTECTED] wrote: Hi Graham, There is one implementation here: http://code.haskell.org/yi/Data/Tree/ I wrote it for Yi but it is quite general. It is a pity that we don't have it in the standard libraries. It is not completely

[Haskell-cafe] Re: compressed pointers?

2008-04-23 Thread Simon Marlow
Bulat Ziganshin wrote: Hello Ketil, Friday, April 18, 2008, 10:44:53 AM, you wrote: This probably becomes too complicated, but I thought it was interesting that the Java people are making use of 32bit pointers on a 64bit system, and are seeing a good performance benefit from it. afaik, C

Re: [Haskell-cafe] Hackage being too strict?

2008-04-23 Thread Duncan Coutts
Just to keep haskell-cafe updated on this issue... On Tue, 2008-04-15 at 22:15 -0500, John Goerzen wrote: When I went to make my upload of MissingH 1.0.1, Hackage rejected it, saying: Instead of 'ghc-options: -XPatternSignatures' use 'extensions: PatternSignatures' Now fixed! (Well, at

[Haskell-cafe] Re: announce: Glome.hs-0.3 (Haskell raytracer)

2008-04-23 Thread Simon Marlow
Bryan O'Sullivan wrote: Jim Snow wrote: The concurrency bug has to do with excessive memory use, and was discussed earlier here on the mailing list (search for Glome). http://hackage.haskell.org/trac/ghc/ticket/2185 Interesting. I looked at your test case. I can reproduce your problem when

[Haskell-cafe] Re: [Haskell] How to define tail function for Even/Odd GADT lists?

2008-04-23 Thread David Roundy
2008/4/23 Martijn Schrage [EMAIL PROTECTED]: It depends a bit on what you want to use these lists for, but the following encoding works for your examples and doesn't need the type class. data E data O type Even = (E,O) type Odd = (O,E) That's a nice little trick! I like how you

Re: [Haskell-cafe] Cabalizing darcs

2008-04-23 Thread Gwern Branwen
On 2008.04.23 12:26:35 -0700, Philip Weaver [EMAIL PROTECTED] scribbled 1.2K characters: It looks quite clean (no funny business in Setup.lhs). I would favor using this cabalized version over the other. Thanks! So, autoconf/configure generate cryptol.buildinfo from cryptol.buildinfo.in.

Re: [Haskell-cafe] Re: [Haskell] How to define tail function for Even/Odd GADT lists?

2008-04-23 Thread Iavor Diatchki
Hello, I am not sure of the use case here but you could also do the following: data EvenList a = Nil | ConsE a (OddList a) data OddList a = ConsO a (EvenList a) This does not use any type system extensions. -Iavor On Wed, Apr 23, 2008 at 4:46 PM, David Roundy [EMAIL

Re: [Haskell-cafe] Re: [Haskell] How to define tail function for Even/Odd GADT lists?

2008-04-23 Thread David Roundy
I presume the point was to allow the writing of functions that accept either list type, such as sort :: List a evenorodd - List a evenorodd or similar. David On Wed, Apr 23, 2008 at 7:55 PM, Iavor DiIatchki [EMAIL PROTECTED] wrote: Hello, I am not sure of the use case here but you could

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Ryan Ingram
On 4/23/08, Sterling Clover [EMAIL PROTECTED] wrote: But expensive_computation2 is in STM. This means that it *should* be rerun, no? Between the first run and the retry, the result of expensive_computation2 may well have changed. Ah, but that's not true; the main good thing about retry is that

Re: [Haskell-cafe] Cabalizing darcs

2008-04-23 Thread Philip Weaver
On Wed, Apr 23, 2008 at 4:49 PM, Gwern Branwen [EMAIL PROTECTED] wrote: On 2008.04.23 12:26:35 -0700, Philip Weaver [EMAIL PROTECTED] scribbled 1.2K characters: It looks quite clean (no funny business in Setup.lhs). I would favor using this cabalized version over the other. Thanks!

Re: [Haskell-cafe] announce: Glome.hs-0.3 (Haskell raytracer)

2008-04-23 Thread Jim Snow
Derek Elkins wrote: Ingo Wald's work on interactive coherent raytracing springs to mind. http://www.sci.utah.edu/~wald/Publications/ Interactive Rendering with Coherent Raytracing http://graphics.cs.uni-sb.de/~wald/Publications/EG2001_IRCRT/InteractiveRenderingWithCoherentRayTracing.pdf is a

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Matthew Brecknell
Ryan Ingram said: So, if have a transaction T that is waiting inside retry for a variable that it read to change, and a variable that is only accessed in a subatomic part of T is changed, we can try running the subatomic computation first. Here are the four cases: 1) The subatomic

Re: [Haskell-cafe] Stronger STM primitives needed? Or am I just doing it wrong?

2008-04-23 Thread Matthew Brecknell
I said: In that case, we can treat subatomic as a hint to the STM runtime. It could have a simpler type, and the semantics of id: subatomic :: STM a - STM a If the subatomic transaction turns out to be read-only, then we get the benefit of all four cases Ryan describes above. If it turns

[Haskell-cafe] searching via zipper over a tree

2008-04-23 Thread Graham Fawcett
Hi folks, I'm studying zippers (and by extension, the State monad), and have written a function for finding the first node-location in a 'zippered' tree that satisfies a predicate: http://paste.lisp.org/display/59636 (The code uses Krasimir Angelov's Data.Tree.Zipper.) My code works, but I