Re-thread state token around unused mutable reads
From !10097 (closed):
Digression: We could try to track read-only effects separately from write effects to allow the former to be discarded. But in fact we want a more general rewrite for read-only operations: case readOp# state# of (# newState#, _unused_result #) -> body ==> case state# of newState# -> body Such a rewrite is not yet implemented, but would have to be done in a different place anyway.
-
@sgraf812 started a discussion: I think the implication here is that we should be allowed to rewire state token threading around discardable primops. Same same
I think we can implement this relatively easily by building on the mechanism !8956 (closed) added for quotRem
.