McBear Holden
McBear Holden

Reputation: 5901

How to implicitly import a module

Module A import Data.Char

Module B imports Module A

So Module B automatically imports Data.Char ?

If not do I need to explicitly import Data.Char in Module A?

In my program, the Module B can not access the types from Data.Char

Upvotes: 4

Views: 310

Answers (2)

cassandracomar
cassandracomar

Reputation: 1519

You can export Data.Char from module A.

module A (
    -- ... other functions
    module Data.Char
    -- ... other functions
) where

import Data.Char

Now when you import A, Data.Char will be available.

Upvotes: 13

Lee Duhem
Lee Duhem

Reputation: 15121

If you want to access functions and types from Data.Char in your module B, you need to import Data.Char in it, unless the module A you already imported re-exported those functions and/or types that you need in module B.

The import of Data.Char in module A is just for that module itself.

Upvotes: 0

Related Questions