[Haskell] Re: Parameterized Show
George Russell
ger at informatik.uni-bremen.de
Tue Nov 16 06:20:37 EST 2004
Ben Rudiak-Gould wrote (snipped):
> If more than one dictionary is allowed per type, this correspondence
> breaks down, and all hell breaks loose as a result. We've already seen
> this happen with implicit parameters. In a program with implicit
> parameters:
>
> * Beta conversion no longer preserves semantics.
>
> * The monomorphism restriction is no longer a restriction: it
> sometimes silently changes the meaning of a program.
>
> * Adding type signatures for documentation is no longer safe, since
> they may silently change the behavior of the program.
>
> * It's not even safe in general to add a signature giving the same
> type that the compiler would infer anyway: there are (common) cases in
> which this too changes the program's meaning. I ran into this quite by
> accident the first time I tried to use implicit parameters, and it was
> enough to scare me away from ever trusting them again.
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.
The other objections don't bother me either; I add type signatures always
for external functions (and would be quite happy if not doing so were an error).
> Since it hasn't been mentioned yet I should also point people once again
> to "Functional Pearl: Implicit Configurations" by Oleg and Chung-chieh
> Shan, which ingeniously uses polymorphic recursion to construct type
> class instances at run time. If there's a safe and sane way to add local
> dictionaries to the language, it's probably along those lines.
It is very ingenious to encode complex configuration information by chains of types, but
it is something I recoil from in horror.
More information about the Haskell
mailing list