git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #345 from garyb/externs-imports

Retain imports in externs files

commitff0c4be0f2204aeb4035268abe53fc6f6f39286e authorPhil Freeman <paf31@cantab.net> dateThu 3 Apr 2014, 09:02 (13 years ago) parentabd72b6b35f4d2
1 file changed+7−7
src/Language/PureScript/CodeGen/Externs.hs+7−7
src/Language/PureScript/CodeGen/Externs.hs+7−7
@@ -36,17 +36,17 @@ import Language.PureScript.Environment
3636moduleToPs :: Module -> Environment -> String
3737moduleToPs (Module _ _ Nothing) _ = error "Module exports were not elaborated in moduleToPs"
3838moduleToPs (Module moduleName ds (Just exts)) env = intercalate "\n" . execWriter $ do
39− tell [ "module " ++ runModuleName moduleName ++ " where"
40− , "import Prelude ()" ]
41− mapM_ fixityToPs ds
39+ tell [ "module " ++ runModuleName moduleName ++ " where"]
40+ mapM_ declToPs ds
4241 mapM_ exportToPs exts
4342 where
4443
45− fixityToPs :: Declaration -> Writer [String] ()
46− fixityToPs (FixityDeclaration (Fixity assoc prec) ident) =
44+ declToPs :: Declaration -> Writer [String] ()
45+ declToPs (ImportDeclaration mn _ _) = tell ["import " ++ show mn ++ " ()"]
46+ declToPs (FixityDeclaration (Fixity assoc prec) ident) =
4747 tell [ unwords [ show assoc, show prec, ident ] ]
48− fixityToPs (PositionedDeclaration _ d) = fixityToPs d
49− fixityToPs _ = return ()
48+ declToPs (PositionedDeclaration _ d) = declToPs d
49+ declToPs _ = return ()
5050
5151 exportToPs :: DeclarationRef -> Writer [String] ()
5252 exportToPs (PositionedDeclarationRef _ r) = exportToPs r