[project @ 2004-05-22 12:27:38 by panne]
[ghc-hetmet.git] / ghc / compiler / ghci / InteractiveUI.hs
index a1ec764..7a80aa5 100644 (file)
@@ -1,6 +1,6 @@
 {-# OPTIONS -#include "Linker.h" #-}
 -----------------------------------------------------------------------------
--- $Id: InteractiveUI.hs,v 1.162 2003/12/10 14:15:21 simonmar Exp $
+-- $Id: InteractiveUI.hs,v 1.165 2004/04/05 11:14:30 simonpj Exp $
 --
 -- GHC Interactive User Interface
 --
@@ -97,6 +97,7 @@ builtin_commands = [
   ("set",      keepGoing setCmd),
   ("show",     keepGoing showCmd),
   ("type",     keepGoing typeOfExpr),
+  ("kind",     keepGoing kindOfType),
   ("unset",    keepGoing unsetOptions),
   ("undef",     keepGoing undefineMacro),
   ("quit",     quit)
@@ -133,6 +134,7 @@ helpText = "\
 \   :show bindings            show the current bindings made at the prompt\n\ 
 \\n\ 
 \   :type <expr>              show the type of <expr>\n\ 
+\   :kind <type>              show the kind of <type>\n\ 
 \   :undef <cmd>              undefine user-defined command :<cmd>\n\ 
 \   :unset <option> ...               unset options\n\ 
 \   :quit                     exit GHCi\n\ 
@@ -668,6 +670,14 @@ typeOfExpr str
          Nothing    -> return ()
          Just tystr -> io (putStrLn tystr)
 
+kindOfType :: String -> GHCi ()
+kindOfType str 
+  = do cms <- getCmState
+       maybe_tystr <- io (cmKindOfType cms str)
+       case maybe_tystr of
+         Nothing    -> return ()
+         Just tystr -> io (putStrLn tystr)
+
 quit :: String -> GHCi Bool
 quit _ = return True
 
@@ -675,7 +685,7 @@ shellEscape :: String -> GHCi Bool
 shellEscape str = io (system str >> return False)
 
 -----------------------------------------------------------------------------
--- Browing a module's contents
+-- Browsing a module's contents
 
 browseCmd :: String -> GHCi ()
 browseCmd m =