讨论了如何使用Monad解决在纯函数式量子程序设计语言中引入测量函数后违反“引用透明性”的问题
可很好的解决在纯函数式语言中引入命令式语言特征的问题
本文依次给出了范畴论中范畴、函子、自然变换以及Monad的概念
函数式程序设计语言
Monad作为一种构造函数式语言的工具
纯函数式语言不能很好的处理诸如错误处理、状态、I/O等非纯函数式语言的特征
给出了上述概念在Haskell语言中的实现
) Abstract: Generally speaking, pure functional programming language can not deal well with impure features such as notably exception, state and I/O
Monad is a useful tool for introducing imperative features to pure functional programming language
It has tree properties that make it especially useful: modularity, flexibility and isolation
This paper starts by giving the mathematical background of monad by introducing the concept of category, functor, natural transformation and monad respectively
Also, it gives how to describe these concepts in Haskell programming language and the validities of these descriptions
Then it introduces how to define monad, such as Maybe Monad, using Haskell and advantages of using monad when programming
At last it introduces quantum states and its measure function briefly, and discusses how to use monad to solve the “referential transparency” of measure function in quantum pure functional programming language
Keywords: monad;functional programming language;category theory 下载PDF阅读器 PDF全文下载: 初稿 ( 136 ) 作者简介: 通信联系人: 【收录情况】 中国科技论文在线: 朱万海
Monad在程序设计语言中的应用[EB/OL]