On Wed, 2007-06-20 at 11:36 -0400, Brent Yorgey wrote: > On 6/19/07, Brent Yorgey <[EMAIL PROTECTED]> wrote: > I've started developing a library to support a "Perl-style" > numeric type that "does the right thing" without having to > worry too much about types... > > So, I just completed my implementation and decided to test it out by > converting a simple program I wrote the other day (which exhibited > lots of fromIntegers and such) to use my generic number type. When I > was done converting, the code looked much simpler, which was nice. It > type-checked and compiled just fine. And... didn't work. After a > number of minutes of fiddling around, I finally realized that > something which I "knew" was an integer was actually being represented > as a Double internally due to some operator I had used previously, > which was causing the isSquare function to always return False > (equality of floating-point numbers and all that =P ). Adding a call > to "round" fixed it, BUT I sheepishly realized that yes, I had just > spent five minutes tracking down a bug that the type checker would > have found for me had I not worked so hard to do stuff behind its > back. > > Consider me chastened! *goes off to contribute to that wiki page that > Henning started...*
Well... that was entertaining. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe