Why can't Haskell resolve the kind of [[]] (A list of lists)?
Why isn't it simply * -> *, as I can give it a type like Int, and get [[Int]], which is of kind *.
Introduction. GHCi is GHC's interactive environment, in which Haskell expressions can be interactively evaluated and programs can be interpreted.
This library offers interfaces which mediate interactions between the ghci interactive shell and iserv , GHC's out-of-process interpreter backend.
If you have installed the Haskell Platform, open a terminal and type ghci (the name of the executable of the GHC interpreter) at the command prompt. Alternatively, if you are on Windows, you may choose WinGHCi in the Start menu. And you are presented with a prompt. The Haskell system now attentively awaits your input.
I think it's the same as with Maybe Maybe
, although in the latter case the reason is perhaps clearer: the "outer" type constructor expects to be passed a type of kind *
, but sees a type constructor of type * -> *
(the "inner" Maybe
/ []
) and complains. If I'm correct, this is not really a problem with the :kind
functionality of GHCi, but rather with finding the correct syntax to express the composition of higher-kinded type constructors.
As a workaround, something like
:kind forall a. [[a]]
:kind forall a. Maybe (Maybe a)
can be used (with the appropriate language extension turned on -- ExistentialQuantification
, I think -- to enable the forall
syntax).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With