[Haskell-cafe] Re: Improved documentation for Bool

Jonathan Cast jonathanccast at fastmail.fm
Mon Jan 19 17:47:40 EST 2009


On Mon, 2009-01-19 at 20:55 +0000, Andrew Coppin wrote:
> 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,

Again, we don't want to imitate these two!

> 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.

Constantly?  Yeah.  Commonly used names should be short, or abbreviated.
You can't abbreviate type classes.

> 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.

newtype MyFoo = MyWrapsWhatever
  deriving (Eq, Ord, Read, Show, Num, Ix, Data, Typeable)

vs.

newtype MyFoo = MyWrapsWhatever
  deriving (Equality, Order, Read, Show, Number, Index, Data, Typeable)

Yeah.  Count me out.

jcc




More information about the Haskell-Cafe mailing list