<div dir="ltr">Sorry! I phrased my question very pooryl and/or was not clear on what I exactly I had difficulty with.<br><br>I have an external "machine" M, with some states and two IO actions that operate on M - A and B. A changes the state of the machine to "ready", and I want to enforce at the type level that B is always executed when M is "ready". I could normally do something like this by adding a phantom parameter to M, to track it's state and allow B to only be called with M "ready". This is fine, and I could use an indexed monad to not have to pass around M explicitly. However I cannot figure out how to enforce something like this when dealing with multiple threads, with more than one potentially executing A and/or B (changing the state or requiring the state to be changed).<br><br>=======<br>Georgi</div>