[Haskell-cafe] Re: Optimization problem

Donald Bruce Stewart dons at cse.unsw.edu.au
Sun Sep 17 21:51:23 EDT 2006


ross:
> On Thu, Sep 14, 2006 at 07:51:59PM +0200, Bertram Felgenhauer wrote:
> > It's a result of thinking about lazy evaluation, and
> > especially lazy patterns (and let bindings) for some time. A wiki article
> > that helped me a lot to understand these is
> > 
> >   http://www.haskell.org/hawiki/TyingTheKnot
> > 
> > I'd like to point out the trustList function there which uses the idea
> > of encoding the structure of a term and its actual values in different
> > arguments, i.e. a blueprint.
> 
> One view of your device is as separating the shape (blueprint) from the
> contents, e.g. one can split a finite map type
> 
> 	data Map k a  = Node !Int k a (Map k a) (Map k a) | Leaf
> 
> into a pair of types
> 
> 	data MapShape k = SNode !Int k (MapShape k) (MapShape k) | SLeaf
> 	data MapData a = DNode a (MapData a) (MapData a) | DLeaf

...

Nice description.

Ross, I added a wiki page for this technique. Would you like to
either elaborate on the wiki, or include the text of your email to it?

    http://haskell.org/haskellwiki/Separating_shape_and_content

Cheers, 
  Don


More information about the Haskell-Cafe mailing list