[Haskell-cafe] Embedded Functions in Algebraic Data Types?
Henning Thielemann
lemming at henning-thielemann.de
Sun Feb 10 10:59:51 EST 2008
On Sun, 10 Feb 2008, Henning Thielemann wrote:
> On Sun, 10 Feb 2008, Luke Palmer wrote:
>
> > Quite frequently.
> >
> > Here are a few examples from my own code:
> >
> > For "functional references" (representing a bidirectional function
> > from a data type to a part of itself (for example the first element of
> > a pair)).
> >
> > > data Accessor s a
> > > = Accessor { get :: s -> a
> > > , set :: a -> s -> s
> > > }
> >
> > My quantum computation arrow (really in the realm of "concrete, useful
> > things", huh? :-)
>
> The pattern seems to be common enough to be turned into a package.
>
> http://www.haskell.org/haskellwiki/?title=Record_access&action=history
I meant
http://www.haskell.org/haskellwiki/Record_access
More information about the Haskell-Cafe
mailing list