[Haskell-cafe] Just for a laugh...
john at repetae.net
Thu May 31 17:25:31 EDT 2007
On Thu, May 31, 2007 at 08:47:28PM +0100, Andrew Coppin wrote:
> My first instinct was to use Data.Bits - but I see no instance for
> Double. (Presumably because performing bitwise operations on a Double is
> a pretty odd thing to want to do.) So my next guess is to do some
> bizzare type system hackery that allows you to transform a Double
> into... whichever integer type is the same size, and proceed from there.
> Does anybody know how to do that?
This reminds me. it would be nice if we could remove the 'Num'
superclass of Bits, having bitwise operations and being a number are
fairly unrelated and having to declare bogus instances is annoying. It
is probably just a holdover from C that we think of them as related.
'Bool' would be a simple example of something that is a good instance
of bits, but not Num.
John Meacham - ⑆repetae.net⑆john⑈
More information about the Libraries