lambda-llama / bitset

A compact functional set data structure
http://hackage.haskell.org/package/bitset
MIT License
13 stars 13 forks source link

Document Enum choice restriction #20

Open treeowl opened 8 years ago

treeowl commented 8 years ago

If fromEnum can produce negative numbers (e.g., if you try to make a BitSet Int), then everything breaks badly (GMP exceptions). As far as I can tell, this is not documented.

superbobry commented 8 years ago

Good catch, this is indeed undocumented.

I wonder if we can use another Enum-like class with non-negative fromEnum function? If not, I guess all we can do is document it and add a check to relevant functions.

treeowl commented 8 years ago

I discovered it by mistake when I tried to make a Data.BitSet.Generic.BitSet Int Word16 and accidentally made a Data.BitSet.Dynamic.BitSet Int.