[Haskell-cafe] Preventing dereferencing an STRef after taking an action
Timotej Tomandl
timotej.tomandl at gmail.com
Fri Nov 18 03:37:47 UTC 2016
Hi,
is it possible to prevent an STRef passed to one ST action from being
passed further on to another ST action?
I am trying to prevent these usages:
invalid :: STRef s a -> STRef s b -> ST s ()
invalid x y=action1 x y >>=action2 x y
invalid1 :: STRef s a -> STRef s b -> ST s ()
invalid1 x y=action1 x y >>=action2 y
while still being able to do this:
valid :: STRef s a -> STRef s b -> ST s ()
valid x y=action1 x y >>=action2 x
where action1 will modify x and y inplace, but in the end only x will hold
the useful information.
In other words I am trying to make it impossible for any action after
action1 to have a same argument as action1's second argument.
timo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161118/ff3044e0/attachment.html>
More information about the Haskell-Cafe
mailing list