Evaluated -> return (Just x)
>> It would simply return Nothing if the value is BLACKHOLE'd. Of course
>> it may be helpful to also distinguish the evaluated and unevaluated
>> states. Further, the above simple version allows data-races (it may
>> become blackhole'd right after we evaluate). An extreme version would
>> actively blackhole it to "lock" the thunk... but maybe that's overkill
>> and there are some other good ideas out there.
>
> I'd submit that your latter suggestion is far safer: return Nothing
> unless we successfully blackhole the thunk or find that it's already
> been evaluated. We actually *know* the blocking behavior we'll get,
> and it's behavior we can't easily obtain through any other mechanism
> (eg we'd have to add multiple unsafe indirections through mutable
> cells into the lazy bytestring implementation to obtain the same
> behavior in any other way, and essentially write out the laziness
> longhand losing the benefits of indirection removal and so forth).
>> A mechanism like the proposed should, for example, allow us to consume
>> just as much of a lazy Bytestring as has already been computed by a
>> producer, WITHOUT blocking and waiting on that producer thread, or
>> migrating the producer computation over to our own thread (blowing its
>> cache).
>
> For that you probably want WHNF-or-not detection as well (at least if
> you want to schedule streaming of computation.