[Haskell-cafe] Re: Announce: EnumMap-0.0.1

Job Vranish jvranish at gmail.com
Mon Aug 10 14:11:16 EDT 2009

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
fromEnum (2.0 :: Double) == 2
fromEnum (2.5 :: Double) == 2

However I think that is more an issue with the Enum instances than with
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.louis at 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.louis at gmail.com
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090810/55c9463b/attachment.html

More information about the Haskell-Cafe mailing list