]>
Commit | Line | Data |
---|---|---|
a9d77a20 FM |
1 | {-# LANGUAGE FlexibleContexts #-} |
2 | ||
3 | module Text.Edifact.BundleReader.Configuration | |
4 | ( -- * Parsing environment | |
5 | BundleReaderEnv(..) | |
6 | -- * Shortcuts for reading the environment | |
7 | , getTargetRevision | |
8 | , getHome | |
9 | ) where | |
10 | ||
11 | import Text.Edifact.Scaffolder.Commons (MessageCode, Revision) | |
12 | ||
13 | import Control.Monad.Reader.Class (MonadReader, asks) | |
14 | ||
15 | data BundleReaderEnv = BundleReaderEnv { parserRevision :: Revision | |
16 | , specificationHome :: FilePath | |
17 | , bundle :: [FilePath] | |
18 | , messageNames :: [MessageCode] | |
19 | , messagesFiles :: [FilePath] | |
20 | , segmentsFiles :: [FilePath] | |
21 | , compositesFiles :: [FilePath] | |
22 | , simplesFiles :: [FilePath] | |
23 | , codedSimplesFiles :: [FilePath] | |
24 | } | |
25 | ||
26 | getTargetRevision :: MonadReader BundleReaderEnv m => m Revision | |
27 | getTargetRevision = asks parserRevision | |
28 | ||
29 | getHome :: MonadReader BundleReaderEnv m => m FilePath | |
30 | getHome = asks specificationHome |