git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Update Value to Expr in psci
3f728bcGary Burgess
psci/Commands.hs+4−4
@@ -24,7 +24,7 @@ data Command
24 -- |
24 -- |
25 -- A purescript expression
25 -- A purescript expression
26 --
26 --
27− = Expression Value
27+ = Expression Expr
28 -- |
28 -- |
29 -- Show the help command
29 -- Show the help command
30 --
30 --
@@ -48,14 +48,14 @@ data Command
48 -- |
48 -- |
49 -- Binds a value to a name
49 -- Binds a value to a name
50 --
50 --
51− | Let (Value -> Value)
51+ | Let (Expr -> Expr)
52 -- |
52 -- |
53 -- Find the type of an expression
53 -- Find the type of an expression
54 --
54 --
55− | TypeOf Value
55+ | TypeOf Expr
56 -- |
56 -- |
57 -- Find the kind of an expression
57 -- Find the kind of an expression
58− --
58+ --
59 | KindOf Type
59 | KindOf Type
60
60
61-- |
61-- |
psci/Main.hs+6−6
@@ -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
@@ -242,7 +242,7 @@ 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 "Main"]
248 moduleName = P.ModuleName [P.ProperName "Main"]
@@ -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"