[Haskell-cafe] Type information in MVars

Georgi Lyubenov godzbanebane at gmail.com
Sun Apr 28 10:53:57 UTC 2019


Sorry! I phrased my question very pooryl and/or was not clear on what I
exactly I had difficulty with.

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).

=======
Georgi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190428/47025690/attachment.html>


More information about the Haskell-Cafe mailing list