简体   繁体   English

Haskell中有哪些抽象数据类型?它们与代数数据类型有何不同?

[英]What are some Abstract Data Types in Haskell and how do they differ from Algebraic Data Types?

Haskell中的抽象数据类型有哪些示例?它们与代数数据类型有何具体区别?

Abstract data types do not export their implementation, instead preferring to export functions that can be used to build and consume them. 抽象数据类型不导出其实现,而是倾向于导出可用于构建和使用它们的函数。 There are many fantastic and oft-used examples in the containers package; containers包装中有许多很棒且经常使用的示例。 the Map type sprung immediately to mind as a type with a very rich API but for which you are not permitted to see the implementation details. Map类型立即浮现为具有非常丰富的API的类型,但是您不允许查看其实现详细信息。 The Set , Seq , and specialized IntMap and IntSet types are all also abstract. SetSeq和专用的IntMapIntSet类型也都是抽象的。

All Haskell types are algebraic -- this just means they are all constructed from sums, products, function types, and recursion. 所有Haskell类型都是代数的-这仅表示它们都是由求和,乘积,函数类型和递归构造的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM