<div dir="ltr">Hi,<br><div><br>after thinking about it a bit, I think it might be necessary to provide more context, so I opened an issue in my toy project this relates to:<br><br><a href="https://github.com/formrre/soft-heap-haskell/issues/5" target="_blank">https://github.com/formrre/sof<wbr>t-heap-haskell/issues/5</a><br><div><div><div class="gmail_extra"><br>--<br></div><div class="gmail_extra"> Timo<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 21, 2017 at 5:52 AM, Timotej Tomandl <span dir="ltr"><<a href="mailto:tomandltimotej@gmail.com" target="_blank">tomandltimotej@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>As the title says.<br></div><div><br>Motivation:<br><div style="margin-left:40px">in a mutable code I want to keep some parameters strictly immutable, i.e. not sharing s with the whole mutable type<br></div></div><div><br>I think this is best illustrated by 2 examples:<br><div style="margin-left:40px">1. abstract example:<br></div><div style="margin-left:80px">imagine I have a type<br></div><div style="margin-left:80px"><div style="margin-left:40px">X a b c<br></div></div><div style="margin-left:80px">and another type<br></div><div style="margin-left:80px"><div style="margin-left:40px">Y a b<br></div></div><div style="margin-left:80px">and I want to prevent any case where the first parameter of X "a" is shared with it's third parameter "c" i.e. X a b (Y a a), X a b (Y a b), X a b (Y b a), X a b (Y a d) etc., any nestings in Y referencing a etc.<br></div><div style="margin-left:40px"><div style="margin-left:40px">but allow<br></div></div><div style="margin-left:40px"><div style="margin-left:40px"><div style="margin-left:40px">X a b (Y b b), X a b (Y b c)<br>and any other combination not ruled out above<br></div></div></div><div style="margin-left:40px">2. concrete example:<br></div><div style="margin-left:40px"><div style="margin-left:40px">imagine I have a type:<br></div></div><div style="margin-left:80px"><div style="margin-left:40px">Item s element key<br></div></div><div style="margin-left:40px"><div style="margin-left:40px">where s is used in the same way as in STRef s a, i.e. it cannot leak outside of a certain context, but I want the key to be immutable i.e. independent of s under any circumstences, so I can't write a type like:<br></div></div><div style="margin-left:40px"><div style="margin-left:40px"><div style="margin-left:40px">Item s element (STRef s refType)<br></div></div></div><div style="margin-left:40px"><div style="margin-left:40px">this is equivalent to disallowing X a b (Y a d) in 1.<br></div></div><div style="margin-left:40px"><br></div>Is there any way to write a restriction like this in Haskell?<br><br>--<br></div><div>  Timo<br></div></div>
</blockquote></div><br></div></div></div></div></div>