Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Print kinded tyvars in constructors for Hoogle #993

Merged
merged 1 commit into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions haddock-api/src/Haddock/Backends/Hoogle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,14 @@ ppCtor dflags dat subdocs con@ConDeclH98 {}
-- docs for con_names on why it is a list to begin with.
name = commaSeparate dflags . map unL $ getConNames con

resType = apps $ map (reL . HsTyVar NoExt NotPromoted . reL) $
(tcdName dat) : [hsTyVarName v | L _ v@(UserTyVar _ _) <- hsQTvExplicit $ tyClDeclTyVars dat]
resType = let c = HsTyVar NoExt NotPromoted (noLoc (tcdName dat))
as = map (tyVarBndr2Type . unLoc) (hsQTvExplicit $ tyClDeclTyVars dat)
in apps (map noLoc (c : as))

tyVarBndr2Type :: HsTyVarBndr GhcRn -> HsType GhcRn
tyVarBndr2Type (UserTyVar _ n) = HsTyVar NoExt NotPromoted n
tyVarBndr2Type (KindedTyVar _ n k) = HsKindSig NoExt (noLoc (HsTyVar NoExt NotPromoted n)) k
tyVarBndr2Type (XTyVarBndr _) = panic "haddock:ppCtor"

ppCtor dflags _dat subdocs con@(ConDeclGADT { })
= concatMap (lookupCon dflags subdocs) (getConNames con) ++ f
Expand Down
9 changes: 9 additions & 0 deletions hoogle-test/ref/Bug992/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

@package test
@version 0.0.0

module Bug992
data K (m :: * -> *)
K :: K (m :: * -> *)
5 changes: 5 additions & 0 deletions hoogle-test/src/Bug992/Bug992.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{-# LANGUAGE KindSignatures #-}

module Bug992 where

data K (m :: * -> *) = K