ACM Home Page
Please provide us with feedback. Feedback
Functional pearl: implicit configurations--or, type classes reflect the values of types
Full text PdfPdf (144 KB)
Source Haskell archive
Proceedings of the 2004 ACM SIGPLAN workshop on Haskell table of contents
Snowbird, Utah, USA
SESSION: Session II table of contents
Pages: 33 - 44  
Year of Publication: 2004
ISBN:1-58113-850-4
Authors
Oleg Kiselyov  Fleet Numerical Meteorology and Oceanography Center, Monterey, CA
Chung-chieh Shan  Harvard University, Cambridge, MA
Sponsors
SIGPLAN: ACM Special Interest Group on Programming Languages
ACM: Association for Computing Machinery
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 10,   Downloads (12 Months): 81,   Citation Count: 6
Additional Information:

abstract   references   cited by   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1017472.1017481
What is a DOI?

ABSTRACT

The configurations problem is to propagate run-time preferences throughout a program, allowing multiple concurrent configuration sets to coexist safely under statically guaranteed separation. This problem is common in all software systems, but particularly acute in Haskell, where currently the most popular solution relies on unsafe operations and compiler pragmas.We solve the configurations problem in Haskell using only stable and widely implemented language features like the type-class system. In our approach, a term expression can refer to run-time configuration parameters as if they were compile-time constants in global scope. Besides supporting such intuitive term notation and statically guaranteeing separation, our solution also helps improve the program's performance by transparently dispatching to specialized code at run-time. We can propagate any type of configuration data-numbers, strings, IO actions, polymorphic functions, closures, and abstract data types. No previous approach to propagating configurations implicitly in any language provides the same static separation guarantees.The enabling technique behind our solution is to propagate values via types, with the help of polymorphic recursion and higher-rank polymorphism. The technique essentially emulates local type-class instance declarations while preserving coherence. Configuration parameters are propagated throughout the code implicitly as part of type inference rather than explicitly by the programmer. Our technique can be regarded as a portable, coherent, and intuitive alternative to implicit parameters. It motivates adding local instances to Haskell, with a restriction that salvages principal types.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

 
1
J. Adriano. Re: I need some help. Message to the Haskell mailing list; http://www.mail-archive.com/haskell@haskell.org/msg10565.html, 26 Mar.2002.
 
2
M. Blume. No-longer-foreign: Teaching an ML compiler to speak C "natively". In P. N. Benton and A. Kennedy, editors, BABEL'01: 1st International Workshop on Multi-Language Infrastructure and Interoperability, number 59(1) in Electronic Notes in Theoretical Computer Science, Amsterdam, Nov. 2001. Elsevier Science.
 
3
A. Bromage. Dealing with configuration data. Message to the Haskell mailing list; http://www.haskell.org/pipermail/haskell-cafe/2002-September/003411.html, Sept. 2002.
 
4
M. Chakravarty, S. Finne, F. Henderson, M. Kowalczyk, D. Leijen, S. Marlow, E. Meijer, S. Panne, S. L. Peyton Jones, A. Reid, M. Wallace, and M. Weber. The Haskell 98 foreign function interface 1.0: An addendum to the Haskell 98 report. http://www.cse.unsw.edu.au/~chak/haskell/ffi/, 2003.
 
5
K. Claessen. Dealing with configuration data. Message to the Haskell mailing list; http://www.haskell.org/pipermail/haskell-cafe/2002-September/003419.html, Sept. 2002.
6
 
7
L. Hu et al. Dealing with configuration data. Messages to the Haskell mailing list; http://www.haskell.org/pipermail/haskell-cafe/2002-September/thread.html, Sept. 2002.
 
8
J. Hughes. Restricted datatypes in Haskell. In E. Meijer, editor, Proceedings of the 1999 Haskell Workshop, number UU-CS-1999-28 in Tech. Rep. Department of Computer Science, Utrecht University, 1999.
 
9
 
10
M. P. Jones. Dictionary-free overloading by partial evaluation. In Proceedings of the 1994 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation, New York, 1994. ACM Press.
 
11
 
12
W. Kahan. How Java's floating-point hurts everyone everywhere. Invited talk, ACM 1998 Workshop on Java for High-Performance Network Computing; http://www.cs.ucsb.edu/conferences/java98/papers/javahurt.pdf, 1 Mar. 1998.
 
13
W. Kahl and J. Scheczyk. Named instances for Haskell type classes. In R. Hinze, editor, Proceedings of the 2001 Haskell Workshop, number UU-CS-2001-23 in Tech. Rep., pages 71--99. Department of Computer Science, Utrecht University, 2 Sept. 2001.
 
14
O. Kiselyov. Pure file reading (was: Dealing with configuration data). Message to the Haskell mailing list; http://www.haskell.org/pipermail/haskell-cafe/2002-September/003423.html, Sept. 2002.
 
15
O. Kiselyov and C.-c. Shan. Functional pearl: Implicit configurations-or, type classes reflect the values of types. Technical Report TR-15-04, Harvard University, Cambridge, 2004.
 
16
17
 
18
19
20
 
21
 
22
P. L. Montgomery. Modular multiplication without trial division. Mathematics of Computation, 44(170):519--521, Apr. 1985.
23
 
24
OpenSSL. The open source toolkit for SSL TLS. Version 0.9.7d; http://www.openssl.org/, 17 Mar. 2004.
 
25
 
26
S. L. Peyton Jones. Solution to the monomorphism restriction implicit parameter problem. Message to the Haskell mailing list; http://www.haskell.org/pipermail/haskell/2003-August/012412.html, 5 Aug. 2003.
 
27
S. L. Peyton Jones and M. B. Shields. Lexically-scoped type variables, Mar. 2002. To be submitted to Journal of Functional Programming.
 
28
 
29
G. Russell. Initialisation without unsafePerformIO. Message to the Haskell mailing list; http://www.haskell.org/pipermail/haskell/2004-June/014104.html, June 2004.
 
30
 
31
D. Thurston. Modular arithmetic. Messages to the Haskell mailing list; http://www.haskell.org/pipermail/haskell-cafe/2001-August/002132.html; http://www.haskell.org/pipermail/haskell-cafe/2001-August/002133.html, 21 Aug. 2001.
32
33


Collaborative Colleagues:
Oleg Kiselyov: colleagues
Chung-chieh Shan: colleagues