git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
start :k
0692ca0Benjamin Kovach
psci/Commands.hs+5
@@ -53,6 +53,10 @@ data Command
53 -- Find the type of an expression
53 -- Find the type of an expression
54 --
54 --
55 | TypeOf Value
55 | TypeOf Value
56+ -- |
57+ -- Find the kind of an expression
58+ --
59+ | KindOf Value
56
60
57-- |
61-- |
58-- The help menu.
62-- The help menu.
@@ -65,4 +69,5 @@ help =
65 , [":q ", "Quit PSCi"]
69 , [":q ", "Quit PSCi"]
66 , [":r ", "Reset"]
70 , [":r ", "Reset"]
67 , [":t <expr> ", "Show the type of <expr>"]
71 , [":t <expr> ", "Show the type of <expr>"]
72+ , [":k <expr> ", "Show the kind of <expr>"]
68 ]
73 ]
psci/Main.hs+6
@@ -296,6 +296,11 @@ handleTypeOf value = do
296 Just (ty, _, _) -> PSCI . outputStrLn . P.prettyPrintType $ ty
296 Just (ty, _, _) -> PSCI . outputStrLn . P.prettyPrintType $ ty
297 Nothing -> PSCI $ outputStrLn "Could not find type"
297 Nothing -> PSCI $ outputStrLn "Could not find type"
298
298
299+-- |
300+-- Takes a value and prints its kind
301+--
302+handleKindOf :: P.Value -> PSCI ()
303+handleKindOf value = outputStrLn "Command not yet implemented"
299-- Commands
304-- Commands
300
305
301-- |
306-- |
@@ -339,6 +344,7 @@ handleCommand Reset = do
339 Left err -> psciIO $ putStrLn err >> exitFailure
344 Left err -> psciIO $ putStrLn err >> exitFailure
340 Right modules -> PSCI . lift $ put (PSCiState files defaultImports modules [])
345 Right modules -> PSCI . lift $ put (PSCiState files defaultImports modules [])
341handleCommand (TypeOf val) = handleTypeOf val
346handleCommand (TypeOf val) = handleTypeOf val
347+handleCommand (KindOf val) = handleKindOf val
342handleCommand _ = PSCI $ outputStrLn "Unknown command"
348handleCommand _ = PSCI $ outputStrLn "Unknown command"
343
349
344inputFiles :: Cmd.Term [FilePath]
350inputFiles :: Cmd.Term [FilePath]
psci/Parser.hs+7
@@ -90,3 +90,10 @@ psciReload = Reset <$ char 'r'
90--
90--
91psciTypeOf :: Parsec String P.ParseState Command
91psciTypeOf :: Parsec String P.ParseState Command
92psciTypeOf = TypeOf <$> (char 't' *> P.whiteSpace *> P.parseValue)
92psciTypeOf = TypeOf <$> (char 't' *> P.whiteSpace *> P.parseValue)
93+
94+
95+-- |
96+-- Parses 'Commands.KindOf' command.
97+--
98+psciKindOf :: Parsec String P.ParseState Command
99+psciKindOf = KindOf <$> (char 'k' *> P.whiteSpace *> P.parseValue)