@@ -300,23 +300,20 @@ handleTypeOf value = do
300300-- |
301301-- Takes a value and prints its kind
302302--
303−handleKindOf :: P.Value -> PSCI ()
304−handleKindOf value = do
303+handleKindOf :: P.Type -> PSCI ()
304+handleKindOf typ = do
305305 st <- PSCI $ lift get
306− let m = createTemporaryModule False st value
306+ let m = createTemporaryModule False st (P.BooleanLiteral True) -- dummy value
307307 mName = P.ModuleName [P.ProperName "Main"]
308308 e <- psciIO . runMake $ P.make modulesDir options (psciLoadedModules st ++ [("Main.purs", m)])
309309 case e of
310310 Left err -> PSCI $ outputStrLn err
311− Right env' ->
312− case M.lookup (mName, P.Ident "it") (P.names env') of
313− Just (ty, _, _) -> do
314− let st = P.CheckState env' 0 0 (Just mName)
315− k = L.runStateT (P.unCheck (P.kindOf mName ty)) st
316− case k of
317− Left errStack -> PSCI . outputStrLn . P.prettyPrintErrorStack False $ errStack
318− Right (kind, _) -> PSCI . outputStrLn . P.prettyPrintKind $ kind
319− Nothing -> PSCI $ outputStrLn "Could not find kind"
311+ Right env' -> do
312+ let st = P.CheckState env' 0 0 (Just mName)
313+ k = L.runStateT (P.unCheck (P.kindOf mName typ)) st
314+ case k of
315+ Left errStack -> PSCI . outputStrLn . P.prettyPrintErrorStack False $ errStack
316+ Right (kind, _) -> PSCI . outputStrLn . P.prettyPrintKind $ kind
320317
321318-- Commands
322319
@@ -361,7 +358,7 @@ handleCommand Reset = do
361358 Left err -> psciIO $ putStrLn err >> exitFailure
362359 Right modules -> PSCI . lift $ put (PSCiState files defaultImports modules [])
363360handleCommand (TypeOf val) = handleTypeOf val
364−handleCommand (KindOf val) = handleKindOf val
361+handleCommand (KindOf typ) = handleKindOf typ
365362handleCommand _ = PSCI $ outputStrLn "Unknown command"
366363
367364inputFiles :: Cmd.Term [FilePath]