[Haskell-cafe] Top Level etc.

Benjamin Franksen benjamin.franksen at bessy.de
Wed Jan 19 15:49:11 EST 2005


On Wednesday 19 January 2005 21:20, Jorge Adriano Aires wrote:
> > Perhaps one could have top-level implicit parameters (or top-level
> > contexts in general):
> >
> > module (?myvar :: IORef Int) => Random where
>
> I suggested something very similar to this some months ago, syntax and all.
> Nice to see I'm not the only one thinking along this lines.

Please note that implicit parameters -- at least as currently implemented in 
GHC -- have a number of severe problems. A good summary was given by Ben 
Rudiak-Gould in 
http://www.mail-archive.com/haskell%40haskell.org/msg15595.html (although in 
a different context):

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

Ben


More information about the Haskell-Cafe mailing list