Re: [Haskell-cafe] Data.Typeable TypeRep Ord instance.

2010-12-30 Thread Serguey Zefirov
2010/12/30 Andreas Baldeau : > instance Ord TypeRep where >    compare t1 t2 = >        compare >            (unsafePerformIO (typeRepKey t1)) >            (unsafePerformIO (typeRepKey t2)) I think it would suffice. Thank you for a tip. ___ Haskell-Cafe

Re: [Haskell-cafe] Data.Typeable TypeRep Ord instance.

2010-12-29 Thread Andreas Baldeau
On 01:08 Sun 05 Dec , Serguey Zefirov wrote: > Why TypeRep does have equality and doesn't have ordering? > > It would be good to have that. I think the problem is, that it's hard to give an ordering that stays the same for all runs of your program. If you don't need this property you could us

Re: [Haskell-cafe] Data.Typeable TypeRep Ord instance.

2010-12-22 Thread John Meacham
On Sat, Dec 4, 2010 at 2:08 PM, Serguey Zefirov wrote: > Why TypeRep does have equality and doesn't have ordering? > > It would be good to have that. Yes, I have wanted that too. It would make maps from types to values possible/efficient. There is a very critical path in jhc that use type-indexed

Re: [Haskell-cafe] Data.Typeable TypeRep Ord instance.

2010-12-04 Thread Serguey Zefirov
2010/12/5 Tianyi Cui : > Why should they? You can compare them in whatever way you like. And there > isn't a natural/inherent sense of total order between types. I cannot compare then the way I'd like. ;) Consider the following: data BiMap a = BiMap { values :: Map Int a ,indices :: Map

Re: [Haskell-cafe] Data.Typeable TypeRep Ord instance.

2010-12-04 Thread Tianyi Cui
Why should they? You can compare them in whatever way you like. And there isn't a natural/inherent sense of total order between types. On Sun, Dec 5, 2010 at 6:08 AM, Serguey Zefirov wrote: > Why TypeRep does have equality and doesn't have ordering? > > It would be good to have that. > > Right n

[Haskell-cafe] Data.Typeable TypeRep Ord instance.

2010-12-04 Thread Serguey Zefirov
Why TypeRep does have equality and doesn't have ordering? It would be good to have that. Right now when I have to order two type representations I convert them to string and then compare. This is somewhat inefficient and not quite straightforward. ___