Re: [Haskell-cafe] functional update

2008-04-25 Thread Evan Laforge
Thanks everyone, this is all good stuff. I did look at Clean and it looks like it has somewhat nicer record syntax... but it doesn't look like anything haskell couldn't do better if it one day got a real record system. As for the rest of Clean, I'm afraid that spending too much time with it will

Re: [Haskell-cafe] functional update

2008-04-24 Thread Luke Palmer
On Tue, Apr 22, 2008 at 6:26 AM, Henning Thielemann <[EMAIL PROTECTED]> wrote: > On Mon, 21 Apr 2008, Ryan Ingram wrote: > > I recommend this blog entry: > > > http://twan.home.fmf.nl/blog/haskell/overloading-functional-references.details > > > > along with a few additional combinators for imperat

Re: [Haskell-cafe] functional update

2008-04-22 Thread Henning Thielemann
On Mon, 21 Apr 2008, Ryan Ingram wrote: I recommend this blog entry: http://twan.home.fmf.nl/blog/haskell/overloading-functional-references.details along with a few additional combinators for imperative update: data FRef s a = FRef { frGet :: s -> a , frSet :: a -> s -> s } http://dar

Re: [Haskell-cafe] functional update

2008-04-21 Thread Stuart Cook
On Tue, Apr 22, 2008 at 4:12 AM, Evan Laforge <[EMAIL PROTECTED]> wrote: > Has there been any work on improving update syntax in haskell? > Possibly some improvement could be made with a typeclass or two and a > few custom operators, to unify some of the disparate syntax. Maybe > more improvem

Re: [Haskell-cafe] functional update

2008-04-21 Thread Ryan Ingram
I recommend this blog entry: http://twan.home.fmf.nl/blog/haskell/overloading-functional-references.details along with a few additional combinators for imperative update: data FRef s a = FRef { frGet :: s -> a , frSet :: a -> s -> s } (=:) :: MonadState s m => FRef s a -> a -> m () ref

[Haskell-cafe] functional update

2008-04-21 Thread Evan Laforge
Here's some haskell to update a particular field in a data structure (the below run in a StateT / ErrorT context): > set_track_width :: (UiStateMonad m) => > Block.ViewId -> Int -> Block.Width -> m () > set_track_width view_id tracknum width = do > view <- get_view view_id > track_view