2012-08-24 11:08, Simon Marlow skrev:
On 24/08/2012 07:39, Emil Axelsson wrote:
Hi!

Are there any dangers in comparing two StableNames of different type?

   stEq :: StableName a -> StableName b -> Bool
   stEq a b = a == (unsafeCoerce b)

I could guard the coercion by first comparing the type representations,
but that would give me a `Typeable` constraint that would spread
throughout the code.

I think that's probably OK.

OK, good! How about putting this function in the library so that people don't have to hack it up themselves?



It should be safe even if the types are
different, but I presume you expect the types to be the same, since
otherwise the comparison would be guaranteed to return False, right?

No, I want to do observable sharing of heterogeneously typed expressions which means I will be comparing expressions of different type.

/ Emil

_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to