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

Follow GHC HEAD's HsTypes.Promoted -> BasicTypes.PromotionFlag change #970

Merged
merged 1 commit into from
Nov 15, 2018
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
3 changes: 2 additions & 1 deletion haddock-api/src/Haddock/Backends/Hoogle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module Haddock.Backends.Hoogle (
ppHoogle
) where

import BasicTypes (OverlapFlag(..), OverlapMode(..), SourceText(..))
import BasicTypes ( OverlapFlag(..), OverlapMode(..), SourceText(..)
, PromotionFlag(..) )
import InstEnv (ClsInst(..))
import Documentation.Haddock.Markup
import Haddock.GhcUtils
Expand Down
5 changes: 3 additions & 2 deletions haddock-api/src/Haddock/Backends/LaTeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Haddock.GhcUtils
import Pretty hiding (Doc, quote)
import qualified Pretty

import BasicTypes ( PromotionFlag(..) )
import GHC
import OccName
import Name ( nameOccName )
Expand Down Expand Up @@ -1027,7 +1028,7 @@ ppr_mono_ty (HsFunTy _ ty1 ty2) u

ppr_mono_ty (HsBangTy _ b ty) u = ppBang b <> ppLParendType u ty
ppr_mono_ty (HsTyVar _ NotPromoted (L _ name)) _ = ppDocName name
ppr_mono_ty (HsTyVar _ Promoted (L _ name)) _ = char '\'' <> ppDocName name
ppr_mono_ty (HsTyVar _ IsPromoted (L _ name)) _ = char '\'' <> ppDocName name
ppr_mono_ty (HsTupleTy _ con tys) u = tupleParens con (map (ppLType u) tys)
ppr_mono_ty (HsSumTy _ tys) u = sumParens (map (ppLType u) tys)
ppr_mono_ty (HsKindSig _ ty kind) u = parens (ppr_mono_lty ty u <+> dcolon u <+> ppLKind u kind)
Expand All @@ -1036,7 +1037,7 @@ ppr_mono_ty (HsIParamTy _ (L _ n) ty) u = brackets (ppIPName n <+> dcolon u <+>
ppr_mono_ty (HsSpliceTy {}) _ = error "ppr_mono_ty HsSpliceTy"
ppr_mono_ty (HsRecTy {}) _ = text "{..}"
ppr_mono_ty (XHsType (NHsCoreTy {})) _ = error "ppr_mono_ty HsCoreTy"
ppr_mono_ty (HsExplicitListTy _ Promoted tys) u = Pretty.quote $ brackets $ hsep $ punctuate comma $ map (ppLType u) tys
ppr_mono_ty (HsExplicitListTy _ IsPromoted tys) u = Pretty.quote $ brackets $ hsep $ punctuate comma $ map (ppLType u) tys
ppr_mono_ty (HsExplicitListTy _ NotPromoted tys) u = brackets $ hsep $ punctuate comma $ map (ppLType u) tys
ppr_mono_ty (HsExplicitTupleTy _ tys) u = Pretty.quote $ parenList $ map (ppLType u) tys

Expand Down
3 changes: 2 additions & 1 deletion haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import qualified Data.Map as Map
import Data.Maybe
import Text.XHtml hiding ( name, title, p, quote )

import BasicTypes (PromotionFlag(..))
import GHC hiding (LexicalFixity(..))
import GHC.Exts
import Name
Expand Down Expand Up @@ -1183,7 +1184,7 @@ ppr_mono_ty (HsRecTy {}) _ _ _ = toHtml "{..}"
-- placeholder in the signature, which is followed by the field
-- declarations.
ppr_mono_ty (XHsType (NHsCoreTy {})) _ _ _ = error "ppr_mono_ty HsCoreTy"
ppr_mono_ty (HsExplicitListTy _ Promoted tys) u q _ = promoQuote $ brackets $ hsep $ punctuate comma $ map (ppLType u q HideEmptyContexts) tys
ppr_mono_ty (HsExplicitListTy _ IsPromoted tys) u q _ = promoQuote $ brackets $ hsep $ punctuate comma $ map (ppLType u q HideEmptyContexts) tys
ppr_mono_ty (HsExplicitListTy _ NotPromoted tys) u q _ = brackets $ hsep $ punctuate comma $ map (ppLType u q HideEmptyContexts) tys
ppr_mono_ty (HsExplicitTupleTy _ tys) u q _ = promoQuote $ parenList $ map (ppLType u q HideEmptyContexts) tys

Expand Down
9 changes: 5 additions & 4 deletions haddock-api/src/Haddock/Convert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module Haddock.Convert where
-- instance heads, which aren't TyThings, so just export everything.

import Bag ( emptyBag )
import BasicTypes ( TupleSort(..), SourceText(..), LexicalFixity(..) )
import BasicTypes ( TupleSort(..), SourceText(..), LexicalFixity(..)
, PromotionFlag(..) )
import Class
import CoAxiom
import ConLike
Expand Down Expand Up @@ -468,13 +469,13 @@ synifyType _ (TyConApp tc tys)
| getName tc == listTyConName, [ty] <- vis_tys =
noLoc $ HsListTy noExt (synifyType WithinType ty)
| tc == promotedNilDataCon, [] <- vis_tys
= noLoc $ HsExplicitListTy noExt Promoted []
= noLoc $ HsExplicitListTy noExt IsPromoted []
| tc == promotedConsDataCon
, [ty1, ty2] <- vis_tys
= let hTy = synifyType WithinType ty1
in case synifyType WithinType ty2 of
tTy | L _ (HsExplicitListTy _ Promoted tTy') <- stripKindSig tTy
-> noLoc $ HsExplicitListTy noExt Promoted (hTy : tTy')
tTy | L _ (HsExplicitListTy _ IsPromoted tTy') <- stripKindSig tTy
-> noLoc $ HsExplicitListTy noExt IsPromoted (hTy : tTy')
| otherwise
-> noLoc $ HsOpTy noExt hTy (noLoc $ getName tc) tTy
-- ditto for implicit parameter tycons
Expand Down
2 changes: 1 addition & 1 deletion haddock-api/src/Haddock/Interface/Create.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import Bag
import RdrName
import TcRnTypes
import FastString ( unpackFS, fastStringToByteString)
import BasicTypes ( StringLiteral(..), SourceText(..) )
import BasicTypes ( StringLiteral(..), SourceText(..), PromotionFlag(..) )
import qualified Outputable as O
import HsDecls ( getConArgs )

Expand Down
2 changes: 1 addition & 1 deletion haddock-api/src/Haddock/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import Data.Map (Map)
import Data.Data (Data)
import qualified Data.Map as Map
import Documentation.Haddock.Types
import BasicTypes (Fixity(..))
import BasicTypes (Fixity(..), PromotionFlag(..))

import GHC hiding (NoLink)
import DynFlags (Language)
Expand Down
1 change: 1 addition & 0 deletions haddock-api/src/Haddock/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import Documentation.Haddock.Doc (emptyMetaDoc)
import Haddock.Types
import Haddock.GhcUtils

import BasicTypes ( PromotionFlag(..) )
import GHC
import Name
import HsTypes (extFieldOcc)
Expand Down