
On 1 Jan 2011, at 12:38, Andreas Baldeau wrote:
Thinking about this there might be one problem:
Without having looked further into this I think perfomance might not be as expected. Using unsafePerformIO affects ghc's optimzations, doesn't it?
So I wonder if it's a good idea (from a performance point of view) to use this.
2010/12/30 Andreas Baldeau
: instance Ord TypeRep where compare t1 t2 = compare (unsafePerformIO (typeRepKey t1)) (unsafePerformIO (typeRepKey t2))
typeRepKey :: TypeRep -> IO Int typeRepKey (TypeRep (Key i) _ _) = return i
So the question is, if ghc could transform this to simply compare the keys throwing away unsafePerformIO and return.
Wouldn't a much better plan simply be to take typeRepKey out of the IO monad? Bob