[Haskell-cafe] Announce: EnumMap-0.0.1
David Menendez
dave at zednenem.com
Wed Aug 12 11:34:06 EDT 2009
On Wed, Aug 12, 2009 at 9:16 AM, John Van Enk<vanenkj at gmail.com> wrote:
> On Wed, Aug 12, 2009 at 2:09 AM, Ketil Malde<ketil at malde.org> wrote:
>>
>> And perhaps also note that you will get exceptions for values outside
>> the Enum range.
>>
>
> I'd think that part is obvious.
That depends on what "outside the Enum range" means. You'll get an
exception if you somehow get an Int key in the map which doesn't
correspond to any value in the enum, but you don't get an exception if
you try to pass in, say, a large Integer.
Prelude> fromEnum (2^32)
0
In essence, you're using Enum as a hash function, but not making any
provision for hash collisions.
--
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
More information about the Haskell-Cafe
mailing list