From cbee146bd7642bd85589920cd6a0c051faa0aa62 Mon Sep 17 00:00:00 2001 From: Paul Cadman Date: Mon, 30 Oct 2023 13:05:52 +0000 Subject: [PATCH] Rename Roots type to Root (#2480) This was suggested by @jonaprieto in https://github.com/anoma/juvix/pull/2458#discussion_r1368476371 - but we deferred it until the Package file PR sequence was merged. --- app/App.hs | 30 ++++++------- app/Commands/Dev/Geb/Repl.hs | 4 +- app/Commands/Repl.hs | 42 +++++++++---------- app/Commands/Repl/Base.hs | 4 +- app/GlobalOptions.hs | 24 +++++------ app/Main.hs | 2 +- src/Juvix/Compiler/Pipeline/EntryPoint.hs | 18 ++++---- src/Juvix/Compiler/Pipeline/EntryPoint/IO.hs | 8 ++-- .../Pipeline/Package/Loader/EvalEff/IO.hs | 22 +++++----- src/Juvix/Compiler/Pipeline/Root.hs | 28 ++++++------- src/Juvix/Compiler/Pipeline/Root/Base.hs | 14 +++---- test/Base.hs | 2 +- 12 files changed, 99 insertions(+), 99 deletions(-) diff --git a/app/App.hs b/app/App.hs index 27f54d4fe..9cbc2a51e 100644 --- a/app/App.hs +++ b/app/App.hs @@ -7,7 +7,7 @@ import Juvix.Compiler.Concrete.Translation.FromParsed.Analysis.PathResolver import Juvix.Compiler.Internal.Translation.FromInternal.Analysis.Termination.Checker import Juvix.Compiler.Pipeline.Run import Juvix.Data.Error qualified as Error -import Juvix.Extra.Paths.Base +import Juvix.Extra.Paths.Base hiding (rootBuildDir) import Juvix.Prelude.Pretty hiding ( Doc, ) @@ -17,7 +17,7 @@ data App m a where ExitMsg :: ExitCode -> Text -> App m a ExitJuvixError :: JuvixError -> App m a PrintJuvixError :: JuvixError -> App m () - AskRoots :: App m Roots + AskRoot :: App m Root AskInvokeDir :: App m (Path Abs Dir) AskPkgDir :: App m (Path Abs Dir) AskBuildDir :: App m (Path Abs Dir) @@ -38,7 +38,7 @@ makeSem ''App data RunAppIOArgs = RunAppIOArgs { _runAppIOArgsGlobalOptions :: GlobalOptions, - _runAppIOArgsRoots :: Roots + _runAppIOArgsRoot :: Root } runAppIO :: @@ -49,7 +49,7 @@ runAppIO :: Sem r a runAppIO args@RunAppIOArgs {..} = interpret $ \case - AskPackageGlobal -> return (_runAppIOArgsRoots ^. rootsPackageGlobal) + AskPackageGlobal -> return (_runAppIOArgsRoot ^. rootPackageGlobal) FromAppPathFile p -> embed (prepathToAbsFile invDir (p ^. pathPath)) GetMainFile m -> getMainFile' m FromAppPathDir p -> embed (prepathToAbsDir invDir (p ^. pathPath)) @@ -59,11 +59,11 @@ runAppIO args@RunAppIOArgs {..} = sup <- Ansi.hSupportsANSIColor stdout renderIO (not (_runAppIOArgsGlobalOptions ^. globalNoColors) && sup) t AskGlobalOptions -> return _runAppIOArgsGlobalOptions - AskPackage -> return (_runAppIOArgsRoots ^. rootsPackage) - AskRoots -> return _runAppIOArgsRoots + AskPackage -> return (_runAppIOArgsRoot ^. rootPackage) + AskRoot -> return _runAppIOArgsRoot AskInvokeDir -> return invDir - AskPkgDir -> return (_runAppIOArgsRoots ^. rootsRootDir) - AskBuildDir -> return (_runAppIOArgsRoots ^. rootsBuildDir) + AskPkgDir -> return (_runAppIOArgsRoot ^. rootRootDir) + AskBuildDir -> return (_runAppIOArgsRoot ^. rootBuildDir) RunCorePipelineEither input -> do entry <- embed (getEntryPoint' args input) embed (corePipelineIOEither entry) @@ -100,9 +100,9 @@ runAppIO args@RunAppIOArgs {..} = <> pack (toFilePath juvixYamlFile) <> " file" ) - invDir = _runAppIOArgsRoots ^. rootsInvokeDir + invDir = _runAppIOArgsRoot ^. rootInvokeDir pkg :: Package - pkg = _runAppIOArgsRoots ^. rootsPackage + pkg = _runAppIOArgsRoot ^. rootPackage g :: GlobalOptions g = _runAppIOArgsGlobalOptions printErr e = @@ -111,22 +111,22 @@ runAppIO args@RunAppIOArgs {..} = getEntryPoint' :: RunAppIOArgs -> AppPath File -> IO EntryPoint getEntryPoint' RunAppIOArgs {..} inputFile = do let opts = _runAppIOArgsGlobalOptions - roots = _runAppIOArgsRoots + root = _runAppIOArgsRoot estdin <- if | opts ^. globalStdin -> Just <$> getContents | otherwise -> return Nothing - set entryPointStdin estdin <$> entryPointFromGlobalOptionsPre roots (inputFile ^. pathPath) opts + set entryPointStdin estdin <$> entryPointFromGlobalOptionsPre root (inputFile ^. pathPath) opts getEntryPointStdin' :: RunAppIOArgs -> IO EntryPoint getEntryPointStdin' RunAppIOArgs {..} = do let opts = _runAppIOArgsGlobalOptions - roots = _runAppIOArgsRoots + root = _runAppIOArgsRoot estdin <- if | opts ^. globalStdin -> Just <$> getContents | otherwise -> return Nothing - set entryPointStdin estdin <$> entryPointFromGlobalOptionsNoFile roots opts + set entryPointStdin estdin <$> entryPointFromGlobalOptionsNoFile root opts someBaseToAbs' :: (Members '[App] r) => SomeBase a -> Sem r (Path Abs a) someBaseToAbs' f = do @@ -144,7 +144,7 @@ askGenericOptions = project <$> askGlobalOptions getEntryPoint :: (Members '[Embed IO, App] r) => AppPath File -> Sem r EntryPoint getEntryPoint inputFile = do _runAppIOArgsGlobalOptions <- askGlobalOptions - _runAppIOArgsRoots <- askRoots + _runAppIOArgsRoot <- askRoot embed (getEntryPoint' (RunAppIOArgs {..}) inputFile) runPipelineTermination :: (Member App r) => AppPath File -> Sem (Termination ': PipelineEff) a -> Sem r a diff --git a/app/Commands/Dev/Geb/Repl.hs b/app/Commands/Dev/Geb/Repl.hs index 6bb177d67..a5f0f5d6d 100644 --- a/app/Commands/Dev/Geb/Repl.hs +++ b/app/Commands/Dev/Geb/Repl.hs @@ -36,14 +36,14 @@ makeLenses ''ReplState runCommand :: (Members '[Embed IO, App] r) => GebReplOptions -> Sem r () runCommand replOpts = do invokeDir <- askInvokeDir - roots <- askRoots + root <- askRoot globalOptions <- askGlobalOptions let getReplEntryPoint :: SomeBase File -> Repl EntryPoint getReplEntryPoint inputFile = do gopts <- State.gets (^. replStateGlobalOptions) absInputFile :: Path Abs File <- replMakeAbsolute inputFile set entryPointTarget Backend.TargetGeb - <$> liftIO (entryPointFromGlobalOptions roots absInputFile gopts) + <$> liftIO (entryPointFromGlobalOptions root absInputFile gopts) embed ( State.evalStateT (replAction replOpts getReplEntryPoint) diff --git a/app/Commands/Repl.hs b/app/Commands/Repl.hs index 15559f89f..bf993bef1 100644 --- a/app/Commands/Repl.hs +++ b/app/Commands/Repl.hs @@ -40,7 +40,7 @@ import Juvix.Data.Effect.Git import Juvix.Data.Effect.Process import Juvix.Data.Error.GenericError qualified as Error import Juvix.Data.NameKind -import Juvix.Extra.Paths +import Juvix.Extra.Paths qualified as P import Juvix.Extra.Stdlib import Juvix.Extra.Version import Juvix.Prelude.Pretty @@ -81,7 +81,7 @@ printHelpTxt opts = do |] replDefaultLoc :: Interval -replDefaultLoc = singletonInterval (mkInitialLoc replPath) +replDefaultLoc = singletonInterval (mkInitialLoc P.replPath) replFromJust :: Repl a -> Maybe a -> Repl a replFromJust err = maybe err return @@ -140,7 +140,7 @@ loadFile f = do loadDefaultPrelude :: Repl () loadDefaultPrelude = whenJustM defaultPreludeEntryPoint $ \e -> do - root <- Reader.asks (^. replRoots . rootsRootDir) + root <- Reader.asks (^. replRoot . rootRootDir) let hasInternet = not (e ^. entryPointOffline) -- The following is needed to ensure that the default location of the -- standard library exists @@ -162,11 +162,11 @@ loadDefaultPrelude = whenJustM defaultPreludeEntryPoint $ \e -> do $ entrySetup defaultDependenciesConfig loadEntryPoint e -getReplEntryPoint :: (Roots -> a -> GlobalOptions -> IO EntryPoint) -> a -> Repl EntryPoint +getReplEntryPoint :: (Root -> a -> GlobalOptions -> IO EntryPoint) -> a -> Repl EntryPoint getReplEntryPoint f inputFile = do - roots <- Reader.asks (^. replRoots) + root <- Reader.asks (^. replRoot) gopts <- State.gets (^. replStateGlobalOptions) - liftIO (set entryPointSymbolPruningMode KeepAll <$> f roots inputFile gopts) + liftIO (set entryPointSymbolPruningMode KeepAll <$> f root inputFile gopts) getReplEntryPointFromPrepath :: Prepath File -> Repl EntryPoint getReplEntryPointFromPrepath = getReplEntryPoint entryPointFromGlobalOptionsPre @@ -197,7 +197,7 @@ replCommand opts input = catchAll $ do eval :: Core.Node -> Repl Core.Node eval n = do - ep <- getReplEntryPointFromPrepath (mkPrepath (toFilePath replPath)) + ep <- getReplEntryPointFromPrepath (mkPrepath (toFilePath P.replPath)) let shouldDisambiguate :: Bool shouldDisambiguate = not (opts ^. replNoDisambiguate) (artif', n') <- @@ -489,12 +489,12 @@ replTabComplete = Prefix (wordCompleter optsCompleter) defaultMatcher printRoot :: String -> Repl () printRoot _ = do - r <- State.gets (^. replStateRoots . rootsRootDir) + r <- State.gets (^. replStateRoot . rootRootDir) liftIO $ putStrLn (pack (toFilePath r)) runCommand :: (Members '[Embed IO, App] r) => ReplOptions -> Sem r () runCommand opts = do - roots <- askRoots + root <- askRoot let replAction :: ReplS () replAction = do evalReplOpts @@ -511,12 +511,12 @@ runCommand opts = do globalOptions <- askGlobalOptions let env = ReplEnv - { _replRoots = roots, + { _replRoot = root, _replOptions = opts } iniState = ReplState - { _replStateRoots = roots, + { _replStateRoot = root, _replStateContext = Nothing, _replStateGlobalOptions = globalOptions } @@ -533,23 +533,23 @@ runCommand opts = do -- | If the package contains the stdlib as a dependency, loads the Prelude defaultPreludeEntryPoint :: Repl (Maybe EntryPoint) defaultPreludeEntryPoint = do - roots <- State.gets (^. replStateRoots) - let buildDir = roots ^. rootsBuildDir - root = roots ^. rootsRootDir - pkg = roots ^. rootsPackage - mstdlibPath <- liftIO (runM (runFilesIO (packageStdlib root buildDir (pkg ^. packageDependencies)))) + root <- State.gets (^. replStateRoot) + let buildDir = root ^. rootBuildDir + buildRoot = root ^. rootRootDir + pkg = root ^. rootPackage + mstdlibPath <- liftIO (runM (runFilesIO (packageStdlib buildRoot buildDir (pkg ^. packageDependencies)))) case mstdlibPath of Just stdlibPath -> Just . set entryPointResolverRoot stdlibPath - <$> getReplEntryPointFromPath (stdlibPath preludePath) + <$> getReplEntryPointFromPath (stdlibPath P.preludePath) Nothing -> return Nothing replMakeAbsolute :: SomeBase b -> Repl (Path Abs b) replMakeAbsolute = \case Abs p -> return p Rel r -> do - invokeDir <- State.gets (^. replStateRoots . rootsInvokeDir) + invokeDir <- State.gets (^. replStateRoot . rootInvokeDir) return (invokeDir r) replExpressionUpToScopedAtoms :: Text -> Repl (Concrete.ExpressionAtoms 'Concrete.Scoped) @@ -561,7 +561,7 @@ replExpressionUpToScopedAtoms txt = do . runError . evalState (ctx ^. replContextArtifacts) . runReader (ctx ^. replContextEntryPoint) - $ expressionUpToAtomsScoped replPath txt + $ expressionUpToAtomsScoped P.replPath txt replFromEither x replExpressionUpToTyped :: Text -> Repl Internal.TypedExpression @@ -573,7 +573,7 @@ replExpressionUpToTyped txt = do . runError . evalState (ctx ^. replContextArtifacts) . runReader (ctx ^. replContextEntryPoint) - $ expressionUpToTyped replPath txt + $ expressionUpToTyped P.replPath txt replFromEither x compileReplInputIO' :: ReplContext -> Text -> IO (Artifacts, (Either JuvixError (Maybe Core.Node))) @@ -582,7 +582,7 @@ compileReplInputIO' ctx txt = . runState (ctx ^. replContextArtifacts) . runReader (ctx ^. replContextEntryPoint) $ do - r <- compileReplInputIO replPath txt + r <- compileReplInputIO P.replPath txt return (extractNode <$> r) where extractNode :: ReplPipelineResult -> Maybe Core.Node diff --git a/app/Commands/Repl/Base.hs b/app/Commands/Repl/Base.hs index 7556223bf..2d9be7300 100644 --- a/app/Commands/Repl/Base.hs +++ b/app/Commands/Repl/Base.hs @@ -19,12 +19,12 @@ data ReplContext = ReplContext } data ReplEnv = ReplEnv - { _replRoots :: Roots, + { _replRoot :: Root, _replOptions :: ReplOptions } data ReplState = ReplState - { _replStateRoots :: Roots, + { _replStateRoot :: Root, _replStateContext :: Maybe ReplContext, _replStateGlobalOptions :: GlobalOptions } diff --git a/app/GlobalOptions.hs b/app/GlobalOptions.hs index f7149d26d..f9c90becf 100644 --- a/app/GlobalOptions.hs +++ b/app/GlobalOptions.hs @@ -139,16 +139,16 @@ parseBuildDir m = do ) pure AppPath {_pathIsInput = False, ..} -entryPointFromGlobalOptionsPre :: Roots -> Prepath File -> GlobalOptions -> IO EntryPoint -entryPointFromGlobalOptionsPre roots premainFile opts = do - mainFile <- prepathToAbsFile (roots ^. rootsInvokeDir) premainFile - entryPointFromGlobalOptions roots mainFile opts +entryPointFromGlobalOptionsPre :: Root -> Prepath File -> GlobalOptions -> IO EntryPoint +entryPointFromGlobalOptionsPre root premainFile opts = do + mainFile <- prepathToAbsFile (root ^. rootInvokeDir) premainFile + entryPointFromGlobalOptions root mainFile opts -entryPointFromGlobalOptions :: Roots -> Path Abs File -> GlobalOptions -> IO EntryPoint -entryPointFromGlobalOptions roots mainFile opts = do +entryPointFromGlobalOptions :: Root -> Path Abs File -> GlobalOptions -> IO EntryPoint +entryPointFromGlobalOptions root mainFile opts = do mabsBuildDir :: Maybe (Path Abs Dir) <- mapM (prepathToAbsDir cwd) optBuildDir let def :: EntryPoint - def = defaultEntryPoint roots mainFile + def = defaultEntryPoint root mainFile return def { _entryPointNoTermination = opts ^. globalNoTermination, @@ -163,13 +163,13 @@ entryPointFromGlobalOptions roots mainFile opts = do where optBuildDir :: Maybe (Prepath Dir) optBuildDir = fmap (^. pathPath) (opts ^. globalBuildDir) - cwd = roots ^. rootsInvokeDir + cwd = root ^. rootInvokeDir -entryPointFromGlobalOptionsNoFile :: Roots -> GlobalOptions -> IO EntryPoint -entryPointFromGlobalOptionsNoFile roots opts = do +entryPointFromGlobalOptionsNoFile :: Root -> GlobalOptions -> IO EntryPoint +entryPointFromGlobalOptionsNoFile root opts = do mabsBuildDir :: Maybe (Path Abs Dir) <- mapM (prepathToAbsDir cwd) optBuildDir let def :: EntryPoint - def = defaultEntryPointNoFile roots + def = defaultEntryPointNoFile root return def { _entryPointNoTermination = opts ^. globalNoTermination, @@ -184,4 +184,4 @@ entryPointFromGlobalOptionsNoFile roots opts = do where optBuildDir :: Maybe (Prepath Dir) optBuildDir = fmap (^. pathPath) (opts ^. globalBuildDir) - cwd = roots ^. rootsInvokeDir + cwd = root ^. rootInvokeDir diff --git a/app/Main.hs b/app/Main.hs index a89240da1..af9e81062 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -18,7 +18,7 @@ main = do mbuildDir <- mapM (prepathToAbsDir invokeDir) (_runAppIOArgsGlobalOptions ^? globalBuildDir . _Just . pathPath) mainFile <- topCommandInputPath cli mapM_ checkMainFile mainFile - _runAppIOArgsRoots <- findRootAndChangeDir (containingDir <$> mainFile) mbuildDir invokeDir + _runAppIOArgsRoot <- findRootAndChangeDir (containingDir <$> mainFile) mbuildDir invokeDir runFinal . resourceToIOFinal . embedToFinal @IO diff --git a/src/Juvix/Compiler/Pipeline/EntryPoint.hs b/src/Juvix/Compiler/Pipeline/EntryPoint.hs index b2fd20fc0..e9a73c826 100644 --- a/src/Juvix/Compiler/Pipeline/EntryPoint.hs +++ b/src/Juvix/Compiler/Pipeline/EntryPoint.hs @@ -45,25 +45,25 @@ data EntryPoint = EntryPoint makeLenses ''EntryPoint -defaultEntryPoint :: Roots -> Path Abs File -> EntryPoint -defaultEntryPoint roots mainFile = - (defaultEntryPointNoFile roots) +defaultEntryPoint :: Root -> Path Abs File -> EntryPoint +defaultEntryPoint root mainFile = + (defaultEntryPointNoFile root) { _entryPointModulePaths = pure mainFile } -defaultEntryPointNoFile :: Roots -> EntryPoint -defaultEntryPointNoFile roots = +defaultEntryPointNoFile :: Root -> EntryPoint +defaultEntryPointNoFile root = EntryPoint - { _entryPointRoot = roots ^. rootsRootDir, - _entryPointResolverRoot = roots ^. rootsRootDir, + { _entryPointRoot = root ^. rootRootDir, + _entryPointResolverRoot = root ^. rootRootDir, _entryPointBuildDir = Rel relBuildDir, _entryPointNoTermination = False, _entryPointNoPositivity = False, _entryPointNoCoverage = False, _entryPointNoStdlib = False, _entryPointStdin = Nothing, - _entryPointPackage = roots ^. rootsPackage, - _entryPointPackageGlobal = roots ^. rootsPackageGlobal, + _entryPointPackage = root ^. rootPackage, + _entryPointPackageGlobal = root ^. rootPackageGlobal, _entryPointGenericOptions = defaultGenericOptions, _entryPointTarget = TargetCore, _entryPointDebug = False, diff --git a/src/Juvix/Compiler/Pipeline/EntryPoint/IO.hs b/src/Juvix/Compiler/Pipeline/EntryPoint/IO.hs index 953b6e017..f400b9943 100644 --- a/src/Juvix/Compiler/Pipeline/EntryPoint/IO.hs +++ b/src/Juvix/Compiler/Pipeline/EntryPoint/IO.hs @@ -7,11 +7,11 @@ import Juvix.Prelude defaultEntryPointCwdIO :: Path Abs File -> IO EntryPoint defaultEntryPointCwdIO mainFile = do cwd <- getCurrentDir - roots <- findRootAndChangeDir (Just (parent mainFile)) Nothing cwd - return (defaultEntryPoint roots mainFile) + root <- findRootAndChangeDir (Just (parent mainFile)) Nothing cwd + return (defaultEntryPoint root mainFile) defaultEntryPointNoFileCwdIO :: IO EntryPoint defaultEntryPointNoFileCwdIO = do cwd <- getCurrentDir - roots <- findRootAndChangeDir Nothing Nothing cwd - return (defaultEntryPointNoFile roots) + root <- findRootAndChangeDir Nothing Nothing cwd + return (defaultEntryPointNoFile root) diff --git a/src/Juvix/Compiler/Pipeline/Package/Loader/EvalEff/IO.hs b/src/Juvix/Compiler/Pipeline/Package/Loader/EvalEff/IO.hs index fd75939b6..44c2eb8c8 100644 --- a/src/Juvix/Compiler/Pipeline/Package/Loader/EvalEff/IO.hs +++ b/src/Juvix/Compiler/Pipeline/Package/Loader/EvalEff/IO.hs @@ -143,20 +143,20 @@ loadPackage' packagePath = do rootPath = parent packagePath packageEntryPoint :: EntryPoint - packageEntryPoint = defaultEntryPoint roots packagePath + packageEntryPoint = defaultEntryPoint root packagePath where - roots :: Roots - roots = - Roots - { _rootsRootDir = rootPath, - _rootsPackageGlobal = False, - _rootsPackage = rootsPkg, - _rootsInvokeDir = rootPath, - _rootsBuildDir = Paths.rootBuildDir rootPath + root :: Root + root = + Root + { _rootRootDir = rootPath, + _rootPackageGlobal = False, + _rootPackage = rootPkg, + _rootInvokeDir = rootPath, + _rootBuildDir = Paths.rootBuildDir rootPath } - rootsPkg :: Package - rootsPkg = + rootPkg :: Package + rootPkg = Package { _packageVersion = defaultVersion, _packageName = "Package", diff --git a/src/Juvix/Compiler/Pipeline/Root.hs b/src/Juvix/Compiler/Pipeline/Root.hs index f65faf01d..45d1aa957 100644 --- a/src/Juvix/Compiler/Pipeline/Root.hs +++ b/src/Juvix/Compiler/Pipeline/Root.hs @@ -14,8 +14,8 @@ findRootAndChangeDir :: Maybe (Path Abs Dir) -> Maybe (Path Abs Dir) -> Path Abs Dir -> - IO Roots -findRootAndChangeDir minputFileDir mbuildDir _rootsInvokeDir = do + IO Root +findRootAndChangeDir minputFileDir mbuildDir _rootInvokeDir = do whenJust minputFileDir setCurrentDir r <- IO.try go case r of @@ -23,7 +23,7 @@ findRootAndChangeDir minputFileDir mbuildDir _rootsInvokeDir = do putStrLn "Something went wrong when looking for the root of the project" putStrLn (pack (IO.displayException err)) exitFailure - Right roots -> return roots + Right root -> return root where possiblePaths :: Path Abs Dir -> [Path Abs Dir] possiblePaths p = p : toList (parents p) @@ -36,22 +36,22 @@ findRootAndChangeDir minputFileDir mbuildDir _rootsInvokeDir = do pFile <- findPackageFile' Paths.packageFilePath return (pFile <|> yamlFile) - go :: IO Roots + go :: IO Root go = do l <- findPackageFile case l of Nothing -> do - _rootsPackage <- readGlobalPackageIO - _rootsRootDir <- runM (runFilesIO globalRoot) - let _rootsPackageGlobal = True - _rootsBuildDir = getBuildDir mbuildDir _rootsRootDir - return Roots {..} + _rootPackage <- readGlobalPackageIO + _rootRootDir <- runM (runFilesIO globalRoot) + let _rootPackageGlobal = True + _rootBuildDir = getBuildDir mbuildDir _rootRootDir + return Root {..} Just yamlPath -> do - let _rootsRootDir = parent yamlPath - _rootsPackageGlobal = False - _rootsBuildDir = getBuildDir mbuildDir _rootsRootDir - _rootsPackage <- readPackageIO _rootsRootDir (CustomBuildDir (Abs _rootsBuildDir)) - return Roots {..} + let _rootRootDir = parent yamlPath + _rootPackageGlobal = False + _rootBuildDir = getBuildDir mbuildDir _rootRootDir + _rootPackage <- readPackageIO _rootRootDir (CustomBuildDir (Abs _rootBuildDir)) + return Root {..} getBuildDir :: Maybe (Path Abs Dir) -> Path Abs Dir -> Path Abs Dir getBuildDir mbuildDirOpt pkgDir = case mbuildDirOpt of diff --git a/src/Juvix/Compiler/Pipeline/Root/Base.hs b/src/Juvix/Compiler/Pipeline/Root/Base.hs index c6415b659..b6dda6bd9 100644 --- a/src/Juvix/Compiler/Pipeline/Root/Base.hs +++ b/src/Juvix/Compiler/Pipeline/Root/Base.hs @@ -3,13 +3,13 @@ module Juvix.Compiler.Pipeline.Root.Base where import Juvix.Compiler.Pipeline.Package.Base import Juvix.Prelude -data Roots = Roots - { _rootsRootDir :: Path Abs Dir, - _rootsPackage :: Package, - _rootsPackageGlobal :: Bool, - _rootsBuildDir :: Path Abs Dir, - _rootsInvokeDir :: Path Abs Dir +data Root = Root + { _rootRootDir :: Path Abs Dir, + _rootPackage :: Package, + _rootPackageGlobal :: Bool, + _rootBuildDir :: Path Abs Dir, + _rootInvokeDir :: Path Abs Dir } deriving stock (Show) -makeLenses ''Roots +makeLenses ''Root diff --git a/test/Base.hs b/test/Base.hs index 3033197c8..71c788e5c 100644 --- a/test/Base.hs +++ b/test/Base.hs @@ -15,7 +15,7 @@ import Data.Algorithm.Diff import Data.Algorithm.DiffOutput import Juvix.Compiler.Pipeline.EntryPoint.IO import Juvix.Compiler.Pipeline.Run -import Juvix.Extra.Paths +import Juvix.Extra.Paths hiding (rootBuildDir) import Juvix.Prelude hiding (assert) import Juvix.Prelude.Env import Test.Tasty