Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 462
Matt Elson Avatar asked Jun 08 '13 09:06

Matt Elson


1 Answers

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.

like image 99
tomferon Avatar answered Sep 28 '22 02:09

tomferon