[Haskell-cafe] Designing DSL with explicit sharing [was: I love purity, but it's killing me]

Matthew Naylor mfn-haskell-cafe at cs.york.ac.uk
Wed Feb 13 15:41:29 EST 2008

>   tricky 0 = constant 0
>   tricky d = add e0 e1
>     where
>       (e0, e1) = fork (tricky (d-1))

Oops, I just realised that this isn't a very good example of
expressible sharing!  The problem is that it doesn't take any inputs,
and expressible sharing just collapses (partially evaluates) operators
when they are applied to constants.  A better example would be
something that takes an input, such as

  distrib a [] = []
  distrib a (x:xs) = (a0, x) : distrib a1 xs
      (a0, a1) = fork a


More information about the Haskell-Cafe mailing list