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