I'm not exactly sure what you mean by preserve order, but no, Doubles would not behave as expected in an EnumMap because fromEnum for Doubles just truncates: fromEnum (2.0 :: Double) == 2 fromEnum (2.5 :: Double) == 2
However I think that is more an issue with the Enum instances than with EnumMap. I really don't think Double should be an instance of Enum. (or if it is, it should actually _enumerate_ the values) It's basically just there for the list comprehension syntax. take 5 [1.0 ..] :: [Double] == [1.0,2.0,3.0,4.0,5.0] But I feel like that would be better handled with Num instances or something, or with a separate typeclass. - Job On Mon, Aug 10, 2009 at 1:37 PM, Louis Wasserman <wasserman.lo...@gmail.com>wrote: > Pardon my asking, but are fromEnum and toEnum guaranteed to preserve order > on types like Double? I'd like to see a Double-backed Patricia tree map, > but are we certain that EnumMap as presented will behave properly on such > types? > > Louis Wasserman > wasserman.lo...@gmail.com > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe