Just do It: Simple Monadic Equational Reasoning

被引:14
作者
Gibbons, Jeremy [1 ]
Hinze, Ralf [1 ]
机构
[1] Univ Oxford, Dept Comp Sci, Oxford OX1 3QD, England
基金
英国工程与自然科学研究理事会;
关键词
Languages; Theory; Verification; Monads; equational reasoning; Lawvere theories; algebraic specification; PROBABILITY;
D O I
10.1145/2034574.2034777
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
One of the appeals of pure functional programming is that it is so amenable to equational reasoning. One of the problems of pure functional programming is that it rules out computational effects. Moggi and Wadler showed how to get round this problem by using monads to encapsulate the effects, leading in essence to a phase distinction-a pure functional evaluation yielding an impure imperative computation. Still, it has not been clear how to reconcile that phase distinction with the continuing appeal of functional programming; does the impure imperative part become inaccessible to equational reasoning? We think not; and to back that up, we present a simple axiomatic approach to reasoning about programs with computational effects.
引用
收藏
页码:2 / 14
页数:13
相关论文
共 40 条
[1]  
[Anonymous], P 29 ACM SIGPLAN SIG
[2]  
[Anonymous], 1963, THESIS COLUMBIA U
[3]  
Benton N, 2002, LECT NOTES COMPUT SC, V2395, P42
[4]   Recursive monadic bindings [J].
Erkök, L ;
Launchbury, J .
ACM SIGPLAN NOTICES, 2000, 35 (09) :174-185
[5]   Probabilistic functional programming in Haskell [J].
Erwig, M ;
Kollmansberger, S .
JOURNAL OF FUNCTIONAL PROGRAMMING, 2006, 16 (21-34) :21-34
[6]   A Categorical Approach to Probability Theory [J].
Fric, Roman ;
Papco, Martin .
STUDIA LOGICA, 2010, 94 (02) :215-230
[7]  
GIBBONS J, 2011, EFFECTIVE R IN PRESS
[8]  
Goncharov S, 2009, LECT NOTES COMPUT SC, V5728, P18, DOI 10.1007/978-3-642-03741-2_3
[9]  
Hinze R., 2001, International Journal of Foundations of Computer Science, V12, P125, DOI 10.1142/S0129054101000436
[10]  
HOARE CAR, 1985, Z MATH LOGIK, V31, P173, DOI 10.1002/malq.19850310905