[Haskell-cafe] Re: Float instance of Data.Bits

Ertugrul Soeylemez es at ertes.de
Fri Jul 9 09:48:19 EDT 2010

Sam Martin <sam.martin at geomerics.com> wrote:

> Is there a particular reason Float, Double, etc do not have instances
> of Data.Bits in the standard libraries? I note the Haskell 2010 report
> doesn't include them either.
> In fact, I'm not actually sure how you'd implement the instance for
> floating point types without having some kind of compiler-specific
> extension, or a c-binding.
> Could anyone fill in my missing knowledge here?

Some operations wouldn't make much sense with Float, for instance the
'complement' function.  What should it return?  Also note that bit
manipulation functions could cover only a small window of the value
range.  So it could happen that x .|. y = x, even though y is nonzero.
Also rotation would be a destructive operation.

Nobody would really need the operations (we have integer types and
UArray Int Bool for bit manipulation), and they would most likely be
very slow.


nightmare = unsafePerformIO (getWrongWife >>= sex)

More information about the Haskell-Cafe mailing list