purescript 0.4.13 → 0.4.13.1
raw patch · 4 files changed
+12/−8 lines, 4 files
Files
- psci/Main.hs +1/−0
- purescript.cabal +1/−1
- src/Language/PureScript/CodeGen/Externs.hs +7/−7
- src/Language/PureScript/DeadCodeElimination.hs +3/−0
psci/Main.hs view
@@ -178,6 +178,7 @@ isExported = flip any exts $ \e -> case e of P.ValueRef ident' -> ident == ident' _ -> False+ getDeclName exts (P.PositionedDeclaration _ d) = getDeclName exts d getDeclName _ _ = Nothing names :: [P.Module] -> [String] names ms = nub [ show qual
purescript.cabal view
@@ -1,5 +1,5 @@ name: purescript-version: 0.4.13+version: 0.4.13.1 cabal-version: >=1.8 build-type: Custom license: MIT
src/Language/PureScript/CodeGen/Externs.hs view
@@ -36,17 +36,17 @@ moduleToPs :: Module -> Environment -> String moduleToPs (Module _ _ Nothing) _ = error "Module exports were not elaborated in moduleToPs" moduleToPs (Module moduleName ds (Just exts)) env = intercalate "\n" . execWriter $ do- tell [ "module " ++ runModuleName moduleName ++ " where"- , "import Prelude ()" ]- mapM_ fixityToPs ds+ tell [ "module " ++ runModuleName moduleName ++ " where"]+ mapM_ declToPs ds mapM_ exportToPs exts where - fixityToPs :: Declaration -> Writer [String] ()- fixityToPs (FixityDeclaration (Fixity assoc prec) ident) =+ declToPs :: Declaration -> Writer [String] ()+ declToPs (ImportDeclaration mn _ _) = tell ["import " ++ show mn ++ " ()"]+ declToPs (FixityDeclaration (Fixity assoc prec) ident) = tell [ unwords [ show assoc, show prec, ident ] ]- fixityToPs (PositionedDeclaration _ d) = fixityToPs d- fixityToPs _ = return ()+ declToPs (PositionedDeclaration _ d) = declToPs d+ declToPs _ = return () exportToPs :: DeclarationRef -> Writer [String] () exportToPs (PositionedDeclarationRef _ r) = exportToPs r
src/Language/PureScript/DeadCodeElimination.hs view
@@ -86,6 +86,9 @@ isUsed moduleName graph vertexFor entryPointVertices (ValueDeclaration name _ _ _ _) = let Just v' = vertexFor (moduleName, Left name) in any (\v -> path graph v v') entryPointVertices+isUsed moduleName graph vertexFor entryPointVertices (FixityDeclaration _ name) =+ let Just v' = vertexFor (moduleName, Left $ Op name)+ in any (\v -> path graph v v') entryPointVertices isUsed moduleName graph vertexFor entryPointVertices (DataDeclaration _ _ dctors) = any (\(pn, _) -> let Just v' = vertexFor (moduleName, Right pn) in any (\v -> path graph v v') entryPointVertices) dctors