<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi Timotej,</p>
<p>I must admit I haven't fully analyzed the problem, but this type
of question intuitively sounds like a job for…<br>
*drumroll*<br>
Type Families! (or his sidekick, functional dependencies)<br>
</p>
<br>
<blockquote
cite="mid:CAEQuBgBWkWtn2ETetCkFUPTW9jgD6Sq3KgChQYpKWc20MkoCZw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div style="margin-left:40px">newtype ST2 r w s a = ST2 {
unwrapST2 :: ST s a }<br>
deriving (Functor)<br>
</div>
<br>
</div>
<div>But as you can see, now all my types got tainted by s even
though sharing the same r or w implies sharing the same s. Is
there a way how to hide s from the type signatures, but still
preserve an ability to write runST2 without resorting to
IO/RealWorld? I have tried writing such a function and failed.<br>
</div>
</div>
</blockquote>
<br>
As I said, I have almost no idea what I'm doing, but maybe you could
get somewhere along the lines of<br>
<br>
<pre> type family StateSupporting reading writing :: *</pre>
<pre> newtype ST2 r w a = ST2 { unwrapST2 :: ST (StateSupporting r w) a }
</pre>
<p>?</p>
<p>Cheers,<br>
MarLinn<br>
</p>
</body>
</html>