mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-19 12:56:08 +00:00
Support :kind!
This commit is contained in:
parent
d929dfacfd
commit
486fc9f4e3
@ -677,6 +677,15 @@ evalCommand _ (Directive GetKind expr) state = wrapExecution state $ do
|
||||
let typeStr = showSDocUnqual flags $ ppr kind
|
||||
return $ formatType $ expr ++ " :: " ++ typeStr
|
||||
|
||||
evalCommand _ (Directive GetKindBang expr) state = wrapExecution state $ do
|
||||
write state $ "Kind!: " ++ expr
|
||||
(typ, kind) <- GHC.typeKind True expr
|
||||
flags <- getSessionDynFlags
|
||||
let kindStr = text expr <+> dcolon <+> ppr kind
|
||||
let typeStr = equals <+> ppr typ
|
||||
let finalStr = showSDocUnqual flags $ vcat [kindStr, typeStr]
|
||||
return $ formatType finalStr
|
||||
|
||||
evalCommand _ (Directive LoadFile names) state = wrapExecution state $ do
|
||||
write state $ "Load: " ++ names
|
||||
|
||||
|
@ -62,6 +62,7 @@ data DirectiveType = GetType -- ^ Get the type of an expression via ':type'
|
||||
| SearchHoogle -- ^ Search for something via Hoogle.
|
||||
| GetDoc -- ^ Get documentation for an identifier via Hoogle.
|
||||
| GetKind -- ^ Get the kind of a type via ':kind'.
|
||||
| GetKindBang -- ^ Get the kind and normalised type via ':kind!'.
|
||||
| LoadModule -- ^ Load and unload modules via ':module'.
|
||||
| SPrint -- ^ Print without evaluating via ':sprint'.
|
||||
deriving (Show, Eq)
|
||||
@ -277,6 +278,7 @@ parseDirective (':':directive) ln =
|
||||
[ (LoadModule, "module")
|
||||
, (GetType, "type")
|
||||
, (GetKind, "kind")
|
||||
, (GetKindBang, "kind!")
|
||||
, (GetInfo, "info")
|
||||
, (SearchHoogle, "hoogle")
|
||||
, (GetDoc, "documentation")
|
||||
|
Loading…
x
Reference in New Issue
Block a user