Re: Remove Enum from Float and Double

2013-06-12 Thread harry
Johan Tibell johan.tibell@... writes:

 If we truly believe that the instance is dangerous for users (and not
merely for people who don't understand floating point arithmetic on
computers), then we should add a deprecation pragma to the instance and
discourage its use. But what would the deprecation message encourage
instead, for users to write an explicit loop that tests against some
lower/upper bound? It would have the same problem as enumFromTo. I think the
issue here is really that floating point math on computers is hard to think
about.

The issue is that these instances encourage problematic code. People who
know what they're doing can write whatever they want, but we shouldn't be
handing out unstable explosives on street corners :-)


___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime


Re: Remove Enum from Float and Double

2013-06-12 Thread harry
Tillmann Rendel rendel@... writes:

 In general, I would be against removing features just because they are 
 confusing for beginners. I don't think that's a good design principle 
 for a language that is primarily targeted at professional programmers 
 and computer scientists.

They're confusing to beginners because they don't have consistent or
sensible semantics. That should bother the professional programmers and
computer scientists too!


___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime


Remove Enum from Float and Double

2013-06-11 Thread harry
There have been several discussions over the years regarding Enum instances
for Float and Double. The conclusion each time appears to have been that
there are no instances which are both sane and practical.

I would like to propose that these instances be removed from Haskell 2014.
This may be covered by the various alternative prelude and number class
proposals, but they are much more ambitious and less likely to make it into
the standard in the short term.


___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime


Re: Remove Enum from Float and Double

2013-06-11 Thread harry
Johan Tibell johan.tibell@... writes:

 I don't see much gain. It will break previously working code and the
workaround to the breakage will likely be manually reimplementing enumFromTo
in each instance.

I forgot the main point of my post :-)

The primary motivation for removing these instances is that they cause
endless confusion for beginners, e.g.
http://stackoverflow.com/questions/13203471/the-math-behind-1-0999-in-haskell,
http://stackoverflow.com/questions/9810002/floating-point-list-generator,
http://stackoverflow.com/questions/7290438/haskell-ranges-and-floats,
http://stackoverflow.com/questions/10328435/how-to-solve-floating-point-number-getting-wrong-in-list-haskell,
and many more.

On the other hand, how much working code is there correctly using there
instances?


___
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime