[Haskell-cafe] wanted: Function to break circular data dependencies

Job Vranish 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?

- Job
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140504/26754d08/attachment.html>

More information about the Haskell-Cafe mailing list