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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With