Andreas C. Doering <[EMAIL PROTECTED]> writes:

 > 
 > I would like to have a comparison instruction that compares the internal
 > reference of two objects. 
 > Let's call it "req".
 > 
 > req :: a -> a -> Bool
 > 
 > -- of course it is an equivalence operation
 > req x x = True 
 > req x y = req y x 
 > (req x y) && (req y z) ==> req x z 
 > 
 > req x y = false does NOT imply that x and y are different, only that 
 > they are represented differently. 
 > 

Constructive/destructive ;-) proposal;

> referentially_equal :: a -> a -> IO Bool

Because it means interaction with the real world of implementation.
Perhaps put it in IOExts.


Then one might go along to define (for oneself):

> req :: a -> a -> Bool
> req a b = unsafePerformIO (referentially_equal a b)

But one should be forced to make oneself aware of the unsafePerformIO inside,
and of the non-standard language features this implies ...



Cheers,

Wolfram


Reply via email to