[Haskell] Re: Parameterized Show

Benjamin Franksen benjamin.franksen at bessy.de
Fri Nov 19 09:27:08 EST 2004


On Friday 19 November 2004 08:54, Adrian Hey wrote:
> On Tuesday 16 Nov 2004 1:52 pm, Ben Rudiak-Gould wrote:
> > George Russell wrote:
> >  > Sorry, but I like implicit parameters, I use them, and I'm not
> >  > going to stop using them because beta conversion no longer
> >  > preserves semantics.
> >
> > You'll find that many people here don't agree with this view in
> > general (though there's been surprisingly little backlash against
> > implicit parameters in particular).
>
> I would like to lash against them. I was unaware of the problems you
> describe, but their existence doesn't surprise me. In view of the
> controversy that a certain other perfectly safe, reasonable (and
> necessary) language extension proposal has generated recently the
> ready acceptance of this kind of brokeness is surprising. Frankly,
> the idea that anyone would want to jump through hoops to add them to
> a purely functional language sounds bizarre to me. Safe beta
> conversion really ought to be a sacred cow.
>
> Still, at least they're not enabled by default. With any luck we
> won't see too many people shooting themselves in the foot because
> they're too lazy to pass their parameters explicitly.

Implicit parameters are evil, agreed. Their deficiencies should be added 
as a warning to the docs (with many exclamation marks). But toplevel 
things with identity (TWI) are evil as well, *especially* if they are 
easy to use. Implicit parameters at least have the advantage that they 
are obscure and  require changes to function signatures, so that 
(hopefully) not many people use them.

The toplevel '<-' bindings proposal encourages bad library and program 
design by making TWIs easy and (apparently) safe. It is better to make 
people think hard about how to avoid them in the first place. (BTW, 
toplevel stdin, stdout, and stderr are evil too.)

I know of exactly one good reason to use TWIs in Haskell. Which is: to 
interface C libraries that are broken because of the fact that TWIs are 
so easy to create in C.

Introducing TWIs in Haskell is like deliberately spreading a disease 
into an area that has avoided it up to now by strict quarantine 
measures. Of course these measures are often inconvenient and some 
effort is required in order to make communication with the ill populace 
possible. And of course every now and then people come along 
complaining that everything would be easier if one would just remove 
all those decontamination barriers...

Cheers,
Ben


More information about the Haskell mailing list