git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Update Value to Expr in psci
commit3f728bc0ad3e3551bda202c09d265a99d092be77 authorGary Burgess <gary.burgess@gmail.com> dateMon 4 Aug 2014, 21:39 (12 years ago) parent4eb7696
2 files changed+10−10
psci/Commands.hs+4−4 psci/Main.hs+6−6
psci/Commands.hs+4−4
@@ -24,7 +24,7 @@ data Command
2424 -- |
2525 -- A purescript expression
2626 --
27− = Expression Value
27+ = Expression Expr
2828 -- |
2929 -- Show the help command
3030 --
@@ -48,14 +48,14 @@ data Command
4848 -- |
4949 -- Binds a value to a name
5050 --
51− | Let (Value -> Value)
51+ | Let (Expr -> Expr)
5252 -- |
5353 -- Find the type of an expression
5454 --
55− | TypeOf Value
55+ | TypeOf Expr
5656 -- |
5757 -- Find the kind of an expression
58− --
58+ --
5959 | KindOf Type
6060
6161-- |
psci/Main.hs+6−6
@@ -66,7 +66,7 @@ data PSCiState = PSCiState
6666 { psciImportedFilenames :: [FilePath]
6767 , psciImportedModuleNames :: [P.ModuleName]
6868 , psciLoadedModules :: [(FilePath, P.Module)]
69− , psciLetBindings :: [P.Value -> P.Value]
69+ , psciLetBindings :: [P.Expr -> P.Expr]
7070 }
7171
7272-- State helpers
@@ -92,7 +92,7 @@ updateModules modules st = st { psciLoadedModules = psciLoadedModules st ++ modu
9292-- |
9393-- Updates the state to have more let bindings.
9494--
95−updateLets :: (P.Value -> P.Value) -> PSCiState -> PSCiState
95+updateLets :: (P.Expr -> P.Expr) -> PSCiState -> PSCiState
9696updateLets name st = st { psciLetBindings = name : psciLetBindings st }
9797
9898-- File helpers
@@ -242,7 +242,7 @@ mkdirp = createDirectoryIfMissing True . takeDirectory
242242-- |
243243-- Makes a volatile module to execute the current expression.
244244--
245−createTemporaryModule :: Bool -> PSCiState -> P.Value -> P.Module
245+createTemporaryModule :: Bool -> PSCiState -> P.Expr -> P.Module
246246createTemporaryModule exec PSCiState{psciImportedModuleNames = imports, psciLetBindings = lets} value =
247247 let
248248 moduleName = P.ModuleName [P.ProperName "Main"]
@@ -278,7 +278,7 @@ indexFile = ".psci_modules" ++ pathSeparator : "index.js"
278278-- |
279279-- Takes a value declaration and evaluates it with the current state.
280280--
281−handleDeclaration :: P.Value -> PSCI ()
281+handleDeclaration :: P.Expr -> PSCI ()
282282handleDeclaration value = do
283283 st <- PSCI $ lift get
284284 let m = createTemporaryModule True st value
@@ -297,7 +297,7 @@ handleDeclaration value = do
297297-- |
298298-- Takes a value and prints its type
299299--
300−handleTypeOf :: P.Value -> PSCI ()
300+handleTypeOf :: P.Expr -> PSCI ()
301301handleTypeOf value = do
302302 st <- PSCI $ lift get
303303 let m = createTemporaryModule False st value
@@ -325,7 +325,7 @@ handleKindOf typ = do
325325 Just (_, typ') -> do
326326 let chk = P.CheckState env' 0 0 (Just mName)
327327 k = L.runStateT (P.unCheck (P.kindOf mName typ')) chk
328− case k of
328+ case k of
329329 Left errStack -> PSCI . outputStrLn . P.prettyPrintErrorStack False $ errStack
330330 Right (kind, _) -> PSCI . outputStrLn . P.prettyPrintKind $ kind
331331 Nothing -> PSCI $ outputStrLn "Could not find kind"