haskell - What does * (star) or other kinds mean in an instance list of haddock -


browsing haddocks of various packages come along instance documentations (control.category):

category k (coercion k) category * (->) 

or (control.monad.trans.identity):

monadtrans (identityt *) 

what here kind signature mean? doesn't show in source, have noticed seems occur in modules use polykinds extension. suspect typeapplication kind. e.g. last example means identityt monad transformer if it's first argument has kind *.

so questions are:

  • is interpretation correct , kind signature refer to?
  • in first category instance, how supposed know k kind , not type? or have know arity of category?
  • what source code analog syntax?

i not asking explanation of kinds.

to quote richard eisenberg’s recent post on haskell-cafe mailing list:

haddock struggles render types -xpolykinds enabled. problem ghc not require kind arguments written , not print them out (unless -fprint-explicit-kinds). haddock, believe, prints out kinds whenever -xpolykinds on. 2 different definitions same: it's 1 module has -xpolykinds , other doesn't.

the * kind of ordinary types. int has kind * (we write int :: *) while maybe has kind * -> *. typeable has kind forall k. k -> constraint, meaning it's polykinded. in first snippet below, * argument typeable instantiates k *, because type variable has kind *.

so yes, guessed, has polykinds. haddock renders these poly-kinded types sort of “explicit kind application”. happens category poly-kinded, having kind forall k. (k -> k -> *) -> constraint, haddock renders kind application alongside each instance.

in opinion, bug or misfeature of haddock, since there no equivalent source code analog far know. confusing, , don’t know of better way understand recognize way manifests , visually infer what’s going on context.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -