[Haskell-cafe] Why the Prelude must die
mgsloan at gmail.com
Sun Mar 25 03:18:36 EDT 2007
On 3/24/07, Vivian McPhail <vivian.mcphail at paradise.net.nz> wrote:
> I agree with Sven, but...
> 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
> 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
> programs, data types, and functions would be enhanced.
One problem with that is that the instances are often times not
mathematically sound - Int and Double certainly aren't.
Anyway, I agree with the general gist of this idea. However, I think rather
than the Prelude, we should just be an interface to the internal stuff, a
'Builtin' module. Actually, there could still be a prelude - it would
contain all the common imports (to maintain our decent scores in golf
competitions :) ).
I also like the idea that the addition of a module line would remove the
implicit prelude import - the source code has become 'proper'. Before the
module line, the programmer is probably in quick-hack/script mode.
Numeric prelude-ness would be good. This brings up an issue - would the
numeric classes need to be included/imported in Builtin? To avoid this, I
think a bit of evillness (depending on your perspective, i suppose) is
necessary - builtin functions would be stuff like AddInts and AddDoubles,
not (+). The numeric stuff that provides the classes would also provide
instances to wrap the builtin stuff.
Hmm, just realized that PreludeBuiltin already exists... Ahwell, I think
the renaming is a good idea - classes should not be involved in the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe