aboutsummaryrefslogtreecommitdiffhomepage
path: root/scaffolder/src/Text/Edifact/Scaffolder/Root.hs
blob: 54a48d5a224bb056ef94f427d73a3b2091983aab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# LANGUAGE OverloadedLists   #-}
{-# LANGUAGE OverloadedStrings #-}

module Text.Edifact.Scaffolder.Root
  ( rootModule
  ) where

import           Text.Edifact.Scaffolder.Commons

rootModule :: Scaffolding ()
rootModule = getRootModuleName >>= generateRootModule

generateRootModule :: ModuleName -> Scaffolding ()
generateRootModule mn =
  let exports = [ reexportAlias subModulesAlias ]
      subModulesAlias = "S"
      importSubModule sm = ImportAll (ImportAs (mn <.> sm) subModulesAlias)
      subModules = [ "Composites"
                   , "Messages"
                   , "Segments"
                   ]
      imports = [ ImportGroup (importSubModule <$> subModules) ]
  in
    saveHaskellModule mn $
      moduleDeclaration mn exports imports