[Haskell-cafe] wanted: Function to break circular data dependencies
job.vranish at gmail.com
Sun May 4 16:00:47 UTC 2014
Is a function like the following possible?:
avoidCircularDataDependency :: a -> a -> a
avoidCircularDataDependency a b = ?
I want avoidCircularDataDependency to evaluate 'a', but if in the process
of evaluating 'a' its own result is demanded (which normally would result
in an infinite loop) it returns 'b' otherwise it returns 'a' .
I've often found myself wanting a function like this. It would make certain
kinds of knot-tying/cycle detection _much_ easier.
Is there any reason why this function can't/shouldn't exist?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe