Embracing causality in fault reasoning
Artificial Intelligence
Computational lambda-calculus and monads
Proceedings of the Fourth Annual Symposium on Logic in computer science
The essence of functional programming
POPL '92 Proceedings of the 19th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
ESOP'92 Symposium proceedings on 4th European symposium on programming
POPL '94 Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages
ICFP '97 Proceedings of the second ACM SIGPLAN international conference on Functional programming
Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
A lattice model of secure information flow
Communications of the ACM
Stochastic lambda calculus and monads of probability distributions
POPL '02 Proceedings of the 29th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Principal type-schemes for functional programs
POPL '82 Proceedings of the 9th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Information flow inference for ML
ACM Transactions on Programming Languages and Systems (TOPLAS)
Journal of Functional Programming
A monadic analysis of information flow security with mutable state
Journal of Functional Programming
Encoding Information Flow in Haskell
CSFW '06 Proceedings of the 19th IEEE workshop on Computer Security Foundations
Coercions in a polymorphic type system
Mathematical Structures in Computer Science
A library for light-weight information-flow security in haskell
Proceedings of the first ACM SIGPLAN symposium on Haskell
Embedded Probabilistic Programming
DSL '09 Proceedings of the IFIP TC 2 Working Conference on Domain-Specific Languages
A theory of typed coercions and its applications
Proceedings of the 14th ACM SIGPLAN international conference on Functional programming
Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Information flow enforcement in monadic libraries
Proceedings of the 7th ACM SIGPLAN workshop on Types in language design and implementation
Embedding dynamic dataflow in a call-by-value language
ESOP'06 Proceedings of the 15th European conference on Programming Languages and Systems
Type-directed automatic incrementalization
Proceedings of the 33rd ACM SIGPLAN conference on Programming Language Design and Implementation
Verifying higher-order programs with the dijkstra monad
Proceedings of the 34th ACM SIGPLAN conference on Programming language design and implementation
Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
Extensible effects: an alternative to monad transformers
Proceedings of the 2013 ACM SIGPLAN symposium on Haskell
Hi-index | 0.00 |
Many useful programming constructions can be expressed as monads. Examples include probabilistic modeling, functional reactive programming, parsing, and information flow tracking, not to mention effectful functionality like state and I/O. In this paper, we present a type-based rewriting algorithm to make programming with arbitrary monads as easy as using ML's built-in support for state and I/O. Developers write programs using monadic values of type m τ as if they were of type τ, and our algorithm inserts the necessary binds, units, and monad-to-monad morphisms so that the program type checks. Our algorithm, based on Jones' qualified types, produces principal types. But principal types are sometimes problematic: the program's semantics could depend on the choice of instantiation when more than one instantiation is valid. In such situations we are able to simplify the types to remove any ambiguity but without adversely affecting typability; thus we can accept strictly more programs. Moreover, we have proved that this simplification is efficient (linear in the number of constraints) and coherent: while our algorithm induces a particular rewriting, all related rewritings will have the same semantics. We have implemented our approach for a core functional language and applied it successfully to simple examples from the domains listed above, which are used as illustrations throughout the paper.