[Haskell-cafe] Why the Prelude must die
Jacques Carette
carette at mcmaster.ca
Sun Mar 25 09:55:16 EDT 2007
Vivian McPhail wrote:
> What I want to push is a 'mathematically sound' numeric prelude. A proper
> numerical prelude should have bona fide mathematical obects like groups,
> rings, and fields underlying common numerical classes. It would be edifying
> to the student who discovered that the particular data type he is using is
> an inhabitant of a known class and can thus take advantage of known
> properties, presupplied as class methods. Reasoning and communication about
> programs, data types, and functions would be enhanced.
>
Yes, except that there are not as many groups, rings and fields out
there as you think. For one thing, Float and Double are not in any of
those. The best you can do with Float and Double is
NonAssociativeAlgebra, which is unlikely to be 'edifying'. At least
Integer is a proper ring. There is only one field that I am aware of in
Haskell (Rational Integer). [Which is sad since Z_p is so easy to code
up, and generally extremely useful].
Some classes would become even more important: monoid, groupoid,
semi-group, loop (semi-group with identity), etc. But all of those are,
to the average programmer (and many a mathematician), just as scary as
Monad.
And personally, the place my semi-groups show up are not in my
data-types, but in my *types*.
Jacques
More information about the Haskell-Cafe
mailing list