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.
<br><br> -- Lennart<br><br><div><span class="gmail_quote">On 6/19/07, <b class="gmail_sendername">Brent Yorgey</b> <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br><br>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.<br><br>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.
<br><br>thanks!<br><span class="sg">-Brent<br></span><br>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.<br>
<br>_______________________________________________<br>Haskell-Cafe mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">