[Haskell-cafe] Re: Improved documentation for Bool
Andrew Coppin
andrewcoppin at btinternet.com
Mon Jan 19 15:55:33 EST 2009
Dan Piponi wrote:
> On Mon, Jan 19, 2009 at 11:33 AM, Andrew Coppin
> <andrewcoppin at btinternet.com> wrote:
>
>
>> My only problem with it is that it's called Bool, while every other
>> programming language on Earth calls it Boolean. (Or at least, the languages
>> that *have* a name for it...)
>>
>
> Python: bool
> ocaml: bool
> C++: bool
> C99: bool
> C#: bool
>
Versus Java, Pascal, Smalltalk and Eiffel who all call it Boolean. Oh
well. At least it's pretty obvious what it means.
>> But I'm far more perturbed by names like Eq, Ord, Num, Ix (??), and so on.
>> The worst thing about C is the unecessary abbriviations; let's not copy
>> them, eh?
>>
>
> They're short so they're quick to parse (for a human) and read.
> They're easy to type. If you have a constraint like (Eq a,Num a,Ord
> a,Show a,Ix a) you can see all five type classes at a single glance
> without having to scan your eye across the line. They're highly
> mnemonic in the sense that once I'd learnt what they meant it became
> hard to forget them again. What exactly is wrong with them?
>
Would it really hurt to type a few more keystrokes and say "Equal"?
"Ordered"? "Index"? I don't think so.
Sure, we don't especially want to end up with classes like
StrictlyOrderedAssociativeSet or something, but a few more characters
wouldn't exactly kill you.
But, again, this is too difficult to change now, so we're stuck with it.
PS. Ord implies Eq, so you don't need both in the same constraint. Num
implies Show, so you don't need that either. So actually, (Ord a, Num a,
Ix a) - or rather, (Ordered a, Number a, Index a) - would do just fine.
More information about the Haskell-Cafe
mailing list