4 Haskell development with modules, packages, and projects

 

This chapter covers

  • Best practices in structuring programs with modules
  • Using custom preludes
  • Ideas and approaches behind packaging Haskell projects
  • Tools for package and project management

The code in Haskell (data types, function definitions, and so on) is organized into modules. One special module, Prelude, is imported into every module by default and exports the most important definitions. Modules form packages, which may contain libraries intended to be used by other packages, standalone applications, or both. One special package, base, contains the definitions from the standard library (as defined by the Haskell 2010 Language Report, https://www.haskell.org/onlinereport/ haskell2010/) together with GHC-specific additions. Many professional applications require working on many packages at the same time, so packages are organized into projects to allow application development.

4.1 Organizing Haskell code with modules

4.1.1 Module structure, imports and exports, and module hierarchy

4.1.2 Custom Preludes

4.1.3 Example: containers-mini

4.2 Understanding Haskell packages

4.2.1 Packages at the GHC level

4.2.2 Cabal packages and Hackage

4.3 Tools for project development

4.3.1 Dependency management

4.3.2 Haskell projects as a collection of packages

4.3.3 Common project management activities and tools

Summary