How to import a module in Haskell?

devquora
devquora

Posted On: Feb 22, 2018

 

The following are the ways to import a module in Haskell.
  •  Import the functions, which you need: The first thing, which makes your import clearer, is to specify which functions you want to import. The biggest provocation is only to write down the module name in the import. Once you have built a Haskell program of even modest size, then you will surely appreciate the importance of the import section of any source file.
  • Qualifying Imports: After specifying the functions, which you need to import then move on the next way to clarify your imports is to use the qualified keywords. This clearly means that you should prefix every function you use from this module by the name assigned to the module.
  • Organizing your imports: After qualifying imports, then next step is to organize the internal imports from external ones. So which means two list needs to create in the first list will consist of built-in-packages, and 2nd list has modules that are in the codebase itself.
  • Creating the list easy to read -: At last you want to make it easy to read your import list. Write your list in alphabetical order, which helps people find the right module in the list.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Haskell Interview Questions

    Define Haskell?

    Haskell is the advanced functional programming language. Haskell is the language that is built around functions, usin..

    Haskell Interview Questions

    In which language is Haskell written?

    Haskell is written in various languages. It is a general-purpose programming language; Haskell is formed without h..

    Haskell Interview Questions

    Define list? What are the ways to create a list in Haskell?

     A list is a single linked list like one looks in an imperative language, but there is one major important difference..