[Haskell-cafe] Why aren't Float and Double Bounded?
jules at jellybean.co.uk
Wed Nov 28 08:03:11 EST 2007
Josh Lee wrote:
> On Tue, 27 Nov 2007 14:41:59 -0500
> Isaac Dupree <isaacdupree at charter.net> wrote:
>> Henning Thielemann wrote:
>>> On Mon, 26 Nov 2007, Jason Dusek wrote:
>>>> Among numeric types, it seems that only integer types are Bounded.
>>> Maybe because IEEE format supports Infinity?
>> therefore, maxBound is Infinity and minBound negative infinity?
> Using Infinity would go against the meaning of Enum. In the
> Double/Float types, succ and pred mean "add/subtract 1.0", as opposed
> to the unit of least precision. In fact, succ and pred lose meaning
> once the precision of the floats exceeds a certain value.
That's not the meaning of Enum.
That's brokenness :)
It's there so that [1..10] :: [Double] works, but it's a horrible
horrible thing. The overloaded [a..b] notation should not be in Enum but
some other class (I suggest ICanHazInturval as the class name).
More information about the Haskell-Cafe