[Haskell] Re: Implicit Parameters

Lauri Alanko la at iki.fi
Thu Mar 2 07:25:31 EST 2006


On Wed, Mar 01, 2006 at 11:53:42AM +0000, Simon Marlow wrote:
> something along these lines is likely to be quite straightforward to
> implement, won't require any changes to the type system, and gives you
> a useful form of implicit parameters without any of the drawbacks.
> 
> The main difference from implicit parameters would be that
> thread-local variables would be restricted to the IO monad.

These two paragraphs sound _heavily_ contradictory to me. The point of
implicit parameters ("fluids" or just "parameters" in Scheme) is that
they provide a controlled form of dynamic scoping without introducing
any stateful mess. Implicit parameters are useful in plain purely
functional code just to make certain values customizable without forcing
them to be propagated explicitely everywhere even though default values
are ok most of the time. Restricting them to the IO monad would severely
undermine their purpose.

Now, I wonder whether we really really really need to track implicit
parameters in the type system. After all, exceptions, too, introduce a
certain amount of impurity yet they work just fine in pure code. 
Couldn't the same kind of semantic trickery that was used in the
imprecise exceptions paper also be applied to Scheme-style parameter
objects?


Lauri


More information about the Haskell mailing list