git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
start :k
commit0692ca08f88c195a8f47461c59c65014e4c84f3b authorBenjamin Kovach <south@Tom-Riddle.local> dateSat 2 Aug 2014, 08:51 (12 years ago) parente7ab8ab
3 files changed+18
psci/Commands.hs+5 psci/Main.hs+6 psci/Parser.hs+7
psci/Commands.hs+5
@@ -53,6 +53,10 @@ data Command
5353 -- Find the type of an expression
5454 --
5555 | TypeOf Value
56+ -- |
57+ -- Find the kind of an expression
58+ --
59+ | KindOf Value
5660
5761-- |
5862-- The help menu.
@@ -65,4 +69,5 @@ help =
6569 , [":q ", "Quit PSCi"]
6670 , [":r ", "Reset"]
6771 , [":t <expr> ", "Show the type of <expr>"]
72+ , [":k <expr> ", "Show the kind of <expr>"]
6873 ]
psci/Main.hs+6
@@ -296,6 +296,11 @@ handleTypeOf value = do
296296 Just (ty, _, _) -> PSCI . outputStrLn . P.prettyPrintType $ ty
297297 Nothing -> PSCI $ outputStrLn "Could not find type"
298298
299+-- |
300+-- Takes a value and prints its kind
301+--
302+handleKindOf :: P.Value -> PSCI ()
303+handleKindOf value = outputStrLn "Command not yet implemented"
299304-- Commands
300305
301306-- |
@@ -339,6 +344,7 @@ handleCommand Reset = do
339344 Left err -> psciIO $ putStrLn err >> exitFailure
340345 Right modules -> PSCI . lift $ put (PSCiState files defaultImports modules [])
341346handleCommand (TypeOf val) = handleTypeOf val
347+handleCommand (KindOf val) = handleKindOf val
342348handleCommand _ = PSCI $ outputStrLn "Unknown command"
343349
344350inputFiles :: Cmd.Term [FilePath]
psci/Parser.hs+7
@@ -90,3 +90,10 @@ psciReload = Reset <$ char 'r'
9090--
9191psciTypeOf :: Parsec String P.ParseState Command
9292psciTypeOf = 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)