Results 1 -
2 of
2
Implicit parameters: dynamic scoping with static types
- In POPL’00
, 2000
"... This paper introduces a language feature, called implicit parameters, that provides dynamically scoped variables within a statically-typed Hindley-Milner framework. Implicit parameters are lexically distinct from regular identifiers, and are bound by a special with construct whose scope is dynamic, ..."
Abstract
-
Cited by 70 (3 self)
- Add to MetaCart
This paper introduces a language feature, called implicit parameters, that provides dynamically scoped variables within a statically-typed Hindley-Milner framework. Implicit parameters are lexically distinct from regular identifiers, and are bound by a special with construct whose scope is dynamic, rather than static as with let. Implicit parameters are treated by the type system as parameters that are not explicitly declared, but are inferred from their use. We present implicit parameters within a small call-by-name X-calculus. We give a type system, a type inference algorithm, and several semantics. We also explore implicit parameters in the wider settings of call-by-need languages with overloading, and call-by-value languages with effects. As a witness to the former, we have implemented implicit parameters as an extension of Haskell within the Hugs interpreter, which we use to present several motivating examples. 1 A Scenario: Pretty Printing You have just finished writing the perfect pretty printer. It takes as input a document to be laid out, and produces a string. pretty:: Dot-> String You have done the hard part-your code is lovely, concise and modular, and your pretty printer produces output that is somehow even prettier than anything you would bother to do by hand. You’re thinking: JFP: Functional Pearl. But, there are just a few fussy details left. For example, you were not focusing on the unimportant details, so you hard-coded the width of the display to be 78 characters. The annoying thing is that the check to see if YOU have exceeded the display width is buried deep within the code.... if i> = 78 then.. permission to make digital or hard copies of all or part ofthis work for PersOXll Or &SSrOOnl USC is granted witllout fee provided that copies are not nn & or distributed for prolit or commercial advantage a$ld that copies bar this notice and the full citation on the first page. ~l‘o cC,py
Relational depth-first-search with applications
- Information Sciences
, 2001
"... We give a relational specification of the depth-first method for searching a directed graph. Then, we present the method as a relational program and sketch a correctness proof. Finally, we consider some classical applications and demonstrate that using the original specification instead of the pro ..."
Abstract
-
Cited by 4 (4 self)
- Add to MetaCart
We give a relational specification of the depth-first method for searching a directed graph. Then, we present the method as a relational program and sketch a correctness proof. Finally, we consider some classical applications and demonstrate that using the original specification instead of the program leads to compact relation-algebraic correctness proofs.

