Re: [Haskell-cafe] record update

2010-10-01 Thread Wolfgang Jeltsch
Am Dienstag, den 14.09.2010, 13:31 -0600 schrieb Jonathan Geddes: Wow, I had no idea there were so many record packages! The trouble is that only one of them (i.e., mine) is categorized under “Records” on Hackage. Best wishes, Wolfgang ___

Re: [Haskell-cafe] record update

2010-09-14 Thread Jonathan Geddes
Wow, I had no idea there were so many record packages! This indicates a couple things to me: a) Haskell is very flexible. b) I'm not the only one who things the built-in record system isn't perfect. Digging a bit deeper, it looks like some of the record-related ghc extensions might also be

Re: [Haskell-cafe] record update

2010-09-14 Thread Conrad Parker
On 15 September 2010 04:31, Jonathan Geddes geddes.jonat...@gmail.com wrote: Wow, I had no idea there were so many record packages! This indicates a couple things to me: a) Haskell is very flexible. b) I'm not the only one who things the built-in record system isn't perfect. Digging a bit

Re: [Haskell-cafe] record update

2010-09-14 Thread Luke Palmer
On Tue, Sep 14, 2010 at 1:31 PM, Jonathan Geddes geddes.jonat...@gmail.com wrote: With these extensions, couldn't I write the following? someUpdate :: MyRecord - MyRecord someUpdate myRecord@(MyRecord{..}) = let     { field1 = f field1     , field2 = g field2     , field3 = h filed3     } in

Re: [Haskell-cafe] record update

2010-09-13 Thread Wolfgang Jeltsch
Am Samstag, den 11.09.2010, 11:21 -0600 schrieb Jonathan Geddes: I know that record updates is a topic that has become a bit of a dead horse, but here I go anyway: I find that most of the record updates I read and write take the form someUpdate :: MyRecord - MyRecord someUpdate myRecord =

Re: [Haskell-cafe] record update

2010-09-13 Thread Chris Eidhof
For completeness, using fclabels (yet another record package) you can write it like this: {-# LANGUAGE TemplateHaskell #-} module Records where import Data.Record.Label data MyRecord = MyRecord { _field1 :: String, _field2 :: Int, _field3 :: Bool } $(mkLabels [''MyRecord])

[Haskell-cafe] record update

2010-09-11 Thread Jonathan Geddes
I know that record updates is a topic that has become a bit of a dead horse, but here I go anyway: I find that most of the record updates I read and write take the form someUpdate :: MyRecord - MyRecord someUpdate myRecord = myRecord { field1 = f $ field1 myRecord , field2 = g $ field2

Re: [Haskell-cafe] record update

2010-09-11 Thread Henning Thielemann
Jonathan Geddes schrieb: I know that record updates is a topic that has become a bit of a dead horse, but here I go anyway: I find that most of the record updates I read and write take the form someUpdate :: MyRecord - MyRecord someUpdate myRecord = myRecord { field1 = f $ field1

Re: [Haskell-cafe] record update

2010-09-11 Thread Jonathan Geddes
On Sat, Sep 11, 2010 at 11:53 AM, Henning Thielemann schlepp...@henning-thielemann.de wrote: Jonathan Geddes schrieb: I know that record updates is a topic that has become a bit of a dead horse, but here I go anyway: I find that most of the record updates I read and write take the form

Re: [Haskell-cafe] record update

2010-09-11 Thread Stephen Tetley
On 11 September 2010 18:21, Jonathan Geddes geddes.jonat...@gmail.com wrote: someUpdate :: MyRecord - MyRecord someUpdate myRecord = myRecord     { field1 = f $ field1 myRecord     , field2 = g $ field2 myRecord     , field3 = h $ filed3 myRecord     } Applicatively, using no additional

Re: [Haskell-cafe] record update

2010-09-11 Thread Henning Thielemann
On Sat, 11 Sep 2010, Jonathan Geddes wrote: On Sat, Sep 11, 2010 at 11:53 AM, Henning Thielemann data-accessor and similar packages may become your friends. data-accessor allows you to write: someUpdate =   (field1 ^: f) .   (field2 ^: g) .   (field3 ^: h) data-accessor is a pretty cool

Re: [Haskell-cafe] record update

2010-09-11 Thread Henning Thielemann
On Sat, 11 Sep 2010, Stephen Tetley wrote: On 11 September 2010 18:21, Jonathan Geddes geddes.jonat...@gmail.com wrote: someUpdate :: MyRecord - MyRecord someUpdate myRecord = myRecord     { field1 = f $ field1 myRecord     , field2 = g $ field2 myRecord     , field3 = h $ filed3 myRecord    

Re: [Haskell-cafe] record update

2010-09-11 Thread Stephen Tetley
On 11 September 2010 20:45, Henning Thielemann lemm...@henning-thielemann.de wrote: It uses the Applicative instance for functions. Yep - I meant that, but somehow didn't write it, then pressed the send button... ___ Haskell-Cafe mailing list

[Haskell-cafe] Record update fusion (or how should I call it?)

2009-09-06 Thread Peter Verswyvelen
I've seen a couple of package being announced that provide first class labels, and other packages already existed for this (Grapefruit Record, HList, Accessor, ...) Regarding this, I have a question about the performance of multiple composed field updates. Maybe an example. Suppose I have a

Re: [Haskell-cafe] Record update fusion (or how should I call it?)

2009-09-06 Thread Derek Elkins
The first thing I would do i is verify that the compiler is not already doing this. On Sun, Sep 6, 2009 at 7:50 AM, Peter Verswyvelenbugf...@gmail.com wrote: I've seen a couple of package being announced that provide first class labels, and other packages already existed for this (Grapefruit

Re: [Haskell-cafe] Record update fusion (or how should I call it?)

2009-09-06 Thread Alberto G. Corona
Use Haskell records: defaultWindowDescription= WindowDescription {title=, size=(0,0) ..} Many modifications can be fused in a single statement. for example: newWindowDescription= defaultWindowDescription{itle= Haskell ; size= (640,480),background= Blue} 2009/9/6 Derek Elkins

Re: [Haskell-cafe] Record update fusion (or how should I call it?)

2009-09-06 Thread Peter Verswyvelen
Yes of course Haskell records do this, but these updates are not first class. But this kind of fusion seems rather general. I haven't checked if the compiler already does it. On Sun, Sep 6, 2009 at 9:19 PM, Alberto G. Coronaagocor...@gmail.com wrote: Use Haskell records: