@@ -198,7 +198,7 @@ renameInModule imports exports (Module mn decls exps) =
199 (go, _, _, _, _) = everywhereWithContextOnValuesM (Nothing, []) updateDecl updateValue updateBinder updateCase defS
199 (go, _, _, _, _) = everywhereWithContextOnValuesM (Nothing, []) updateDecl updateValue updateBinder updateCase defS
201− updateDecl :: (Maybe SourcePos, [Ident]) -> Declaration -> Either ErrorStack ((Maybe SourcePos, [Ident]), Declaration)
201+ updateDecl :: (Maybe SourceSpan, [Ident]) -> Declaration -> Either ErrorStack ((Maybe SourceSpan, [Ident]), Declaration)
202 updateDecl (_, bound) d@(PositionedDeclaration pos _) = return ((Just pos, bound), d)
202 updateDecl (_, bound) d@(PositionedDeclaration pos _) = return ((Just pos, bound), d)
203 updateDecl (pos, bound) (DataDeclaration dtype name args dctors) =
203 updateDecl (pos, bound) (DataDeclaration dtype name args dctors) =
204 (,) (pos, bound) <$> (DataDeclaration dtype name args <$> mapM (sndM (mapM (updateTypesEverywhere pos))) dctors)
204 (,) (pos, bound) <$> (DataDeclaration dtype name args <$> mapM (sndM (mapM (updateTypesEverywhere pos))) dctors)
@@ -216,7 +216,7 @@ renameInModule imports exports (Module mn decls exps) =
216 (,) (pos, name : bound) <$> (ExternDeclaration fit name js <$> updateTypesEverywhere pos ty)
216 (,) (pos, name : bound) <$> (ExternDeclaration fit name js <$> updateTypesEverywhere pos ty)
217 updateDecl s d = return (s, d)
217 updateDecl s d = return (s, d)
219− updateValue :: (Maybe SourcePos, [Ident]) -> Expr -> Either ErrorStack ((Maybe SourcePos, [Ident]), Expr)
219+ updateValue :: (Maybe SourceSpan, [Ident]) -> Expr -> Either ErrorStack ((Maybe SourceSpan, [Ident]), Expr)
220 updateValue (_, bound) v@(PositionedValue pos' _) = return ((Just pos', bound), v)
220 updateValue (_, bound) v@(PositionedValue pos' _) = return ((Just pos', bound), v)
221 updateValue (pos, bound) (Abs (Left arg) val') = return ((pos, arg : bound), Abs (Left arg) val')
221 updateValue (pos, bound) (Abs (Left arg) val') = return ((pos, arg : bound), Abs (Left arg) val')
222 updateValue (pos, bound) (Let ds val') =
222 updateValue (pos, bound) (Let ds val') =
@@ -234,12 +234,12 @@ renameInModule imports exports (Module mn decls exps) =
234 updateValue s@(pos, _) (TypedValue check val ty) = (,) s <$> (TypedValue check val <$> updateTypesEverywhere pos ty)
234 updateValue s@(pos, _) (TypedValue check val ty) = (,) s <$> (TypedValue check val <$> updateTypesEverywhere pos ty)
235 updateValue s v = return (s, v)
235 updateValue s v = return (s, v)
237− updateBinder :: (Maybe SourcePos, [Ident]) -> Binder -> Either ErrorStack ((Maybe SourcePos, [Ident]), Binder)
237+ updateBinder :: (Maybe SourceSpan, [Ident]) -> Binder -> Either ErrorStack ((Maybe SourceSpan, [Ident]), Binder)
238 updateBinder (_, bound) v@(PositionedBinder pos _) = return ((Just pos, bound), v)
238 updateBinder (_, bound) v@(PositionedBinder pos _) = return ((Just pos, bound), v)
239 updateBinder s@(pos, _) (ConstructorBinder name b) = (,) s <$> (ConstructorBinder <$> updateDataConstructorName name pos <*> pure b)
239 updateBinder s@(pos, _) (ConstructorBinder name b) = (,) s <$> (ConstructorBinder <$> updateDataConstructorName name pos <*> pure b)
240 updateBinder s v = return (s, v)
240 updateBinder s v = return (s, v)
242− updateCase :: (Maybe SourcePos, [Ident]) -> CaseAlternative -> Either ErrorStack ((Maybe SourcePos, [Ident]), CaseAlternative)
242+ updateCase :: (Maybe SourceSpan, [Ident]) -> CaseAlternative -> Either ErrorStack ((Maybe SourceSpan, [Ident]), CaseAlternative)
243 updateCase (pos, bound) c@(CaseAlternative bs _) = return ((pos, concatMap binderNames bs ++ bound), c)
243 updateCase (pos, bound) c@(CaseAlternative bs _) = return ((pos, concatMap binderNames bs ++ bound), c)
245 letBoundVariable :: Declaration -> Maybe Ident
245 letBoundVariable :: Declaration -> Maybe Ident
@@ -247,10 +247,10 @@ renameInModule imports exports (Module mn decls exps) =
247 letBoundVariable (PositionedDeclaration _ d) = letBoundVariable d
247 letBoundVariable (PositionedDeclaration _ d) = letBoundVariable d
248 letBoundVariable _ = Nothing
248 letBoundVariable _ = Nothing
250− updateTypesEverywhere :: Maybe SourcePos -> Type -> Either ErrorStack Type
250+ updateTypesEverywhere :: Maybe SourceSpan -> Type -> Either ErrorStack Type
251 updateTypesEverywhere pos0 = everywhereOnTypesM (updateType pos0)
251 updateTypesEverywhere pos0 = everywhereOnTypesM (updateType pos0)
253− updateType :: Maybe SourcePos -> Type -> Either ErrorStack Type
253+ updateType :: Maybe SourceSpan -> Type -> Either ErrorStack Type
254 updateType pos (TypeConstructor name) = TypeConstructor <$> updateTypeName name pos
254 updateType pos (TypeConstructor name) = TypeConstructor <$> updateTypeName name pos
255 updateType pos (SaturatedTypeSynonym name tys) = SaturatedTypeSynonym <$> updateTypeName name pos <*> pure tys
255 updateType pos (SaturatedTypeSynonym name tys) = SaturatedTypeSynonym <$> updateTypeName name pos <*> pure tys
256 updateType pos (ConstrainedType cs t) = ConstrainedType <$> updateConstraints pos cs <*> pure t
256 updateType pos (ConstrainedType cs t) = ConstrainedType <$> updateConstraints pos cs <*> pure t
@@ -269,7 +269,7 @@ renameInModule imports exports (Module mn decls exps) =
269 -> (ImportEnvironment -> M.Map (Qualified a) (Qualified a))
269 -> (ImportEnvironment -> M.Map (Qualified a) (Qualified a))
270 -> (Exports -> a -> Bool)
270 -> (Exports -> a -> Bool)
271 -> Qualified a
271 -> Qualified a
272− -> Maybe SourcePos
272+ -> Maybe SourceSpan
273 -> Either ErrorStack (Qualified a)
273 -> Either ErrorStack (Qualified a)
274 update t getI checkE qname@(Qualified mn' name) pos = positioned $ case (M.lookup qname imports', mn') of
274 update t getI checkE qname@(Qualified mn' name) pos = positioned $ case (M.lookup qname imports', mn') of
275 (Just qname', _) -> return qname'
275 (Just qname', _) -> return qname'
@@ -385,7 +385,7 @@ filterExports mn exps env = do
385-- Finds the imports within a module, mapping the imported module name to an optional set of
385-- Finds the imports within a module, mapping the imported module name to an optional set of
386-- explicitly imported declarations.
386-- explicitly imported declarations.
388−findImports :: [Declaration] -> M.Map ModuleName (Maybe SourcePos, ImportDeclarationType, Maybe ModuleName)
388+findImports :: [Declaration] -> M.Map ModuleName (Maybe SourceSpan, ImportDeclarationType, Maybe ModuleName)
389findImports = foldl (findImports' Nothing) M.empty
389findImports = foldl (findImports' Nothing) M.empty
391 findImports' pos result (ImportDeclaration mn typ qual) = M.insert mn (pos, typ, qual) result
391 findImports' pos result (ImportDeclaration mn typ qual) = M.insert mn (pos, typ, qual) result
@@ -403,10 +403,10 @@ resolveImports env (Module currentModule decls _) =
403 -- A Map from module name to the source position for the import, the list of imports from that
403 -- A Map from module name to the source position for the import, the list of imports from that
404 -- module (where Nothing indicates everything is to be imported), and optionally a qualified name
404 -- module (where Nothing indicates everything is to be imported), and optionally a qualified name
405 -- for the module
405 -- for the module
406− scope :: M.Map ModuleName (Maybe SourcePos, ImportDeclarationType, Maybe ModuleName)
406+ scope :: M.Map ModuleName (Maybe SourceSpan, ImportDeclarationType, Maybe ModuleName)
407 scope = M.insert currentModule (Nothing, Unqualified, Nothing) (findImports decls)
407 scope = M.insert currentModule (Nothing, Unqualified, Nothing) (findImports decls)
409− resolveImport' :: ImportEnvironment -> (ModuleName, (Maybe SourcePos, ImportDeclarationType, Maybe ModuleName)) -> Either ErrorStack ImportEnvironment
409+ resolveImport' :: ImportEnvironment -> (ModuleName, (Maybe SourceSpan, ImportDeclarationType, Maybe ModuleName)) -> Either ErrorStack ImportEnvironment
410 resolveImport' imp (mn, (pos, typ, impQual)) = do
410 resolveImport' imp (mn, (pos, typ, impQual)) = do
411 modExports <- positioned $ maybe (throwError $ mkErrorStack ("Cannot import unknown module '" ++ show mn ++ "'") Nothing) return $ mn `M.lookup` env
411 modExports <- positioned $ maybe (throwError $ mkErrorStack ("Cannot import unknown module '" ++ show mn ++ "'") Nothing) return $ mn `M.lookup` env
412 positioned $ resolveImport currentModule mn modExports imp impQual typ
412 positioned $ resolveImport currentModule mn modExports imp impQual typ