[Haskell-cafe] Re: is there a more concise way to generate helper functions for a datatype built on records?

2007-11-28 Thread Benedikt Huber
apfelmus schrieb: Benedikt Huber wrote: So, the Ref deriviation is really nice for sequential updates; parallel updates on the other hand need some work. .. While the select part of the Ref is expressed using , I don't know how the parallel update can be expressed in terms of combinators. Any

Re: [Haskell-cafe] Re: is there a more concise way to generate helper functions for a datatype built on records?

2007-11-27 Thread Isaac Dupree
apfelmus wrote: Benedikt Huber wrote: type Upd a = a - a data Ref cx t = Ref { select :: cx - t , update :: Upd t - Upd cx } Functional references are also called lens, I'm going to use that term from now on. As a minor note, I somehow prefer a single primitive data Lens s a =

[Haskell-cafe] Re: is there a more concise way to generate helper functions for a datatype built on records?

2007-11-27 Thread apfelmus
Isaac Dupree wrote: apfelmus wrote: dup :: Lens a (a,a) dup = id id Which component of the pair should put dup :: a - (a,a) - (a,a) change? The first, the second, or even both? [...] put :: Lens s a - a - s - s put x = flip $ snd . focus x wouldn't put dup :: (a,a) - a - a

[Haskell-cafe] Re: is there a more concise way to generate helper functions for a datatype built on records?

2007-11-26 Thread Benedikt Huber
Neil Mitchell wrote: Hi Some of these can be automatically derived by the Data.Derive tool... The derivations Set, Is, From, Has, LazySet all look useful. ... On Nov 24, 2007 4:01 PM, Thomas Hartman [EMAIL PROTECTED] wrote: I think I'm running into more or less the same issue discussed at