I implemented a number type like that in Haskell ca 1992, called noddy numbers (I think John Hughes named them). I don't think I still have them, but it would be easy to do again. Except for the fact that there are so many way you and none of them are quite satisfactory.
-- Lennart On 6/19/07, Brent Yorgey <[EMAIL PROTECTED]> wrote:
Hi all, 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. Explicit static typing of numeric types is really great most of the time, and certainly a good idea for larger projects, but probably everyone's had one of those experiences where you just want to write some simple, "one-off" numeric code that ends up getting cluttered with all sorts of fromIntegers and whatnot just to make the type checker happy. The idea would be to internally use either an Integer, Rational, or Double, and transparently convert between them as necessary. I know I would enjoy having such a numeric type for use in, e.g. programs to solve Project Euler problems. But before I get too far (it looks like it will be straightforward yet tedious to implement), I thought I would throw the idea out there and see if anyone knows of anything similar that has already been done before (a cursory search of the wiki didn't turn up anything). I don't want to reinvent the wheel here. thanks! -Brent PS Also, did anyone get my e-mail to this list of June 8 about Template Haskell and QuickCheck? If you did and it's just that no one knows the answer to my questions, no problem. But I was subscribed in a strange way (through the fa.haskell Google group) and I'm beginning to suspect that perhaps my message never actually got sent over the list. If so I could resend it now that I'm subscribed by more conventional means. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe