Haskell中的模块,包和库有什么区别? [英] What's the difference between module, package and library in Haskell?
问题描述
Haskell中的模块,包和库有什么区别?
From http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html
前奏:标准模块 strong>默认导入到所有Haskell模块中。
From http://www.haskell.org/haskellwiki/Base_package
基础软件包:基础软件包包含Prelude及其支持库,以及大型收集有用的库,从数据结构到解析组合器和调试工具。
谢谢。
模块是一组函数,类型,类,...放在一个通用名称空间中。
library 是一组模块,它们可以合在一起并可以在程序或其他库中使用。
A 软件包是可以包含库或可执行文件或两者的分发单元。这是一种将你的代码与社区分享的方式。
请注意,一个库不一定要在一个包中隔离。也就是说,在项目中使用项目中的库是完全可以接受的。为了清晰和可维护性,代码与其余部分是分开的。这也是从业务逻辑代码中分离出一些通用目标的好方法,这个lib最终可以在项目之间或与社区共享(如果需要的话)提取和共享。
What's the difference between module, package and library in Haskell?
From http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html
Prelude: a standard module imported by default into all Haskell modules.
From http://www.haskell.org/haskellwiki/Base_package
Base package: The base package contains the Prelude and its support libraries, and a large collection of useful libraries ranging from data structures to parsing combinators and debugging utilities.
Thanks.
See also: What's the difference between a Python module and a Python package?
A module is a set of functions, types, classes, ... put together in a common namespace.
A library is a set of modules which makes sense to be together and that can be used in a program or another library.
A package is a unit of distribution that can contain a library or an executable or both. It's a way to share your code with the community.
Note that a library doesn't have to be in isolation in a package. That is, it's perfectly acceptable to have a library in your project that is used inside this project. The code is therefore seperated from the rest for clarity and maintainability. This is also a good way to isolate some general-purpose from your business logic code and this lib could eventually be extracted and shared between projects or with the community if needed.
这篇关于Haskell中的模块,包和库有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!