summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilFreeman <>2014-04-03 20:32:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-04-03 20:32:00 (GMT)
commit62d49513b34cd5f5d7f6418804f324b1a054d8b9 (patch)
tree4b20e019a9687d55f60ae1a9f3f295c0f418b3b2
parent025c330d1c023a46fba8b6862f083d1a2e883340 (diff)
version 0.4.13.10.4.13.1
-rw-r--r--psci/Main.hs1
-rw-r--r--purescript.cabal2
-rw-r--r--src/Language/PureScript/CodeGen/Externs.hs14
-rw-r--r--src/Language/PureScript/DeadCodeElimination.hs3
4 files changed, 12 insertions, 8 deletions
diff --git a/psci/Main.hs b/psci/Main.hs
index e1eea0c..94e4df7 100644
--- a/psci/Main.hs
+++ b/psci/Main.hs
@@ -178,6 +178,7 @@ completion = completeWord Nothing " \t\n\r" findCompletions
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
diff --git a/purescript.cabal b/purescript.cabal
index e0e39f9..feb2cf7 100644
--- a/purescript.cabal
+++ b/purescript.cabal
@@ -1,5 +1,5 @@
name: purescript
-version: 0.4.13
+version: 0.4.13.1
cabal-version: >=1.8
build-type: Custom
license: MIT
diff --git a/src/Language/PureScript/CodeGen/Externs.hs b/src/Language/PureScript/CodeGen/Externs.hs
index 9908770..f562c89 100644
--- a/src/Language/PureScript/CodeGen/Externs.hs
+++ b/src/Language/PureScript/CodeGen/Externs.hs
@@ -36,17 +36,17 @@ import Language.PureScript.Environment
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
diff --git a/src/Language/PureScript/DeadCodeElimination.hs b/src/Language/PureScript/DeadCodeElimination.hs
index 9af904c..81cd769 100644
--- a/src/Language/PureScript/DeadCodeElimination.hs
+++ b/src/Language/PureScript/DeadCodeElimination.hs
@@ -86,6 +86,9 @@ isUsed :: ModuleName -> Graph -> (Key -> Maybe Vertex) -> [Vertex] -> Declaratio
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