[Haskell-cafe] Perl-style numeric type

Brent Yorgey byorgey at gmail.com
Tue Jun 19 21:18:32 EDT 2007


Good to know I'm only 15 years behind the times. =)

Well, I think I'll continue with my implementation (at the very least it's
an interesting way to learn about all the numeric classes in the Prelude),
although I'll be interested in your comments when I get around to releasing
it.  I don't expect there would be any fully satisfactory way of doing it,
but I think that has less to do with Haskell than it does with the very
nature of trying to mix up numeric types (Perl's system of numeric types
isn't quite satisfactory either!).

-Brent

On 6/19/07, Lennart Augustsson <lennart at augustsson.net> wrote:
>
> 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 <byorgey at gmail.com> 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 at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070619/d0373041/attachment.htm


More information about the Haskell-Cafe mailing list