imatahi
imatahi

Reputation: 651

Importing a number of modules at once

I have a number of modules under the same folder:

/src/Web/MyLib/Types/Entity1.hs
/src/Web/MyLib/Types/Entity2.hs
/src/Web/MyLib/Types/Entity3.hs

...

Most of them require importing the same modules such as Data.Time, UUID and others. Instead of importing those models to each of the modules under /src/Web/MyLib/Types/, is there any way to create one base module, say, /src/Web/MyLib/Types/Base.hs, import all those modules (Data.Time, UUID, ...) to it and then only import Base to EntityX? I've tried it and failed. Maybe I did something wrong.

Upvotes: 1

Views: 71

Answers (1)

chi
chi

Reputation: 116139

Here's an example, taken from Control.Lens, which achieves what you want: it imports everything in a base module and re-exports everything.

module Control.Lens
  ( module Control.Lens.At
  , module Control.Lens.Cons
  , module Control.Lens.Each
  -- ...
  ) where

import Control.Lens.At
import Control.Lens.Cons
import Control.Lens.Each
-- ...

Upvotes: 3

Related Questions