A sample revised prelude for numeric classes

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
12 Feb 2001 07:04:30 GMT

Sun, 11 Feb 2001 16:03:37 -0800, Ashley Yakeley <ashley@semantic.org> pisze:

> Apologies if this has been discussed and I missed it. When it comes to 
> writing a 'geek' prelude, what was wrong with the Basic Algebra Proposal 
> found in <ftp://ftp.botik.ru/pub/local/Mechveliani/basAlgPropos/> ? 
> Perhaps it could benefit from multi-parameter classes?

Let me quote myself why I don't like this proposal:

- It's too complicated.

- Relies on controversial type system features, like undecidable
  instances and overlapping instances.

- Relies on type system features that are not implemented and it's
  not clear if they can be correctly designed or implemented at all,
  like "domain conversions".

- Has many instances that should not exist because the relevant type
  does not have the class property; they return Nothing or fail,
  instead of failing to compile.

- Properties like commutativity cannot be specified in Haskell.
  The compiler won't be able to automatically perform any optimizations
  based on commutativity.

- belongs is strange. IMHO it should always return True for valid
  arguments, and invalid arguments should be impossible to construct
  if the validity can be checked at all.

- Tries to turn a compiled language into an interpreted language.
  FuncExpr, too much parsing (with arbitrary rules hardwired into
  the language), too much runtime checks.

- It's too complicated.

- It's not true that it's "not necessary to dig into mathematics".
  I studied mathematics and did not have that much of algebra.

- I perfer minBound to looking at element under Just under Just under
  tuple of osetBounds.

- Uses ugly character and string arguments that tune the behavior,
  e.g. in syzygyGens, divRem, canFr. I like Haskell98's divMod+quotRem

- Uses unneeded sample arguments, e.g. in toEnum, zero, primes, read.

- Have I said that it's too complicated?

There were lengthy discussions about it...

 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
  ^^                      SYGNATURA ZASTĘPCZA