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

Chris Warburton chriswarbo at googlemail.com
Tue May 6 09:38:17 UTC 2014


Job Vranish <job.vranish at gmail.com> writes:

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

This makes me think of the more widely-known 'parallel OR' operator,
which evaluates its arguments in parallel and returns whichever finishes
evaluating first.

This operator cannot be implemented in Lambda Calculus, but it can in
Haskell (via threads). Unfortunately Googling for 'haskell "parallel
or"' brings up sentence fragments ('...parallel or concurrent...')
rather than a parallel or implementation.

You couldn't use parallel or as-is, since your "fallback" value will
probably evaluate faster than your "real" value most of the time, but it
may give you hints.

Cheers,
Chris


More information about the Haskell-Cafe mailing list