<div dir="ltr"><div><span style="white-space:nowrap;font-family:arial,sans-serif">Is a function like the following possible?:</span><br></div><div><div style><font face="arial, sans-serif"><span style="white-space:nowrap"><br>

</span></font></div><div style><font face="arial, sans-serif"><span style="white-space:nowrap">avoidCircularDataDependency :: a -> a -> a</span></font></div><div style><font face="arial, sans-serif"><span style="white-space:nowrap">avoidCircularDataDependency a b = ?</span></font></div>

<div style><font face="arial, sans-serif"><span style="white-space:nowrap"><br></span></font></div><div style><font face="arial, sans-serif"><span style="white-space:nowrap">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' .</span></font></div>

<div style><font face="arial, sans-serif"><span style="white-space:nowrap"><br></span></font></div><div style><font face="arial, sans-serif"><span style="white-space:nowrap">I've often found myself wanting a function like this. It would make certain kinds of knot-tying/cycle detection _much_ easier. </span></font></div>

<div style><font face="arial, sans-serif"><span style="white-space:nowrap"><br></span></font></div><div style><font face="arial, sans-serif"><span style="white-space:nowrap">Is there any reason why this function can't/shouldn't exist?</span></font></div>

</div><div style><br></div><div style><font face="arial, sans-serif"><span style="white-space:nowrap"><br></span></font></div><div style><font face="arial, sans-serif"><span style="white-space:nowrap">- Job</span></font></div>

</div>