git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #530 and #531
8bd3795Benjamin Kovach]
psci/Main.hs+9−9
@@ -66,7 +66,7 @@ data PSCiState = PSCiState
66 { psciImportedFilenames :: [FilePath]
66 { psciImportedFilenames :: [FilePath]
67 , psciImportedModuleNames :: [P.ModuleName]
67 , psciImportedModuleNames :: [P.ModuleName]
68 , psciLoadedModules :: [(FilePath, P.Module)]
68 , psciLoadedModules :: [(FilePath, P.Module)]
69− , psciLetBindings :: [P.Value -> P.Value]
69+ , psciLetBindings :: [P.Expr -> P.Expr]
70 }
70 }
71
71
72-- State helpers
72-- State helpers
@@ -92,7 +92,7 @@ updateModules modules st = st { psciLoadedModules = psciLoadedModules st ++ modu
92-- |
92-- |
93-- Updates the state to have more let bindings.
93-- Updates the state to have more let bindings.
94--
94--
95−updateLets :: (P.Value -> P.Value) -> PSCiState -> PSCiState
95+updateLets :: (P.Expr -> P.Expr) -> PSCiState -> PSCiState
96updateLets name st = st { psciLetBindings = name : psciLetBindings st }
96updateLets name st = st { psciLetBindings = name : psciLetBindings st }
97
97
98-- File helpers
98-- File helpers
@@ -234,7 +234,7 @@ instance P.MonadMake Make where
234 mkdirp path
234 mkdirp path
235 U.writeFile path text
235 U.writeFile path text
236 liftError = either throwError return
236 liftError = either throwError return
237− progress s = unless (s == "Compiling Main") $ makeIO . U.putStrLn $ s
237+ progress s = unless (s == "Compiling $PSCI") $ makeIO . U.putStrLn $ s
238
238
239mkdirp :: FilePath -> IO ()
239mkdirp :: FilePath -> IO ()
240mkdirp = createDirectoryIfMissing True . takeDirectory
240mkdirp = createDirectoryIfMissing True . takeDirectory
@@ -242,11 +242,11 @@ mkdirp = createDirectoryIfMissing True . takeDirectory
242-- |
242-- |
243-- Makes a volatile module to execute the current expression.
243-- Makes a volatile module to execute the current expression.
244--
244--
245−createTemporaryModule :: Bool -> PSCiState -> P.Value -> P.Module
245+createTemporaryModule :: Bool -> PSCiState -> P.Expr -> P.Module
246createTemporaryModule exec PSCiState{psciImportedModuleNames = imports, psciLetBindings = lets} value =
246createTemporaryModule exec PSCiState{psciImportedModuleNames = imports, psciLetBindings = lets} value =
247 let
247 let
248 moduleName = P.ModuleName [P.ProperName "$PSCI"]
248 moduleName = P.ModuleName [P.ProperName "$PSCI"]
249− importDecl m = P.ImportDeclaration m Nothing Nothing
249+ importDecl m = P.ImportDeclaration m P.Unqualified Nothing
250 traceModule = P.ModuleName [P.ProperName "Debug", P.ProperName "Trace"]
250 traceModule = P.ModuleName [P.ProperName "Debug", P.ProperName "Trace"]
251 trace = P.Var (P.Qualified (Just traceModule) (P.Ident "print"))
251 trace = P.Var (P.Qualified (Just traceModule) (P.Ident "print"))
252 itValue = foldl (\x f -> f x) value lets
252 itValue = foldl (\x f -> f x) value lets
@@ -264,7 +264,7 @@ createTemporaryModuleForKind :: PSCiState -> P.Type -> P.Module
264createTemporaryModuleForKind PSCiState{psciImportedModuleNames = imports} typ =
264createTemporaryModuleForKind PSCiState{psciImportedModuleNames = imports} typ =
265 let
265 let
266 moduleName = P.ModuleName [P.ProperName "$PSCI"]
266 moduleName = P.ModuleName [P.ProperName "$PSCI"]
267− importDecl m = P.ImportDeclaration m Nothing Nothing
267+ importDecl m = P.ImportDeclaration m P.Unqualified Nothing
268 itDecl = P.TypeSynonymDeclaration (P.ProperName "IT") [] typ
268 itDecl = P.TypeSynonymDeclaration (P.ProperName "IT") [] typ
269 in
269 in
270 P.Module moduleName ((importDecl `map` imports) ++ [itDecl]) Nothing
270 P.Module moduleName ((importDecl `map` imports) ++ [itDecl]) Nothing
@@ -278,7 +278,7 @@ indexFile = ".psci_modules" ++ pathSeparator : "index.js"
278-- |
278-- |
279-- Takes a value declaration and evaluates it with the current state.
279-- Takes a value declaration and evaluates it with the current state.
280--
280--
281−handleDeclaration :: P.Value -> PSCI ()
281+handleDeclaration :: P.Expr -> PSCI ()
282handleDeclaration value = do
282handleDeclaration value = do
283 st <- PSCI $ lift get
283 st <- PSCI $ lift get
284 let m = createTemporaryModule True st value
284 let m = createTemporaryModule True st value
@@ -297,7 +297,7 @@ handleDeclaration value = do
297-- |
297-- |
298-- Takes a value and prints its type
298-- Takes a value and prints its type
299--
299--
300−handleTypeOf :: P.Value -> PSCI ()
300+handleTypeOf :: P.Expr -> PSCI ()
301handleTypeOf value = do
301handleTypeOf value = do
302 st <- PSCI $ lift get
302 st <- PSCI $ lift get
303 let m = createTemporaryModule False st value
303 let m = createTemporaryModule False st value
@@ -325,7 +325,7 @@ handleKindOf typ = do
325 Just (_, typ') -> do
325 Just (_, typ') -> do
326 let chk = P.CheckState env' 0 0 (Just mName)
326 let chk = P.CheckState env' 0 0 (Just mName)
327 k = L.runStateT (P.unCheck (P.kindOf mName typ')) chk
327 k = L.runStateT (P.unCheck (P.kindOf mName typ')) chk
328− case k of
328+ case k of
329 Left errStack -> PSCI . outputStrLn . P.prettyPrintErrorStack False $ errStack
329 Left errStack -> PSCI . outputStrLn . P.prettyPrintErrorStack False $ errStack
330 Right (kind, _) -> PSCI . outputStrLn . P.prettyPrintKind $ kind
330 Right (kind, _) -> PSCI . outputStrLn . P.prettyPrintKind $ kind
331 Nothing -> PSCI $ outputStrLn "Could not find kind"
331 Nothing -> PSCI $ outputStrLn "Could not find kind"