[email protected]
[Top] [All Lists]

[Haskell] Numeric programming on toy problems in Haskell

Subject: [Haskell] Numeric programming on toy problems in Haskell
From: Philip K.F. HÃlzenspies
Date: Mon, 10 Sep 2007 22:39:50 +0200
Dear Tomi, all,

I agree with everyone on this list that there is a good reason for
being picky about numeric types. However, when you're simply trying to
understand a small problem or puzzle, the rather intricate numeric
part of the type system can be prohibitively complex. I'm no Haskell
guru, but I don't consider myself a novice anymore. Still, I tend to
waste time on numeric stuff when trying to understand a simple and
small problem.

To avoid this, I wrote a Number module that provides a type Number
that is of all of the standard numeric type classes. Especially for
toy problems - I keep repeating this, because my Number module is NOT
FIT for production code - it is the lazy man's solution to all the
fuss about numbers. I'm lazy, me like.

You can have a look at the Number module here:


Now, whenever I've hacked together a small program, it nearly always
works. When it doesn't, it generally complains about some numeric
value somewhere. I just stick a "toNumber" in front, et voilÃ! :D


I know, people will want to kill me for putting all numbers back
together in a sluggish single type, but in my defense: aren't we all a
tiny bit lazy every once in a while?
Haskell mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>