On 20 Apr 2009, at 09:41, Peter Verswyvelen wrote:
I was wandering if it would be possible to optimize unamb by
checking if a value is already evaluated to head normal form.
So
f `unamb` g
would then be extremely fast if either f or g is already evaluated
to head normal form.
Maybe using some vacuum tricks?
This function would need to be in IO since it is of course not
referentially transparent.
Really? Is it any less referentially transparent than unamb already
is - i.e. it's referentially transparent, as long as the two values
really are equal.
Although threads are lightweight in Haskell, forking/waiting/killing
surely must have more overhead than just checking the thunk of an
expression?
Of course one could also make unamb a primitive :-)
That would be a lovely solution for me.
Bob
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe