[Haskell-cafe] Re: I just don't get it (data structures and OO)

Claus Reinke claus.reinke at talk21.com
Mon Jun 4 18:40:15 EDT 2007


|> > data Ref cx t
|> >  = Ref
|> >    {
|> >      select :: cx -> t
|> >    , update :: (t -> t) -> cx -> cx
|> >    }
|> 
|> A Ref is a bit like a typed and composable incarnation of apfelmus's
|> indices, or a wrapper around Tillmann's change* functions, containing
|> not only a setter but also the accompanying getter.
|
|That's a neat idiom. I wonder how far one could usefully generalize it.

you might find Koji Kagawa's papers interesting:

http://guppy.eng.kagawa-u.ac.jp/~kagawa/publication/index-e.html

in particular

Mutable Data Structures and Composable References 
in a Pure Functional Language , Koji Kagawa, In SIPL '95: 
State in Programming Languages, San Francisco, USA, January 1995.

Compositional References for Stateful Functional Programming, 
Koji Kagawa, ICFP 1997, June 1997, Amsterdam, the Netherlands. 

claus



More information about the Haskell-Cafe mailing list