git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix for modules with dotted names in psci
commit89970f70efb71aeaa6a444dd8d2bd4737321a82c authorGary Burgess <gary.burgess@gmail.com> dateFri 21 Feb 2014, 17:29 (13 years ago) parent2e16a83
1 file changed+6−6
psci/Main.hs+6−6
psci/Main.hs+6−6
@@ -48,7 +48,7 @@ import qualified Text.Parsec as Parsec (Parsec, eof, try)
4848-- The let bindings are partial,
4949-- because it makes more sense to apply the binding to the final evaluated expression.
5050--
51−data PSCI = PSCI [P.ProperName] [P.Module] [P.Value -> P.Value]
51+data PSCI = PSCI [P.ModuleName] [P.Module] [P.Value -> P.Value]
5252
5353-- State helpers
5454
@@ -70,7 +70,7 @@ ioToState = lift . lift
7070-- Updates the state to have more imported modules.
7171--
7272updateImports :: String -> PSCI -> PSCI
73−updateImports name (PSCI i m b) = PSCI (i ++ [P.ProperName name]) m b
73+updateImports name (PSCI i m b) = PSCI (P.moduleNameFromString name : i) m b
7474
7575-- |
7676-- Updates the state to have more loaded files.
@@ -88,8 +88,8 @@ updateLets name (PSCI i m b) = PSCI i m (b ++ [name])
8888-- |
8989-- Load the necessary modules.
9090--
91−defaultImports :: [P.ProperName]
92−defaultImports = [P.ProperName "Prelude"]
91+defaultImports :: [P.ModuleName]
92+defaultImports = [P.ModuleName [P.ProperName "Prelude"]]
9393
9494-- |
9595-- Locates the node executable.
@@ -191,7 +191,7 @@ options = P.Options True False True (Just "Main") True "PS" []
191191-- |
192192-- Makes a volatile module to execute the current expression.
193193--
194−createTemporaryModule :: Bool -> [P.ProperName] -> [P.Value -> P.Value] -> P.Value -> P.Module
194+createTemporaryModule :: Bool -> [P.ModuleName] -> [P.Value -> P.Value] -> P.Value -> P.Module
195195createTemporaryModule exec imports lets value =
196196 let
197197 moduleName = P.ModuleName [P.ProperName "Main"]
@@ -202,7 +202,7 @@ createTemporaryModule exec imports lets value =
202202 itDecl = P.ValueDeclaration (P.Ident "it") [] Nothing value'
203203 mainDecl = P.ValueDeclaration (P.Ident "main") [] Nothing (P.App trace (P.Var (P.Qualified Nothing (P.Ident "it"))))
204204 in
205− P.Module moduleName $ map (importDecl . P.ModuleName . return) imports ++ if exec then [itDecl, mainDecl] else [itDecl]
205+ P.Module moduleName $ map importDecl imports ++ if exec then [itDecl, mainDecl] else [itDecl]
206206
207207-- |
208208-- Takes a value declaration and evaluates it with the current state.