摘要
对于泛型程序设计来说,类型的参数化多态是其理论框架,参数化多态引入了类型变量,使得类型参数化,支持类型上的抽象,从而可以大大提高软件的复用程度。泛型编程思想已经在多种语言中得到运用,并已取得了不小的成果。在函数式语言上进行泛型的研究与应用,Haskell语言是函数式语言中较为经典的一种语言,它的计算模型简单,语法清晰,易于编写,易于维护,拥有很大的发展空间。利用一些规则对Haskell语言的语法进行相关扩展,同时引入泛型的思想,研究与运用定义泛型函数的方法,在Haskell语言上实现了泛型功能。
Parametric polymorphism is crucial to generic programming in that it adopts parameterized types and therefore fully supports the abstraction on types and increases the level of software reuse. For the moment, the idea of generic programming has been realized in many languages, which have got great achievement. Haskell is a popu- lar language, and it is functional too. It has a lot of advantages, such as, simple module, clarity syntax, etc. So the programmer can write and modify Haskell sentence easily. This thesis shows the extension of the grammar of Haskell according to some rules, which also introduces the idea of generic programming, and gives some methods to define generic functions. Finally, the function of generic would be completed in Haskell.
出处
《计算机工程与应用》
CSCD
2012年第28期71-76,共6页
Computer Engineering and Applications
关键词
泛型编程
类型抽象
函数式程序设计
语法扩展
generic programming
type abstract
functional programming
grammar extension