Implicit Function Arguments

What do people think about implicit function argument? That is, named function arguments, possibly tagged with something special like a tilde, whereby scoped variables of the same name are automatically passed. The idea is to avoid the pain of a lots of pass through parameters while make it easy to modify one or two of them. For example, in f1 :: ~state::State -> Input -> Output f1 input = f2 input f2 :: ~state::State -> Input -> Output f2 input = <whatever> we don't have to specify ~state for f2 because it picks it up automatically from ~state being in scope from f1. To change it, however, we just do f1 :: ~state::State -> Input -> Output f1 input = f2 input where ~state = <whatever> The advantage over wrapping it in a monad being: 1) it is evident what is being passed around behind the scenes from the type signatures, and 2) we avoiding the lifting issue (to compose multiple implicit arguments we just specifying them -- assuming their are no name clashes). Cheers! -Tyson

On 2008 Jun 28, at 12:32, Tyson Whitehead wrote:
What do people think about implicit function argument?
http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extension... It uses ? as the prefix instead of ~ (which already has a meaning in pattern matching). I am under the impression they are deprecated and slated for removal. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

I am under the impression they are deprecated and slated for removal.
This is the second time I have seen someone comment on implicit parameters being planned for removal, so now you have my attention :). I'd like to mention that a rather large project where I work (Galois, Inc.) uses implicit parameters a lot, so removing support for them would make me rather unhappy. - Phil

On 2008 Jun 29, at 4:56, Philip Weaver wrote:
I am under the impression they are deprecated and slated for removal.
This is the second time I have seen someone comment on implicit parameters being planned for removal, so now you have my attention :). I'd like to mention that a rather large project where I work (Galois, Inc.) uses implicit parameters a lot, so removing support for them would make me rather unhappy.
Hm, looks like terminology confusion. Implicit parameters are staying. *Linear* implicit parameters were deprecated in 6.6 and seem to be gone now. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

| > This is the second time I have seen someone comment on implicit | > parameters being planned for removal, so now you have my attention :). | > I'd like to mention that a rather large project where I work (Galois, | > Inc.) uses implicit parameters a lot, so removing support for them | > would make me rather unhappy. | | | Hm, looks like terminology confusion. Implicit parameters are | staying. *Linear* implicit parameters were deprecated in 6.6 and seem | to be gone now. Brandon's right. Linear implicit parameters are gone. Opinions differ about (ordinary) implicit parameters, but they are sometimes jolly useful, and don't seem to impose non-local complications on the type system. We have no plans to remove them from GHC. Simon

On Sat, Jun 28, 2008 at 01:00:17PM -0400, Brandon S. Allbery KF8NH wrote:
On 2008 Jun 28, at 12:32, Tyson Whitehead wrote:
What do people think about implicit function argument?
http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extension... It uses ? as the prefix instead of ~ (which already has a meaning in pattern matching).
The solution I might have tried is using StateT and and some kind of HList to pass state so that items can be appended and removed easily.. I didn't knew about this features which makes me aware again about how important it is to not stop learning new features.. I'll have a look at it now Marc
participants (5)
-
Brandon S. Allbery KF8NH
-
Marc Weber
-
Philip Weaver
-
Simon Peyton-Jones
-
Tyson Whitehead