git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Tidy up
b57566fGary Burgess
src/Language/PureScript/Sugar/Names.hs+3−3
@@ -92,7 +92,7 @@ addTypeclass env mn name = do
92addExport :: (Ord s, Show s) => M.Map ModuleName (S.Set s) -> ModuleName -> s -> Either String (M.Map ModuleName (S.Set s))
92addExport :: (Ord s, Show s) => M.Map ModuleName (S.Set s) -> ModuleName -> s -> Either String (M.Map ModuleName (S.Set s))
93addExport exports mn name = case M.lookup mn exports of
93addExport exports mn name = case M.lookup mn exports of
94 Just s -> if S.member name s
94 Just s -> if S.member name s
95− then Left $ "Module '" ++ show mn ++ "' has multiple definitions for '" ++ (show name) ++ "'"
95+ then Left $ "Module '" ++ show mn ++ "' has multiple definitions for '" ++ show name ++ "'"
96 else Right $ M.insert mn (S.insert name s) exports
96 else Right $ M.insert mn (S.insert name s) exports
97 Nothing -> Right $ M.insert mn (S.singleton name) exports
97 Nothing -> Right $ M.insert mn (S.singleton name) exports
98
98
@@ -113,7 +113,7 @@ rename modules = do
113--
113--
114renameInModule :: ImportEnvironment -> Module -> Either String Module
114renameInModule :: ImportEnvironment -> Module -> Either String Module
115renameInModule imports (Module mn decls) =
115renameInModule imports (Module mn decls) =
116− Module mn <$> mapM updateDecl decls >>= everywhereM ((mkM updateType) `extM` updateValue `extM` updateBinder)
116+ Module mn <$> mapM updateDecl decls >>= everywhereM (mkM updateType `extM` updateValue `extM` updateBinder)
117 where
117 where
118 updateDecl (TypeInstanceDeclaration cs (Qualified Nothing cn) ts ds) = do
118 updateDecl (TypeInstanceDeclaration cs (Qualified Nothing cn) ts ds) = do
119 cn' <- updateClassName cn
119 cn' <- updateClassName cn
@@ -197,7 +197,7 @@ resolveImports env (Module currentModule decls) = do
197 resolveDcons result (mn, tcons) = case M.lookup mn scope of
197 resolveDcons result (mn, tcons) = case M.lookup mn scope of
198 Just Nothing -> foldM (\result (tcon, dcons) -> foldM (resolveDef mn) result dcons) result (S.toList tcons)
198 Just Nothing -> foldM (\result (tcon, dcons) -> foldM (resolveDef mn) result dcons) result (S.toList tcons)
199 Just (Just expl) ->
199 Just (Just expl) ->
200− let selectedTcons = filter (\(tcon, _) -> any (either (const False) ((==) tcon)) expl) (S.toList tcons) in
200+ let selectedTcons = filter (\(tcon, _) -> any (either (const False) (tcon ==)) expl) (S.toList tcons) in
201 foldM (\result (tcon, dcons) -> foldM (resolveDef mn) result dcons) result selectedTcons
201 foldM (\result (tcon, dcons) -> foldM (resolveDef mn) result dcons) result selectedTcons
202 Nothing -> Right result
202 Nothing -> Right result
203 filterTypes result = either (const result) (`S.insert` result)
203 filterTypes result = either (const result) (`S.insert` result)
src/Language/PureScript/TypeChecker/Monad.hs+1−1
@@ -154,7 +154,7 @@ bindLocalVariables moduleName bindings =
154--
154--
155bindLocalTypeVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(ProperName, Kind)] -> m a -> m a
155bindLocalTypeVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(ProperName, Kind)] -> m a -> m a
156bindLocalTypeVariables moduleName bindings =
156bindLocalTypeVariables moduleName bindings =
157− bindTypes (M.fromList $ flip map bindings $ \(name, k) -> (Qualified (Just moduleName) name, k))
157+ bindTypes (M.fromList $ flip map bindings $ first $ Qualified (Just moduleName))
158
158
159-- |
159-- |
160-- Lookup the type of a value by name in the @Environment@
160-- Lookup the type of a value by name in the @Environment@