[Haskell-cafe] ANNOUNCE: Haskell XML Toolbox Version 8.0.0

2008-04-28 Thread Uwe Schmidt
Haskell XML Toolbox 8.0.0 I would like to announce a new version of the Haskell XML Toolbox. The main change is the separation of the old filter interface into a separate package hxt-filter. This makes the API simpler and more readable. The filter API will not be developed further. But all the

Re: [Haskell-cafe] approximating pi

2008-04-28 Thread jerzy . karczmarczuk
Benjamin L. Russell: Assuming the square had 100 pixels per side, on the average, approximately how many random pixels should be plotted in the square before obtaining a reasonably good estimate of pi? Nothing to do with Haskell... What do you mean by reasonable? This Monte-Carlo

[Haskell-cafe] Haskell as a general purpose programming language...

2008-04-28 Thread Martin Grabmueller
Hi all, just a thought: is it just me, or is Haskell really really really the coolest general-purpose programming language? If I had the time, I would love to do a re-implementation of Harpy [1] using category-extras [2]. Martin [1]

Re: [Haskell-cafe] Haskell as a general purpose programming language...

2008-04-28 Thread Bulat Ziganshin
Hello Martin, Monday, April 28, 2008, 3:51:11 PM, you wrote: just a thought: is it just me, or is Haskell really really really the coolest general-purpose programming language? the only Haskell drawback is that it forces you to hate all other programming languages (c) people :) -- Best

[Haskell-cafe] FFI Query: How to free a CString allocated in Haskell

2008-04-28 Thread Verma Anurag-VNF673
Hi, I am calling a Haskell function from my C code, wherein I export a Haskell function xyz that takes as an argument string and returns a string: Foreign export ccall xyz::CString - IO CString xyz = do -- extract the input string and act on it-- -- at the end I return a string

Re: [Haskell-cafe] FFI Query: How to free a CString allocated in Haskell

2008-04-28 Thread Bulat Ziganshin
Hello Verma, Monday, April 28, 2008, 4:11:51 PM, you wrote: newCString str Now once I call this function from C code, I am freeing the allocated memory using free function. I want to confirm that this is the right thing to do. yes, i've traced this function down to mallocArray -

Re: [Haskell-cafe] question about GHC and Unicode

2008-04-28 Thread John Goerzen
On Sun April 27 2008 2:02:25 pm Don Stewart wrote: zefria: In GHC there's a GHC.Unicode library, but for a string such as *AIOO, a GHC compiled program prints it as a string of unknown characters, and in the interpreter, the string evaluates to a string of escape sequences instead of

Re: [Haskell-cafe] [help] Program immplementing an alarm

2008-04-28 Thread Yitzchak Gale
Antonio Regidor García wrote: I'm trying to implement an alarm in Haskell and wrote the following code: http://hpaste.org/7201 But it doesn't work as expected. Hi, The getLine function ties up stdin. So the system function isn't able to proceed until getLine completes, even when it is in

[Haskell-cafe] maintainer of StorableVector

2008-04-28 Thread Henning Thielemann
I sent some patches to the maintainer of StorableVector, Spencer Janssen http://code.haskell.org/~sjanssen/storablevector but did not get some feedback and the patches are still not applied. Any idea what might went wrong? ___ Haskell-Cafe mailing

Re: [Haskell-cafe] approximating pi

2008-04-28 Thread David Roundy
On Mon, Apr 28, 2008 at 09:47:44AM +0200, [EMAIL PROTECTED] wrote: Benjamin L. Russell: Assuming the square had 100 pixels per side, on the average, approximately how many random pixels should be plotted in the square before obtaining a reasonably good estimate of pi? Nothing to do

[Haskell-cafe] Re: Caching the Result of a Transaction?

2008-04-28 Thread ChrisK
The garbage collector never gets to collect either the action used to populate the cached value, or the private TMVar used to hold the cached value. A better type for TIVal is given below. It is a newtype of a TVal. The contents are either a delayed computation or the previously forced

Re: [Haskell-cafe] maintainer of StorableVector

2008-04-28 Thread Don Stewart
lemming: I sent some patches to the maintainer of StorableVector, Spencer Janssen http://code.haskell.org/~sjanssen/storablevector but did not get some feedback and the patches are still not applied. Any idea what might went wrong? I think its just unmaintained. -- Don

[Haskell-cafe] CPU simulation library?

2008-04-28 Thread Justin Bailey
I want to simulate various process/thread scheduling algorithms for a small project. I'm trying to compare the performance versus power consumption of several algorithms. If anyone knows of some Haskell code along those lines I'd love to hear about it. Thanks in advance! Justin p.s. I can find

Re: [Haskell-cafe] Simplest possible Fasta shootout entry. How do I zap the ugly line? Suggest any other improvements.

2008-04-28 Thread Don Stewart
r.kelsall: (Extracting these questions from my previous thread for clarity.) Below is my simplest possible program to solve the Fasta shootout benchmark. http://shootout.alioth.debian.org/gp4/benchmark.php?test=fastalang=all http://haskell.org/haskellwiki/Shootout/Fasta I can see one

Re: [Haskell-cafe] Simplest possible Fasta shootout entry. How do I zap the ugly line? Suggest any other improvements.

2008-04-28 Thread Richard Kelsall
Don Stewart wrote: r.kelsall: (Extracting these questions from my previous thread for clarity.) Below is my simplest possible program to solve the Fasta shootout benchmark. http://shootout.alioth.debian.org/gp4/benchmark.php?test=fastalang=all http://haskell.org/haskellwiki/Shootout/Fasta I

Re: [Haskell-cafe] Trouble compiling collections-0.3 (from Hackage)

2008-04-28 Thread Adrian Hey
ccing Haskell Cafe in case anyone else is interested in my answer.. Bryan O'Sullivan wrote: Adrian Hey wrote: I don't think anyone is interested in working on this or maintaining it, so it's probably best not to use it for new stuff. If nobody has stepped up yet, I'll take it over. It

[Haskell-cafe] Re: Caching the Result of a Transaction?

2008-04-28 Thread Conal Elliott
Hi Chris, Thanks a bunch for the new angle. Question comments: * I like the simplicity of using a single TVar whose state reflects the not-computed/computed state of the IVal. * I also like the public interface of taking an STM argument (newTIVal(IO)) over returning a sink

[Haskell-cafe] Confused by instances

2008-04-28 Thread Fraser Wilson
Hello, Haskellers, I feel like I'm missing something obvious, but here's some example code: module Instance where data Value = Value Integer class ValueClass a where fromValue :: Value - a instance ValueClass Bool where fromValue (Value n) = n /= 0 instance ValueClass String

Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Brandon S. Allbery KF8NH
On Apr 28, 2008, at 16:22 , Fraser Wilson wrote: instance (Num a) = ValueClass a where fromValue (Value n) = fromInteger n What I'm really confused by is the response to instance (Num a) = ValueClass a -- what I am trying to say is if a is an instance of Num, then can be an instance

Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Fraser Wilson
On Mon, Apr 28, 2008 at 10:50 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: The format is instance [context =] classname instance. Your classname is ValueClass. Your instance is a. a is not of the form (T a1 ... an). But neither is instance (Show a) = Show [a] ... *sound of

[Haskell-cafe] pls help about subtree

2008-04-28 Thread cetin tozkoparan
Assume a tree is a subtree of the other if all elements of the first tree is included in the second with the exact structure; all parent-child relations are preserved with their order. data Tree = Empty | Leaf Int | Node (Int,Tree,Tree) subtree:: Tree - Tree - Bool How can i start to write this

Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Luke Palmer
2008/4/28 Fraser Wilson [EMAIL PROTECTED]: On Mon, Apr 28, 2008 at 10:50 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: The format is instance [context =] classname instance. Your classname is ValueClass. Your instance is a. a is not of the form (T a1 ... an). But neither is

Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Luke Palmer
2008/4/28 Fraser Wilson [EMAIL PROTECTED]: what I am trying to say is if a is an instance of Num, then can be an instance of ValueClass too, and here's how. Oh, didn't answer this one. This is almost canned response, questions like this get asked weekly on this list. Short answer: you can't.

Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Fraser Wilson
On Mon, Apr 28, 2008 at 11:33 PM, Luke Palmer [EMAIL PROTECTED] wrote: To answer your other question, no, there is no list show hack. Perhaps hack was a strong word. I'm not referring to type synonyms, but to the fact that Prelude's show class happens to have a special show function for

Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Luke Palmer
On Mon, Apr 28, 2008 at 3:47 PM, Fraser Wilson [EMAIL PROTECTED] wrote: On Mon, Apr 28, 2008 at 11:33 PM, Luke Palmer [EMAIL PROTECTED] wrote: To answer your other question, no, there is no list show hack. Perhaps hack was a strong word. I'm not referring to type synonyms, but to the fact

Re: [Haskell-cafe] pls help about subtree

2008-04-28 Thread Luke Palmer
2008/4/28 cetin tozkoparan [EMAIL PROTECTED]: Assume a tree is a subtree of the other if all elements of the first tree is included in the second with the exact structure; all parent-child relations are preserved with their order. data Tree = Empty | Leaf Int | Node (Int,Tree,Tree) Bit of a

Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Fraser Wilson
On Mon, Apr 28, 2008 at 11:46 PM, Luke Palmer [EMAIL PROTECTED] wrote: 2008/4/28 Fraser Wilson [EMAIL PROTECTED]: what I am trying to say is if a is an instance of Num, then can be an instance of ValueClass too, and here's how. Oh, didn't answer this one. This is almost canned response,

[Haskell-cafe] Something like optimistic evaluation

2008-04-28 Thread Daniil Elovkov
Hello Somewhat on the topic of optimistic evaluation, I've just thought of another way to evaluate thunks. When the program is about to block on some IO, what if we start a thread to evaluate (any) unevaluated thunks. We'll have additional system thread, but the blocked one will not

Re: [Haskell-cafe] Something like optimistic evaluation

2008-04-28 Thread Jake Mcarthur
On Apr 28, 2008, at 5:09 PM, Daniil Elovkov wrote: Somewhat on the topic of optimistic evaluation, I've just thought of another way to evaluate thunks. When the program is about to block on some IO, what if we start a thread to evaluate (any) unevaluated thunks. We'll have additional

Re: [Haskell-cafe] Confused by instances

2008-04-28 Thread Brandon S. Allbery KF8NH
On Apr 28, 2008, at 17:47 , Fraser Wilson wrote: Perhaps hack was a strong word. I'm not referring to type synonyms, but to the fact that Prelude's show class happens to have a special show function for lists, which happens to be handy when writing an instance for Show Char. I find the

Re: [Haskell-cafe] Glome.hs-0.3 (bounding objects, heterogeneous lists)

2008-04-28 Thread Jim Snow
Andrew Coppin wrote: Well, for example, Haskell doesn't have hetrogenous lists - which are trivial in any OOP language. That's quite awkward to get around. Also, both spheres and cylinders have a radius property, but then you end up with name clashes. Again, a non-issue in OOP languages. [I

Re: [Haskell-cafe] Re: Caching the Result of a Transaction?

2008-04-28 Thread Ryan Ingram
The problem I have with all of these STM-based solutions to this problem is that they don't actually cache until the action fully executes successfully. For example, if you have a :: TIVal a, and f :: a - TIVal b, and you execute force (a = f) and the action returned by f executes retry for

[Haskell-cafe] HaXml and the XHTML 1.0 Strict DTD

2008-04-28 Thread Peter Gammie
Is anyone using HaXml to validate XHTML Strict? The old 1.13.2 version has some bugs in how it handles attributes that stop me from using it. It handled the DTD parsing fine. The most-recent darcs version relies on a newer ByteString than I have, so it is not easy for me to test it. A

Re: [Haskell-cafe] FFI Query: How to free a CString allocated in Haskell

2008-04-28 Thread Peter Gammie
On 28/04/2008, at 7:23 PM, Bulat Ziganshin wrote: Hello Verma, Monday, April 28, 2008, 4:11:51 PM, you wrote: newCString str Now once I call this function from C code, I am freeing the allocated memory using free function. I want to confirm that this is the right thing to do. yes,

Re: [Haskell-cafe] Re: Caching the Result of a Transaction?

2008-04-28 Thread Jake Mcarthur
On Apr 28, 2008, at 10:01 PM, Ryan Ingram wrote: [...] if you have a :: TIVal a, and f :: a - TIVal b, and you execute force (a = f) and the action returned by f executes retry for whatever reason, then the caching done in a gets undone. Dangit, you're right. You just rained on the parade!

Re: [Haskell-cafe] Re: Caching the Result of a Transaction?

2008-04-28 Thread Conal Elliott
Thanks, Ryan, for the reminder and explanation of this problem. - Conal On Mon, Apr 28, 2008 at 8:01 PM, Ryan Ingram [EMAIL PROTECTED] wrote: The problem I have with all of these STM-based solutions to this problem is that they don't actually cache until the action fully executes

RE: [Haskell-cafe] FFI Query: How to free a CString allocated in Haskell

2008-04-28 Thread Verma Anurag-VNF673
Peter, A naïve question I have now after reading your mail. How do I call MarshallAlloc.free from my C code because that's where I need to free it? Anurag So no, using C's free is not the right thing to do. It will probably work in the real world, but you should try to use Haskell's free

Re: [Haskell-cafe] FFI Query: How to free a CString allocated in Haskell

2008-04-28 Thread Brandon S. Allbery KF8NH
On Apr 29, 2008, at 1:45 , Verma Anurag-VNF673 wrote: A naïve question I have now after reading your mail. How do I call MarshallAlloc.free from my C code because that's where I need to free it? Provide a Haskell wrapper function to deallocate / free it, as a parallel to the function