Recursive monadic bindings

被引:11
作者
Erkök, L [1 ]
Launchbury, J [1 ]
机构
[1] Oregon Grad Inst Sci & Technol, Beaverton, OR 97006 USA
关键词
D O I
10.1145/357766.351257
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Monads have become a popular tool for dealing with computational effects in Haskell for two significant reasons: equational reasoning is retained even in the presence of effects; and program modularity is enhanced by hiding "plumbing" issues inside the monadic infrastructure. Unfortunately, not all the facilities provided by the underlying language are readily available for monadic computations. In particular, while recursive monadic computations can be defined directly using Haskell's built-in recursion capabilities, there is no natural way to express recursion over the values of monadic actions. Using examples, we illustrate why this is a problem, and we propose an extension to Haskell's donotation to remedy the situation. It turns out that the structure of monadic value-recursion depends on the structure of the underlying monad. We propose an axiomatization of the recursion operation and provide a catalogue of definitions that satisfy our criteria.
引用
收藏
页码:174 / 185
页数:12
相关论文
共 22 条
[1]  
[Anonymous], 1989, INTRO ALGORITHMS
[2]  
BJESSE P, 1998, INT C FUNCT PROGR BA
[3]  
Crole R. L., 1990, Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science (90CH2897-7), P489, DOI 10.1109/LICS.1990.113771
[4]  
ERKOK L, RECURSIVE DO HASKEL
[5]  
ERKOK L, 2000, CSE00011 OR GRAD I S
[6]  
FRIEDMAN D, UNPUB RECURSION COMP
[7]  
HASEGAWA M, 1997, LECT NOTES COMPUTER, V1210
[8]   Generalising monads to arrows [J].
Hughes, J .
SCIENCE OF COMPUTER PROGRAMMING, 2000, 37 (1-3) :67-111
[9]  
Jones M. P., 1993, YALEUDCSRR1004
[10]   On embedding a microarchitectural design language within Haskell [J].
Launchbury, J ;
Lewis, JR ;
Cook, B .
ACM SIGPLAN NOTICES, 1999, 34 (09) :60-69