
(Sorry to break the thread, but mutt somehow managed to eat the message I'm replying to...) Arie Peterson:
You could also use 'compositional functional references'. These are introduced in the paper "A Functional Programming Technique for Forms in Graphical User Interfaces" by Sander Evers, Peter Achten and Jan Kuper.
=== Introduction ===
There are two things one typically wants to do when working with a substructure of some larger data structure: (1) extract the substructure; and (2) change the larger structure by acting on the substructure. A 'Ref cx t' encodes both of these functions (for a substructure of type 't' and larger structure (context) of type 'cx').
data Ref cx t = Ref { select :: cx -> t , update :: (t -> t) -> cx -> cx } ... I've written a template haskell function to derive Refs from a data > structure definition (with record syntax): given
I've implemented this in Derive[1] in 12 minutes, counting the time required to re-familiarize with the code. The patch is at [2] and has also been darcs sent. [1] http://www-users.cs.york.ac.uk/~ndm/derive [2] http://members.cox.net/stefanor/derive-Ref-patch Stefan

Hi
You could also use 'compositional functional references'. These are introduced in the paper "A Functional Programming Technique for Forms in Graphical User Interfaces" by Sander Evers, Peter Achten and Jan Kuper.
I've written a template haskell function to derive Refs from a data > structure definition (with record syntax): given
I've implemented this in Derive[1] in 12 minutes, counting the time required to re-familiarize with the code. The patch is at [2] and has also been darcs sent.
It's been applied, and is now in the main repo. Thanks Neil

Hello, Stefan O'Rear wrote:
I've implemented this in Derive[1] in 12 minutes, counting the time required to re-familiarize with the code. The patch is at [2] and has also been darcs sent.
Neil Mitchell wrote:
It's been applied, and is now in the main repo.
Wow, that was fast. I didn't really consider that this code might be consolidated, so the naming could be off. Not that I'm complaining :-). Would anyone care to see the Ref type itself in some publicly available place? Speaking of Derive: I tried to install it just a few days ago, and failed. 'Derive' needed 'filepath-any', which needed 'directory-any', which I couldn't find (in Hackage or on Neil's website). Greetings, Arie -- Just follow the magic footprints.

Hi
Speaking of Derive: I tried to install it just a few days ago, and failed. 'Derive' needed 'filepath-any', which needed 'directory-any', which I couldn't find (in Hackage or on Neil's website).
Either: 1) Use GHC 6.6.1, which comes with filepath 2) Use the hackage version: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/filepath-1.0 I wouldn't recommend using the darcs version, since it will only work with the very latest copy of base which is in the process of being split up. Thanks Neil
participants (3)
-
Arie Peterson
-
Neil Mitchell
-
Stefan O'Rear