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

2008-04-29 Thread Peter Gammie
On 29/04/2008, at 12:58 PM, Brandon S. Allbery KF8NH wrote: 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

[Haskell-cafe] force inlining in GHC

2008-04-29 Thread Henning Thielemann
Whenever I try to inline a lot of nested function calls, GHC decides to specialise one of the functions and the specialised function is no longer inlined. I hoped to get the function inlined anyway by specialising it manually. Say, I want to inline genericFunc {-# INLINE genericFunc #-}

RE: [Haskell-cafe] force inlining in GHC

2008-04-29 Thread Simon Peyton-Jones
As luck would have it, I'm working on INLINE pragmas for Roman right at this moment. Could you spare a moment to give me a concrete test case, to make sure I hit your case too? If you can give me a program that doesn't optimise as you expect, I'm much more likely to get it right. Thanks

Re: [Haskell-cafe] force inlining in GHC

2008-04-29 Thread Bulat Ziganshin
Hello Henning, Tuesday, April 29, 2008, 2:01:39 PM, you wrote: However, in the Core output 'doubleFunc' does not get the __inline_me tag and thus will not be inlined, too. :-( ghc is so smart that sometimes it fool itself :D i bet that in this case generic and specific functions are

Re: [Haskell-cafe] pls help about subtree

2008-04-29 Thread Brent Yorgey
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)

Re: [Haskell-cafe] Something like optimistic evaluation

2008-04-29 Thread Brent Yorgey
On Mon, Apr 28, 2008 at 6:09 PM, Daniil Elovkov [EMAIL PROTECTED] wrote: 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

[Haskell-cafe] Mutual recursive data types

2008-04-29 Thread rodrigo.bonifacio
Hi all, I have the following data types: type Id = String type Action = String type State = String type Response = String data Scenario = Scenario Description [Step] data Step = Step Id Scenario Action State Response So, there is a mutual recursion between Scenario and Step. Now, consider the

Re: [Haskell-cafe] Mutual recursive data types

2008-04-29 Thread Luke Palmer
On Tue, Apr 29, 2008 at 8:54 AM, rodrigo.bonifacio [EMAIL PROTECTED] wrote: Hi all, I have the following data types: type Id = String type Action = String type State = String type Response = String data Scenario = Scenario Description [Step] data Step = Step Id Scenario Action

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

2008-04-29 Thread Jake Mcarthur
On Apr 28, 2008, at 10:01 PM, Ryan Ingram 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 successfully. I just hacked together a new monad that I think might solve this, at least with a little

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

2008-04-29 Thread Jake Mcarthur
*sigh* As is usual with my untested code, the code I just sent was wrong. I will be able to actually test, correct, and refine it tonight. If nobody else has picked it up by then I will do so. - Jake ___ Haskell-Cafe mailing list

AW: [Haskell-cafe] Something like optimistic evaluation

2008-04-29 Thread Nicu Ionita
I don't know if this would be worth, but theoretically one could go on and evaluate those thunks that: a) would be evaluated anyway (after the current IO operation have been completed) b) do not depend on the result of the current operation And, of course, the GC could work in this time also.

Re: [Haskell-cafe] Something like optimistic evaluation

2008-04-29 Thread Daniil Elovkov
Brent Yorgey wrote: On Mon, Apr 28, 2008 at 6:09 PM, Daniil Elovkov [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: 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,

Re: AW: [Haskell-cafe] Something like optimistic evaluation

2008-04-29 Thread Daniil Elovkov
Nicu Ionita wrote: I don't know if this would be worth, but theoretically one could go on and evaluate those thunks that: a) would be evaluated anyway (after the current IO operation have been completed) b) do not depend on the result of the current operation And, of course, the GC could

[Haskell-cafe] catching fails on read

2008-04-29 Thread Jacques Bergeron
I'm new to Haskell and have a stupid question. How can a catch a parsing error on a read? Something like let s = e in read s :: Int I've been searching for a trick and couldn't find one. I want to enter commands directly from the keyboard and don't want the program to abort if I do a typing

Re: [Haskell-cafe] catching fails on read

2008-04-29 Thread Don Stewart
jbergeron: I'm new to Haskell and have a stupid question. How can a catch a parsing error on a read? Something like let s = e in read s :: Int I've been searching for a trick and couldn't find one. I want to enter commands directly from the keyboard and don't want the program to

[Haskell-cafe] Re: catching fails on read

2008-04-29 Thread Jacques Bergeron
Don Stewart dons at galois.com writes: jbergeron: I'm new to Haskell and have a stupid question. How can a catch a parsing error on a read? Something like let s = e in read s :: Int I've been searching for a trick and couldn't find one. I want to enter commands directly

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

2008-04-29 Thread Albert Y. C. Lai
John Goerzen wrote: That's a wonderful interface, but unfortunately it appears to assume that your Unicode I/O is always UTF-8, and never UTF-16. I happen to deal with more UTF-16 data than UTF-8 over here at the moment. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/encoding

[Haskell-cafe] A bright future for Haskell

2008-04-29 Thread John Peterson
Especially if SPJ decides to grow a beard. Unfortunately Paul is now clean shaven so maybe Haskell is in trouble. http://blogs.microsoft.co.il/blogs/tamir/archive/2008/04/28/computer-languages-and-facial-hair-take-two.aspx John ___ Haskell-Cafe

Re: [Haskell-cafe] A bright future for Haskell

2008-04-29 Thread ajb
G'day all. Quoting John Peterson [EMAIL PROTECTED]: Especially if SPJ decides to grow a beard. Unfortunately Paul is now clean shaven so maybe Haskell is in trouble. This explains why Clean never made it: Rinus Plasmeijer can't compete with Phil Wadler in the beard department. I should

Re: [Haskell-cafe] A bright future for Haskell

2008-04-29 Thread Don Stewart
ajb: G'day all. Quoting John Peterson [EMAIL PROTECTED]: Especially if SPJ decides to grow a beard. Unfortunately Paul is now clean shaven so maybe Haskell is in trouble. This explains why Clean never made it: Rinus Plasmeijer can't compete with Phil Wadler in the beard department.

[Haskell-cafe] Couple of formal questions

2008-04-29 Thread Creighton Hogg
Hello Haskell, So there's two questions that have been bothering me lately while they are, as usual, a little off topic I figured this might be a good forum: Where could I find a good treatment on data vs. codata the difference between well-founded recursion well-founded(?) corecursion? Where

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

2008-04-29 Thread Jake Mcarthur
Alright, I have tested it now. I still feel funny about most of the names I chose for the types and functions, and it's still very ugly, but the code appears to work correctly. In this version I have also added retry and orElse functions so that it can feel more like the STM monad. I think

Re: [Haskell-cafe] approximating pi

2008-04-29 Thread Benjamin L. Russell
I was thinking of how to represent this process graphically on a computer screen. Assuming one wanted to perform a demo of this algorithm (in the spirit of XTANGO, an algorithm animator that I had used for my senior project in 1994), in order to represent the square and the circle on-screen,