Take monadic type out of the Context module to wait for Module data structure to be defined and enhanced with priorities and all

This commit is contained in:
Tissevert 2020-01-01 10:16:15 +01:00
parent 12fb295610
commit 7cf2f84dae
1 changed files with 1 additions and 7 deletions

View File

@ -1,14 +1,11 @@
module Context ( module Context (
CodePath(..) CodePath(..)
, Context(..) , Context(..)
, Contextual
, Path(..) , Path(..)
, packages , packages
) where ) where
import Control.Monad.RWS (RWST)
import Data.List (intercalate) import Data.List (intercalate)
import Data.Map (Map)
import System.Directory (doesDirectoryExist) import System.Directory (doesDirectoryExist)
import System.Environment (lookupEnv) import System.Environment (lookupEnv)
import System.FilePath ((</>)) import System.FilePath ((</>))
@ -17,17 +14,14 @@ import Text.ParserCombinators.ReadP (char, munch, sepBy)
import Text.ParserCombinators.ReadPrec (lift) import Text.ParserCombinators.ReadPrec (lift)
import Text.Read (readPrec) import Text.Read (readPrec)
newtype Path = Path [String] newtype Path = Path [String] deriving (Eq, Ord)
newtype CodePath = CodePath [FilePath] newtype CodePath = CodePath [FilePath]
type Dependencies = Map Path [Path]
data Context = Context { data Context = Context {
codePaths :: CodePath codePaths :: CodePath
, mainModule :: Path , mainModule :: Path
} }
type Contextual = RWST Context [String] Dependencies IO
instance Show Path where instance Show Path where
show (Path components) = intercalate "." components show (Path components) = intercalate "." components