Re: [Haskell-cafe] A different Maybe maybe

2007-03-08 Thread Lennart Augustsson
It's not wasted time at all. Discovering things is fun and interesting; it doen't matter if someone else has discovered it first. On Mar 8, 2007, at 02:51 , Dan Weston wrote: Congratulations! You've just reinvented Church encoding. Do not let the multiple responses of how you apparently

Re: [Haskell-cafe] TVars throw

2007-03-08 Thread Chris Kuklewicz
Stefan O'Rear wrote: On Thu, Mar 08, 2007 at 12:25:15PM +1100, Thomas Conway wrote: Hi All, Consider the following: foo = do v - newTVar hi there! throwDyn v main = do catchDyn (atomically foo) \v - do x - atomically (readTVar v) putStr x I.e. throw

Re: [Haskell] Re: [Haskell-cafe] Google summer of code

2007-03-08 Thread Simon Marlow
David House wrote: On 06/03/07, Malcolm Wallace [EMAIL PROTECTED] wrote: Well, our wiki to gather ideas is now up-and-running again: http://hackage.haskell.org/trac/summer-of-code We should probably remove projects that were succeessfully completed last year, along with the lists of

[Haskell-cafe] Re: LDFLAGS

2007-03-08 Thread Simon Marlow
[EMAIL PROTECTED] wrote: I have built ghc-6.6 twice for 64-bit OpenBSD 4.0 with LDFLAGS=-L/usr/local/lib set as an environmental variable. Both times the built ghc did not find -lgmp until I modified lib/ghc-6.6/package.conf by adding -L/usr/local/lib to ldOptions. What do I set in order to

Re: [Haskell-cafe] Re: problems installing ghc 6.6 with extralibs (bad interface file)

2007-03-08 Thread Thomas Hartman
Indeed, memory was the issue. By the way, serendipitiously, linode.com spontaneously upgraded all virtual root boxen to 256M ram for free right around the time I ran into this, which solved the problem. so, if anyone would like to try haskell in a hosted environment, I can now heartily

Re: [Haskell-cafe] A different Maybe maybe

2007-03-08 Thread Dougal Stanton
On 08/03/07, Dan Weston [EMAIL PROTECTED] wrote: Do not let the multiple responses of how you apparently wasted your time reinventing (or do they mean stealing?) something Church did long ago dampen your enthusiasm to learn exciting things and then share them. I agree with your sentiment that

[Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread David Roundy
Hi all, I was just teaching a class on minimization methods, with a focus on conjugate gradient minimization in particular, and one of my main points was that with conjugate gradient minimization we only need three or four arrays of size N (depending on whether we use the Fletcher-Reeves or

Re: [Haskell-cafe] Usage of . and $

2007-03-08 Thread David House
On 08/03/07, Simon Peyton-Jones [EMAIL PROTECTED] wrote: NB that infix type constructors must start with :, just like infix data constructors. Now that's just not true. {-# OPTIONS_GHC -fglasgow-exts #-} type a $ b = a b data Foo a = Foo a deriving (Show) data Bar = Bar (Foo $ Int)

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Dan Piponi
On 3/8/07, David Roundy [EMAIL PROTECTED] wrote: I started wondering whether there's a solution that would allow us to write pretty high-level pure functional code, while the RTS can realize at run-time that we have the only reference to the input argument and that it is therefore safe to

[Haskell-cafe] open a browser from the command line, wait a few seconds, and shut it. (ie, translate forking from bash to haskell)

2007-03-08 Thread Thomas Hartman
I have a bash script that opens a browser for a few seconds, and then closes it. Could someone point me up the equivelant(s) in haskell, h4sh, hsh, etc,0 and friends? I reckon this amounts to, what's the process for translating forking from bash to haskell. #!/bin/bash konqueror

[Haskell-cafe] Re: EnumSet and EnumMap

2007-03-08 Thread John Meacham
On Fri, Feb 23, 2007 at 03:24:27PM +, Chris Kuklewicz wrote: I could not quickly find anyone else writing this boiler plate, so I have posted this useful wrapper on the Haskell wiki at http://haskell.org/haskellwiki/EnumSet_EnumMap concurrent evolution :)

Re: [Haskell-cafe] A different Maybe maybe

2007-03-08 Thread Dan Weston
I was not implying that the others' responses actually were critical. I was implying that many (especially people newer to Haskell or lacking postgraduate degrees in mathematics or computer science) would interpret them as such, and if not quickly clarified, might discourage non-gurus from

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Dan Weston
Or possibly more generally copy-on-write, which requires one more level of indirection (handle instead of ptr). Since you are talking about using ForeignPtr, this is already within your power to prototype, I should think. Dan Dan Piponi wrote: On 3/8/07, David Roundy [EMAIL PROTECTED]

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread David Roundy
I'm thinking you're missing the point. The point is to copy without writing, and that requires some knowledge (whether static or runtime) of whether anyone else has a reference to my data--which copy-on-write won't give me. David On Thu, Mar 08, 2007 at 11:15:25AM -0800, Dan Weston wrote: Or

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Brandon S. Allbery KF8NH
On Mar 8, 2007, at 14:21 , David Roundy wrote: I'm thinking you're missing the point. The point is to copy without writing, and that requires some knowledge (whether static or runtime) of whether anyone else has a reference to my data--which copy-on-write won't give me. Actually, I was

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread David Roundy
On Thu, Mar 08, 2007 at 02:50:51PM -0500, Brandon S. Allbery KF8NH wrote: On Mar 8, 2007, at 14:21 , David Roundy wrote: I'm thinking you're missing the point. The point is to copy without writing, and that requires some knowledge (whether static or runtime) of whether anyone else has a

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread John Meacham
it seems we can almost do this now without adding any new API calls, just have 'thawArray' and 'freezeArray' perform the check, and behave like 'unsafeThawArray' or 'unsafeFreezeArray' when they are the only reference. The compiler may even be able to statically replace some calls to thawArray

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Claus Reinke
my line of work). This got me thinking about one of the largest problems with writing serious numerical code in Haskell, which is that of memory consumption and avoiding temporary variables. ... pretty high-level pure functional code, while the RTS can realize at run-time that we have the only

Re: [Haskell-cafe] A different Maybe maybe

2007-03-08 Thread Joachim Breitner
Hi, Am Mittwoch, den 07.03.2007, 23:32 +0100 schrieb Joachim Breitner: [Also on http://www.joachim-breitner.de/blog/archives/229-A-different-Maybe-maybe.html] [Skipping Church encoding] Thanks for all the answers and links. I was expecting to have discovered something that already exists, so

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Claus Reinke
Except that DiffArrays are slow and expensive in both space and time (compared with strict unboxed arrays). They necesarily hold boxed values so you pay a factor of at least two in space cost (for arrays of Doubles) right off the top, and there's no way you could recover that. I'll admit that

[Haskell-cafe] Distributing a GHC-compiled binary for Macs (x86)

2007-03-08 Thread Arjun Guha
Hi, I compiled a binary using GHC 6.6 on my Mac (specifically, using ghc --make). This binary seems to depend on the GNU MP framework--I imagine GHC uses it to implement its numeric tower. However, Macs that don't have GHC installed don't seem to have GMP, so I'll guess that it was installed

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread David Roundy
On Thu, Mar 08, 2007 at 08:45:06PM -, Claus Reinke wrote: Except that DiffArrays are slow and expensive in both space and time (compared with strict unboxed arrays). They necesarily hold boxed values so you pay a factor of at least two in space cost (for arrays of Doubles) right off the

Re: [Haskell] Re: [Haskell-cafe] Google summer of code

2007-03-08 Thread Bjorn Bringert
On Mar 8, 2007, at 10:40 , Simon Marlow wrote: David House wrote: On 06/03/07, Malcolm Wallace [EMAIL PROTECTED] wrote: Well, our wiki to gather ideas is now up-and-running again: http://hackage.haskell.org/trac/summer-of-code We should probably remove projects that were succeessfully

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Dan Weston
I might be missing the point, but I think you are missing mine. The copy-on-write I am talking about means that it's no longer your data, so you don't need any knowledge of who has access to it because you don't own it or have a pointer to it. It is owned by some broker from which you request

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Brandon S. Allbery KF8NH
On Mar 8, 2007, at 16:27 , David Roundy wrote: The real issue for me is that DiffArrays only make any sense at all if you often update a subset of your array, which I never expect to do... so even if they were efficiently implemented to the point of zero overhead, they would gain me

Re: [Haskell-cafe] TVars throw

2007-03-08 Thread Thomas Conway
On 3/8/07, Chris Kuklewicz [EMAIL PROTECTED] wrote: What happens in your throw/catch case if I have stm1 = do some_stm_code_that_throws_your_exception stm2 = return Foo and I run atomically (stm1 `orElse` stm2) ? Answer: The exception will prevent running stm2. In the *specific* case of

Re: [Haskell-cafe] open a browser from the command line, wait a few seconds, and shut it. (ie, translate forking from bash to haskell)

2007-03-08 Thread Donald Bruce Stewart
tphyahoo: I have a bash script that opens a browser for a few seconds, and then closes it. Could someone point me up the equivelant(s) in haskell, h4sh, hsh, etc,0 and friends? I reckon this amounts to, what's the process for translating forking from bash to haskell.

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread David Roundy
Ah, I was missing your point, I've heard something called copy-on-write, which wasn't what you describe (or I also misunderstood it when I heard it before). I see. But how would one manage these handles? What's to keep me from accidentally copying a handle? It sounds like it'd require explicit

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread David Roundy
On Thu, Mar 08, 2007 at 04:32:01PM -0500, Brandon S. Allbery KF8NH wrote: On Mar 8, 2007, at 16:27 , David Roundy wrote: The real issue for me is that DiffArrays only make any sense at all if you often update a subset of your array, which I never expect to do... so even if they were

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Matthias Neubauer
David Roundy [EMAIL PROTECTED] writes: I see. But how would one manage these handles? What's to keep me from accidentally copying a handle? It sounds like it'd require explicit memory management, in order to avoid ever copying a handle, if I were to implment this myself. Because you seem to

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread David Roundy
On Thu, Mar 08, 2007 at 11:09:35PM +0100, Matthias Neubauer wrote: David Roundy [EMAIL PROTECTED] writes: I see. But how would one manage these handles? What's to keep me from accidentally copying a handle? It sounds like it'd require explicit memory management, in order to avoid ever

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Matthias Neubauer
David Roundy [EMAIL PROTECTED] writes: No, the point is to avoid writing imperative code. My examples used imperative code, but that would be wrapped at the lowest level of the array library, and all the real code would be pure. Still sounds like a state monad to me. Your 'array library', I

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Brandon S. Allbery KF8NH
On Mar 8, 2007, at 17:09 , Matthias Neubauer wrote: David Roundy [EMAIL PROTECTED] writes: I see. But how would one manage these handles? What's to keep me from accidentally copying a handle? It sounds like it'd require explicit memory management, in order to avoid ever copying a handle,

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Dan Weston
Have you looked into using STM (Software Transactional Memory)? This problem seems like some subset of concurrent programming. Dan David Roundy wrote: Ah, I was missing your point, I've heard something called copy-on-write, which wasn't what you describe (or I also misunderstood it when I

[Haskell-cafe] Re: [Haskell] Summer of Code questions

2007-03-08 Thread Malcolm Wallace
Wolfgang Jeltsch [EMAIL PROTECTED] writes: First, what organization is Haskell.org? That would be us, right here. Anyone who is interested enough in Haskell to be involved in mailing lists, IRC, distributing library code and tools, whatever. Is this a real organization, i.e., a legal entity?

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread David Roundy
Nothing is being done concurrently, so I don't see what STM would gain us. What is it that you're thinking we could gain from STM? David On Thu, Mar 08, 2007 at 03:04:43PM -0800, Dan Weston wrote: Have you looked into using STM (Software Transactional Memory)? This problem seems like some

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Thomas Conway
On 3/9/07, David Roundy [EMAIL PROTECTED] wrote: Nothing is being done concurrently, so I don't see what STM would gain us. What is it that you're thinking we could gain from STM? Its shiny and new, so it will make your code look sexy? :-) So what happened to linear types? I remember reading

Re: [Haskell-cafe] idea for avoiding temporaries

2007-03-08 Thread Ketil Malde
David Roundy wrote: Actually, I was thinking this sounded a lot like DiffArrays. Except that DiffArrays are slow and expensive in both space and time (compared with strict unboxed arrays). They necesarily hold boxed values so you pay a factor of at least two in space cost (for arrays of