Re: [Haskell-cafe] JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

2012-09-09 Thread Greg Fitzgerald
Hi Bob, > All I really need is to allow users to write some JavaScript > that accepts a single JSON 'file/string' from my Haskell > program and produces another JSON 'file/string' that my > Haskell program will accept. One option is to make your Haskell program an HTTP server, and then use Node.j

Re: [Haskell-cafe] Destructive updates to plain ADTs

2012-09-09 Thread AntC
Milan Straka ucw.cz> writes: > > is there any way to perform a destructive update on a plain ADT? Hi Milan, perhaps this is a dumb question, but given that you're using a lazy functional language: why do you want to do destructive updates at all? Perhaps you'd be better off using an imperativ

Re: [Haskell-cafe] ANNOUCE: Haddock 2.10.0 and 2.11.0

2012-09-09 Thread David Waern
2012/9/8 Ivan Lazar Miljenovic : > On 7 September 2012 23:19, David Waern wrote: >> >> -- Haddock 2.10.0 and 2.11.0 >> >> >> Two new versions of Haddock have been uploaded to Hackage: version >> 2.10.0 which

Re: [Haskell-cafe] Destructive updates to plain ADTs

2012-09-09 Thread Ganesh Sittampalam
On 09/09/2012 11:03, Milan Straka wrote: > I was hoping for some Addr# trick or something like that. If > I understand the GHC runtime correctly, rewriting a pointer in an ADT > should not break any garbage collecting and similar. Don't you need to worry about having something in the old generati

Re: [Haskell-cafe] Destructive updates to plain ADTs

2012-09-09 Thread Milan Straka
> > is there any way to perform a destructive update on a plain ADT? > > Imagine I have a simple > > data Tree a = Nil | Node a (Tree a) (Tree a) > > I would like to be able to modify right subtree of an existing tree. > > > > I can do that for example when using IORefs by changing the datatype t

Re: [Haskell-cafe] Destructive updates to plain ADTs

2012-09-09 Thread Johan Tibell
On Sun, Sep 9, 2012 at 2:19 AM, MigMit wrote: > Why modify it instead of creating the new one and let the previous tree get > garbage collected? You can avoid a bunch of copying and allocation by modifying the nodes in-place. See http://blog.johantibell.com/2012/03/improvements-to-hashmap-and-h

Re: [Haskell-cafe] Destructive updates to plain ADTs

2012-09-09 Thread MigMit
Why modify it instead of creating the new one and let the previous tree get garbage collected? On Sep 9, 2012, at 12:46 PM, Milan Straka wrote: > Hi all, > > is there any way to perform a destructive update on a plain ADT? > Imagine I have a simple > data Tree a = Nil | Node a (Tree a) (Tree

Re: [Haskell-cafe] Destructive updates to plain ADTs

2012-09-09 Thread Johan Tibell
On Sun, Sep 9, 2012 at 1:46 AM, Milan Straka wrote: > Hi all, > > is there any way to perform a destructive update on a plain ADT? > Imagine I have a simple > data Tree a = Nil | Node a (Tree a) (Tree a) > I would like to be able to modify right subtree of an existing tree. > > I can do that for

[Haskell-cafe] Destructive updates to plain ADTs

2012-09-09 Thread Milan Straka
Hi all, is there any way to perform a destructive update on a plain ADT? Imagine I have a simple data Tree a = Nil | Node a (Tree a) (Tree a) I would like to be able to modify right subtree of an existing tree. I can do that for example when using IORefs by changing the datatype to data Tree