Wed, 31 May 2000 13:54:40 +0400 (MSD), S.D.Mechveliani <[EMAIL PROTECTED]> pisze:

> in                                               quotRem, quot, rem,
>                                                  divMod,  div,  mod.
> 
> the latter triplet is unnecessary, if the first has the mode argument.

Mode is unnecessary, better to have separate functions here.

> And we can hardly invent the mode type better than  Char,
> because any specially introduced mode types bring the long names.
> 
>   quotRem 'n' x (-3)   looks better than the pair  quotRem & divMod,

It does not. And since you say you like short names: it's shorter.

I cannot imagine a case where this parameter would not be constant.
In 99% of cases either I know which I want or it does not matter.

Also
    map (`quot` 2)
looks better for me than
    map (\n -> quot 'n' n 2)

Char is bad because Char means a character. Far from a choice of
definition of modulus. It would be a misleading message to the reader.
Types are not only sets of representable bit patterns; they also carry
a meaning. Otherwise Char, Int and Bool would all be one type. In
C they almost are, and that is one of reasons I use Haskell rather
than C.

GHC sometimes uses types like
    data CanItFail = CanFail | CantFail
instead of Bool. Maybe even too rarely: when somebody is writing
a piece of code, he remembers what True or False or -1 mean in a
particular place, but for another person who reads it, it is not
that obvious. Haskell uses LT,EQ,GT instead of an integer <0,==0,>0
(even OCaml uses <0,==0,>0). GHC's Posix module has a separate type
Fd for file descriptor instead of using Ints. Types are good.

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/              GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                  W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                  5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-


Reply via email to