Haskell Language Modules

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • module Name where -- export all names declared in this file

  • module Name (functionOne, Type (..)) where -- export only functionOne, Type, and Type's constructors

  • import Module -- import all of Module's exported names

  • import qualified Module as MN -- qualified import

  • import Module (justThisFunction) -- import only certain names from a module

  • import Module hiding (functionName, Type) -- import all names from a module except functionName and Type

Remarks

Haskell has support for modules:

  • a module can export all, or a subset of its member types & functions

  • a module can "re-export" names it imported from other modules

On the consumer end of a module, one can:

  • import all, or a subset of module members

  • hide imports of a particular member or set of members

haskell.org has a great chapter on module definition.



Got any Haskell Language Question?