What's the difference between module, package and library in Haskell?

后端 未结 1 1927
孤街浪徒
孤街浪徒 2020-12-15 07:49

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 s

相关标签:
1条回答
  • 2020-12-15 08:32

    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.

    0 讨论(0)
提交回复
热议问题