From 47ae86b020c72236bf4e9a50a929aa8189bea188 Mon Sep 17 00:00:00 2001 From: Lukasz Czajka Date: Mon, 6 Nov 2023 18:38:10 +0100 Subject: [PATCH] wip --- .../Compiler/Concrete/Data/ParsedInfoTable.hs | 2 +- .../Concrete/Data/ParsedInfoTableBuilder.hs | 2 +- .../Compiler/Concrete/Data/Scope/Base.hs | 4 +- .../Compiler/Concrete/Data/ScopedName.hs | 3 - src/Juvix/Compiler/Concrete/Extra.hs | 2 +- src/Juvix/Compiler/Concrete/Language.hs | 6 +- src/Juvix/Compiler/Concrete/Print/Base.hs | 21 +--- .../FromParsed/Analysis/Scoping.hs | 111 ++++++++++-------- .../Analysis/Scoping/Error/Types.hs | 4 +- src/Juvix/Compiler/Internal/Language.hs | 2 +- src/Juvix/Compiler/Pipeline/Repl.hs | 2 +- src/Juvix/Compiler/Store/Scoped/Language.hs | 4 +- 12 files changed, 82 insertions(+), 81 deletions(-) diff --git a/src/Juvix/Compiler/Concrete/Data/ParsedInfoTable.hs b/src/Juvix/Compiler/Concrete/Data/ParsedInfoTable.hs index 5cdf871aab..c7cd8cb19c 100644 --- a/src/Juvix/Compiler/Concrete/Data/ParsedInfoTable.hs +++ b/src/Juvix/Compiler/Concrete/Data/ParsedInfoTable.hs @@ -6,7 +6,7 @@ import Juvix.Prelude data InfoTable = InfoTable { _infoParsedComments :: Comments, - _infoParsedModules :: HashMap TopModulePath ScopedModule + _infoParsedModules :: HashMap TopModulePath (Either ScopedModule (Module 'Parsed 'ModuleTop)) } makeLenses ''InfoTable diff --git a/src/Juvix/Compiler/Concrete/Data/ParsedInfoTableBuilder.hs b/src/Juvix/Compiler/Concrete/Data/ParsedInfoTableBuilder.hs index 3d1a379a6c..122e83fd87 100644 --- a/src/Juvix/Compiler/Concrete/Data/ParsedInfoTableBuilder.hs +++ b/src/Juvix/Compiler/Concrete/Data/ParsedInfoTableBuilder.hs @@ -78,7 +78,7 @@ build :: BuilderState -> InfoTable build st = InfoTable { _infoParsedComments = mkComments (st ^. stateComments), - _infoParsedModules = st ^. stateModules + _infoParsedModules = fmap Right (st ^. stateModules) } registerItem' :: (Members '[HighlightBuilder] r) => ParsedItem -> Sem r () diff --git a/src/Juvix/Compiler/Concrete/Data/Scope/Base.hs b/src/Juvix/Compiler/Concrete/Data/Scope/Base.hs index b7e5f55e2c..1dd442dfd6 100644 --- a/src/Juvix/Compiler/Concrete/Data/Scope/Base.hs +++ b/src/Juvix/Compiler/Concrete/Data/Scope/Base.hs @@ -46,7 +46,7 @@ newtype ModulesCache = ModulesCache data ScopeParameters = ScopeParameters { -- | Used for import cycle detection. _scopeTopParents :: [Import 'Parsed], - _scopeParsedModules :: HashMap TopModulePath ScopedModule + _scopeParsedModules :: HashMap TopModulePath (Either ScopedModule (Module 'Parsed 'ModuleTop)) } data RecordInfo = RecordInfo @@ -57,7 +57,7 @@ data RecordInfo = RecordInfo data ScoperState = ScoperState { _scoperModulesCache :: ModulesCache, -- | Local and top modules - _scoperModules :: HashMap S.ModuleNameId ScopedModuleRef, + _scoperModules :: HashMap S.ModuleNameId ScopedModule, _scoperScope :: HashMap TopModulePath Scope, _scoperAlias :: HashMap S.NameId PreSymbolEntry, _scoperSignatures :: HashMap S.NameId (NameSignature 'Parsed), diff --git a/src/Juvix/Compiler/Concrete/Data/ScopedName.hs b/src/Juvix/Compiler/Concrete/Data/ScopedName.hs index 105188683b..935ad53329 100644 --- a/src/Juvix/Compiler/Concrete/Data/ScopedName.hs +++ b/src/Juvix/Compiler/Concrete/Data/ScopedName.hs @@ -135,9 +135,6 @@ topModulePathSymbol = over nameConcrete (^. C.modulePathName) topModulePathName :: TopModulePath -> Name topModulePathName = over nameConcrete C.topModulePathToName -unConcrete :: Name' a -> Name' (Maybe C.Name) -unConcrete = set nameConcrete Nothing - symbolText :: Symbol -> Text symbolText s = s ^. nameConcrete . C.symbolText diff --git a/src/Juvix/Compiler/Concrete/Extra.hs b/src/Juvix/Compiler/Concrete/Extra.hs index 52a2cd9598..4bd460fe7e 100644 --- a/src/Juvix/Compiler/Concrete/Extra.hs +++ b/src/Juvix/Compiler/Concrete/Extra.hs @@ -60,7 +60,7 @@ groupStatements = \case ^. importModule . scopedModulePath . S.nameId - == getModuleRefNameId (o ^. openModuleName) + == getScopedModuleNameId (o ^. openModuleName) (StatementImport _, _) -> False (StatementOpenModule {}, StatementOpenModule {}) -> True (StatementOpenModule {}, _) -> False diff --git a/src/Juvix/Compiler/Concrete/Language.hs b/src/Juvix/Compiler/Concrete/Language.hs index a731bb2057..6fce9839ac 100644 --- a/src/Juvix/Compiler/Concrete/Language.hs +++ b/src/Juvix/Compiler/Concrete/Language.hs @@ -74,7 +74,7 @@ type family SymbolType s = res | res -> s where type ModuleRefType :: Stage -> GHC.Type type family ModuleRefType s = res | res -> s where ModuleRefType 'Parsed = Name - ModuleRefType 'Scoped = ScopedModuleRef + ModuleRefType 'Scoped = ScopedModule type IdentifierType :: Stage -> GHC.Type type family IdentifierType s = res | res -> s where @@ -1108,6 +1108,9 @@ getModuleRefName (ScopedModuleRef (_ :&: ScopedModuleRef' {..})) = _scopedModule getModuleRefNameId :: ScopedModuleRef -> S.NameId getModuleRefNameId m = getModuleRefName m ^. S.nameId +getScopedModuleNameId :: ScopedModule -> S.NameId +getScopedModuleNameId m = m ^. scopedModuleName . S.nameId + data OpenModule (s :: Stage) = OpenModule { _openModuleName :: ModuleRefType s, _openModuleParams :: OpenModuleParams s @@ -2020,7 +2023,6 @@ instance (SingI s) => HasLoc (AxiomDef s) where instance HasLoc (OpenModule 'Scoped) where getLoc m = getLoc (m ^. openModuleParams . openModuleKw) - <> getLoc (m ^. openModuleName) <>? fmap getLoc (m ^. openModuleParams . openPublicKw . unIrrelevant) instance HasLoc (ProjectionDef s) where diff --git a/src/Juvix/Compiler/Concrete/Print/Base.hs b/src/Juvix/Compiler/Concrete/Print/Base.hs index dde070c211..36ddbcfaec 100644 --- a/src/Juvix/Compiler/Concrete/Print/Base.hs +++ b/src/Juvix/Compiler/Concrete/Print/Base.hs @@ -16,7 +16,7 @@ import Juvix.Compiler.Concrete.Extra qualified as Concrete import Juvix.Compiler.Concrete.Keywords qualified as Kw import Juvix.Compiler.Concrete.Language import Juvix.Compiler.Concrete.Pretty.Options -import Juvix.Compiler.Store.Scoped.Language (Alias, ModuleSymbolEntry, PreSymbolEntry (..), SymbolEntry, aliasName, moduleEntry, symbolEntry) +import Juvix.Compiler.Store.Scoped.Language (Alias, ModuleSymbolEntry, PreSymbolEntry (..), ScopedModule, SymbolEntry, aliasName, moduleEntry, scopedModuleName, symbolEntry) import Juvix.Data.Ape.Base import Juvix.Data.Ape.Print import Juvix.Data.CodeAnn (Ann, CodeAnn (..), ppStringLit) @@ -466,11 +466,8 @@ instance PrettyPrint QualifiedName where let symbols = _qualifiedPath ^. pathParts NonEmpty.|> _qualifiedSymbol dotted (ppSymbolType <$> symbols) -instance (SingI t) => PrettyPrint (ModuleRef'' 'S.NotConcrete t) where - ppCode = ppCode @(ModuleRef' 'S.NotConcrete) . project - -instance PrettyPrint (ModuleRef'' 'S.Concrete t) where - ppCode m = ppCode (m ^. moduleRefName) +instance PrettyPrint ScopedModule where + ppCode m = ppCode (m ^. scopedModuleName) instance PrettyPrint ScopedIden where ppCode = ppCode . (^. scopedIdenName) @@ -1070,16 +1067,8 @@ instance (SingI s) => PrettyPrint (UsingItem s) where kwmodule = ppCode <$> (ui ^. usingModuleKw) kwmodule (sym' <+?> kwAs' <+?> alias') -instance PrettyPrint (ModuleRef' 'S.NotConcrete) where - ppCode (ModuleRef' (t :&: m)) = - let path = m ^. moduleRefModule . modulePath - txt = case t of - SModuleTop -> annotate (AnnKind KNameTopModule) (pretty path) - SModuleLocal -> annotate (AnnKind KNameLocalModule) (pretty path) - in noLoc txt - -instance PrettyPrint ModuleRef where - ppCode (ModuleRef' (_ :&: ModuleRef'' {..})) = ppCode _moduleRefName +instance PrettyPrint ScopedModuleRef where + ppCode (ScopedModuleRef (_ :&: ScopedModuleRef' {..})) = ppCode (_scopedModuleRefScopedModule ^. scopedModuleName) instance (SingI s) => PrettyPrint (Import s) where ppCode :: forall r. (Members '[ExactPrint, Reader Options] r) => Import s -> Sem r () diff --git a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs index 7a9ec07069..81cbfb2dfa 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs @@ -226,7 +226,7 @@ reserveSymbolOf k nameSig s = do whenJust nameSig (modify' . set (scoperSignatures . at (s' ^. S.nameId)) . Just) modify (set (scopeNameSpaceLocal sns . at s) (Just s')) registerName s' - let u = S.unConcrete s' + let u = S.unqualifiedSymbol s' entry :: NameSpaceEntryType (NameKindNameSpace nameKind) entry = let symE @@ -383,24 +383,23 @@ checkImport import_@Import {..} = do qual' = do asName <- _importAsName return (set S.nameConcrete asName sname') - addModuleToScope smodule + addModuleToScope cmodule registerName importName whenJust synonymName registerName - let moduleRef' = mkModuleRef' moduleRef - modify (over scoperModules (HashMap.insert moduleId moduleRef')) - importOpen' <- mapM (checkImportOpenParams cmoduleRef) _importOpen + modify (over scoperModules (HashMap.insert moduleId cmodule)) + importOpen' <- mapM (checkImportOpenParams cmodule) _importOpen return Import - { _importModule = cmoduleRef, + { _importModule = cmodule, _importAsName = qual', _importOpen = importOpen', .. } where - addModuleToScope :: ModuleRef'' 'S.NotConcrete 'ModuleTop -> Sem r () + addModuleToScope :: ScopedModule -> Sem r () addModuleToScope moduleRef = do let mpath :: TopModulePath = fromMaybe _importModule _importAsName - uid :: S.NameId = moduleRef ^. moduleRefName . S.nameId + uid :: S.NameId = moduleRef ^. scopedModuleName . S.nameId singTbl = HashMap.singleton uid moduleRef modify (over (scopeTopModules . at mpath) (Just . maybe singTbl (HashMap.insert uid moduleRef))) checkCycle :: Sem r () @@ -420,7 +419,7 @@ getTopModulePath Module {..} = } getModuleExportInfo :: forall r. (Members '[State ScoperState] r) => ModuleSymbolEntry -> Sem r ExportInfo -getModuleExportInfo m = fromMaybeM err (gets (^? scoperModules . at (m ^. moduleEntry . S.nameId) . _Just . to getModuleRefExportInfo)) +getModuleExportInfo m = fromMaybeM err (gets (^? scoperModules . at (m ^. moduleEntry . S.nameId) . _Just . scopedModuleExportInfo)) where err :: Sem r a err = do @@ -462,14 +461,12 @@ lookupSymbolAux modules final = do importedTopModule :: Sem r () importedTopModule = do tbl <- gets (^. scopeTopModules) - mapM_ output (tbl ^.. at path . _Just . each . to (mkModuleEntry . mkModuleRef')) + mapM_ output (tbl ^.. at path . _Just . each . to mkModuleEntry) where path = TopModulePath modules final -mkModuleEntry :: ModuleRef' 'S.NotConcrete -> ModuleSymbolEntry -mkModuleEntry (ModuleRef' (t :&: m)) = ModuleSymbolEntry $ case t of - SModuleTop -> S.unConcrete (m ^. moduleRefModule . modulePath) - SModuleLocal -> S.unConcrete (m ^. moduleRefModule . modulePath) +mkModuleEntry :: ScopedModule -> ModuleSymbolEntry +mkModuleEntry m = ModuleSymbolEntry (m ^. scopedModuleName) lookInExport :: forall r. @@ -530,7 +527,7 @@ lookupQualifiedSymbol sms = do lookInTopModule topPath remaining = do tbl <- gets (^. scopeTopModules) sequence_ - [ lookInExport sym remaining (ref ^. moduleExportInfo) + [ lookInExport sym remaining (ref ^. scopedModuleExportInfo) | Just t <- [tbl ^. at topPath], ref <- toList t ] @@ -626,7 +623,7 @@ exportScope Scope {..} = do ) ) -getParsedModule :: (Members '[Reader ScopeParameters] r) => TopModulePath -> Sem r ScopedModule +getParsedModule :: (Members '[Reader ScopeParameters] r) => TopModulePath -> Sem r (Either ScopedModule (Module 'Parsed 'ModuleTop)) getParsedModule i = asks (^?! scopeParsedModules . at i . _Just) readScopeModule :: @@ -634,7 +631,14 @@ readScopeModule :: Import 'Parsed -> Sem r ScopedModule readScopeModule import_ = do - getParsedModule (import_ ^. importModule) + m <- getParsedModule (import_ ^. importModule) + case m of + Left m' -> return m' + Right m' -> + (^. scopedModuleRefScopedModule) <$> local addImport (checkTopModule m') + where + addImport :: ScopeParameters -> ScopeParameters + addImport = over scopeTopParents (cons import_) checkFixityInfo :: forall r. @@ -1001,14 +1005,14 @@ checkTopModules :: Sem r (NonEmpty (Module 'Scoped 'ModuleTop), HashSet NameId) checkTopModules modules = do checked <- mapM checkTopModule modules - return ((^. moduleRefModule) <$> checked, createExportsTable (head checked ^. moduleExportInfo)) + return ((^. scopedModuleRefModule) <$> checked, createExportsTable (head checked ^. scopedModuleRefScopedModule . scopedModuleExportInfo)) checkTopModule_ :: forall r. (Members '[Error ScoperError, Reader ScopeParameters, State ScoperState, InfoTableBuilder, NameIdGen] r) => Module 'Parsed 'ModuleTop -> Sem r (Module 'Scoped 'ModuleTop) -checkTopModule_ = fmap (^. moduleRefModule) . checkTopModule +checkTopModule_ = fmap (^. scopedModuleRefModule) . checkTopModule topBindings :: Sem (Reader BindingStrategy ': r) a -> Sem r a topBindings = runReader BindingTop @@ -1020,11 +1024,11 @@ checkTopModule :: forall r. (Members '[Error ScoperError, Reader ScopeParameters, State ScoperState, InfoTableBuilder, NameIdGen] r) => Module 'Parsed 'ModuleTop -> - Sem r (ModuleRef'' 'S.NotConcrete 'ModuleTop) + Sem r (ScopedModuleRef' 'ModuleTop) checkTopModule m@Module {..} = do r <- checkedModule - modify (over (scoperModulesCache . cachedModules) (HashMap.insert _modulePath r)) - registerModule (r ^. moduleRefModule) + modify (over (scoperModulesCache . cachedModules) (HashMap.insert _modulePath (r ^. scopedModuleRefScopedModule))) + registerModule (r ^. scopedModuleRefModule) return r where freshTopModulePath :: @@ -1052,14 +1056,14 @@ checkTopModule m@Module {..} = do iniScope :: Scope iniScope = emptyScope (getTopModulePath m) - checkedModule :: Sem r (ModuleRef'' 'S.NotConcrete 'ModuleTop) + checkedModule :: Sem r (ScopedModuleRef' 'ModuleTop) checkedModule = do (s, (m', p)) <- runState iniScope $ do path' <- freshTopModulePath withTopScope $ do - (_moduleExportInfo, body') <- topBindings (checkModuleBody _moduleBody) + (e, body') <- topBindings (checkModuleBody _moduleBody) doc' <- mapM checkJudoc _moduleDoc - let _moduleRefModule = + let _scopedModuleRefModule = Module { _modulePath = path', _moduleBody = body', @@ -1069,8 +1073,13 @@ checkTopModule m@Module {..} = do _moduleInductive, _moduleKwEnd } - _moduleRefName = S.unConcrete path' - return (ModuleRef'' {..}, path') + _scopedModuleRefScopedModule = + ScopedModule + { _scopedModulePath = path', + _scopedModuleName = S.topModulePathName path', + _scopedModuleExportInfo = e + } + return (ScopedModuleRef' {..}, path') modify (set (scoperScope . at (p ^. S.nameConcrete)) (Just s)) return m' @@ -1415,7 +1424,7 @@ checkLocalModule :: Module 'Parsed 'ModuleLocal -> Sem r (Module 'Scoped 'ModuleLocal) checkLocalModule Module {..} = do - (_moduleExportInfo, moduleBody', moduleDoc') <- + (moduleExportInfo, moduleBody', moduleDoc') <- withLocalScope $ do inheritScope (e, b) <- checkModuleBody _moduleBody @@ -1423,8 +1432,8 @@ checkLocalModule Module {..} = do return (e, b, doc') _modulePath' <- reserveLocalModuleSymbol _modulePath let moduleId = _modulePath' ^. S.nameId - _moduleRefName = S.unConcrete _modulePath' - _moduleRefModule = + moduleName = S.unqualifiedSymbol _modulePath' + m = Module { _modulePath = _modulePath', _moduleBody = moduleBody', @@ -1434,11 +1443,15 @@ checkLocalModule Module {..} = do _moduleInductive, _moduleKwEnd } - mref :: ModuleRef' 'S.NotConcrete - mref = mkModuleRef' @'ModuleLocal ModuleRef'' {..} - modify (over scoperModules (HashMap.insert moduleId mref)) + smod = + ScopedModule + { _scopedModulePath = set nameConcrete (moduleNameToTopModulePath (NameUnqualified _modulePath)) moduleName, + _scopedModuleName = moduleName, + _scopedModuleExportInfo = moduleExportInfo + } + modify (over scoperModules (HashMap.insert moduleId smod)) registerName _modulePath' - return _moduleRefModule + return m where inheritScope :: Sem r () inheritScope = do @@ -1474,24 +1487,24 @@ checkOrphanIterators = do symbolInfoSingle :: (SingI ns) => NameSpaceEntryType ns -> SymbolInfo ns symbolInfoSingle p = SymbolInfo $ HashMap.singleton (p ^. nsEntry . S.nameDefinedIn) p -getModuleRef :: +getModule :: (Members '[State ScoperState] r) => ModuleSymbolEntry -> Name -> - Sem r ModuleRef -getModuleRef e n = - overModuleRef'' (set (moduleRefName . S.nameConcrete) n) + Sem r ScopedModule +getModule e n = + set (scopedModuleName . S.nameConcrete) n <$> gets (^?! scoperModules . at (e ^. moduleEntry . S.nameId) . _Just) lookupModuleSymbol :: (Members '[Error ScoperError, State Scope, State ScoperState] r) => Name -> - Sem r ModuleRef + Sem r ScopedModule lookupModuleSymbol n = do es <- snd3 <$> lookupQualifiedSymbol (path, sym) case nonEmpty (resolveShadowing es) of Nothing -> notInScope - Just (x :| []) -> getModuleRef x n + Just (x :| []) -> getModule x n Just more -> throw (ErrAmbiguousModuleSym (AmbiguousModuleSym n more)) where notInScope = throw (ErrModuleNotInScope (ModuleNotInScope n)) @@ -1502,7 +1515,7 @@ lookupModuleSymbol n = do checkImportOpenParams :: forall r. (Members '[Error ScoperError, State Scope, State ScoperState, InfoTableBuilder, NameIdGen] r) => - ModuleRef'' 'S.Concrete 'ModuleTop -> + ScopedModule -> OpenModuleParams 'Parsed -> Sem r (OpenModuleParams 'Scoped) checkImportOpenParams m p = @@ -1511,7 +1524,7 @@ checkImportOpenParams m p = (Just m) OpenModule { _openModuleParams = p, - _openModuleName = m ^. moduleRefName . S.nameConcrete + _openModuleName = m ^. scopedModuleName . S.nameConcrete } checkOpenModule :: @@ -1524,15 +1537,15 @@ checkOpenModule = checkOpenModuleHelper Nothing checkOpenModuleHelper :: forall r. (Members '[Error ScoperError, State Scope, State ScoperState, InfoTableBuilder, NameIdGen] r) => - Maybe (ModuleRef'' 'S.Concrete 'ModuleTop) -> + Maybe ScopedModule -> OpenModule 'Parsed -> Sem r (OpenModule 'Scoped) checkOpenModuleHelper importModuleHint OpenModule {..} = do - openModuleName'@(ModuleRef' (_ :&: moduleRef'')) <- case importModuleHint of + cmod <- case importModuleHint of Nothing -> lookupModuleSymbol _openModuleName - Just m -> return (project m) - let exportInfo = moduleRef'' ^. moduleExportInfo - registerName (moduleRef'' ^. moduleRefName) + Just m -> return m + let exportInfo = cmod ^. scopedModuleExportInfo + registerName (cmod ^. scopedModuleName) let checkUsingHiding :: UsingHiding 'Parsed -> Sem r (UsingHiding 'Scoped) checkUsingHiding = \case @@ -1548,7 +1561,7 @@ checkOpenModuleHelper importModuleHint OpenModule {..} = do ( ErrModuleDoesNotExportSymbol ( ModuleDoesNotExportSymbol { _moduleDoesNotExportSymbol = s, - _moduleDoesNotExportModule = openModuleName' + _moduleDoesNotExportModule = cmod } ) ) @@ -1612,7 +1625,7 @@ checkOpenModuleHelper importModuleHint OpenModule {..} = do mergeScope (alterScope (openParams' ^. openUsingHiding) exportInfo) return OpenModule - { _openModuleName = openModuleName', + { _openModuleName = cmod, _openModuleParams = openParams', .. } diff --git a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs index 1417395cf9..04d851dff6 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs @@ -13,7 +13,7 @@ import Juvix.Compiler.Concrete.Data.ScopedName qualified as S import Juvix.Compiler.Concrete.Language import Juvix.Compiler.Concrete.Pretty.Options (Options, fromGenericOptions) import Juvix.Compiler.Concrete.Translation.FromParsed.Analysis.Scoping.Error.Pretty -import Juvix.Compiler.Store.Scoped.Language (FixitySymbolEntry, ModuleSymbolEntry, PreSymbolEntry) +import Juvix.Compiler.Store.Scoped.Language (FixitySymbolEntry, ModuleSymbolEntry, PreSymbolEntry, ScopedModule) import Juvix.Data.CodeAnn import Juvix.Prelude @@ -612,7 +612,7 @@ instance ToGenericError ConstructorExpectedLeftApplication where data ModuleDoesNotExportSymbol = ModuleDoesNotExportSymbol { _moduleDoesNotExportSymbol :: Symbol, - _moduleDoesNotExportModule :: ScopedModuleRef + _moduleDoesNotExportModule :: ScopedModule } deriving stock (Show) diff --git a/src/Juvix/Compiler/Internal/Language.hs b/src/Juvix/Compiler/Internal/Language.hs index a32973826f..5dc1289c1f 100644 --- a/src/Juvix/Compiler/Internal/Language.hs +++ b/src/Juvix/Compiler/Internal/Language.hs @@ -357,7 +357,7 @@ emptyArgInfo = instance Hashable ArgInfo -instance Serialize DefaultSignature +instance Serialize ArgInfo data FunctionParameter = FunctionParameter { _paramName :: Maybe VarName, diff --git a/src/Juvix/Compiler/Pipeline/Repl.hs b/src/Juvix/Compiler/Pipeline/Repl.hs index e8c0f24fb5..aa159957c4 100644 --- a/src/Juvix/Compiler/Pipeline/Repl.hs +++ b/src/Juvix/Compiler/Pipeline/Repl.hs @@ -93,7 +93,7 @@ runToInternal m = do . runScoperInfoTableBuilderArtifacts . runScoperScopeArtifacts . runReaderArtifacts artifactScopeExports - . runReader (Scoper.ScopeParameters mempty parsedModules) + . runReader (Scoper.ScopeParameters mempty (fmap Right parsedModules)) . runFromConcreteCache . runStateArtifacts artifactScoperState $ m diff --git a/src/Juvix/Compiler/Store/Scoped/Language.hs b/src/Juvix/Compiler/Store/Scoped/Language.hs index a32e749d93..1a2e49710a 100644 --- a/src/Juvix/Compiler/Store/Scoped/Language.hs +++ b/src/Juvix/Compiler/Store/Scoped/Language.hs @@ -5,7 +5,7 @@ import Juvix.Compiler.Concrete.Data.ScopedName (HasNameKind) import Juvix.Compiler.Concrete.Data.ScopedName qualified as S import Juvix.Prelude -type ScopedName = S.Name' () +type ScopedName = S.Name newtype Alias = Alias { _aliasName :: ScopedName @@ -44,7 +44,7 @@ data ExportInfo = ExportInfo } deriving stock (Show, Eq, Ord, Generic) -data ScopedModule = StoredModule +data ScopedModule = ScopedModule { _scopedModulePath :: S.TopModulePath, _scopedModuleName :: ScopedName, _scopedModuleExportInfo :: ExportInfo