{-# OPTIONS_GHC -Wno-orphans      #-} -- Outputable and IEWrappedName
{-# LANGUAGE DataKinds            #-}
{-# LANGUAGE StandaloneDeriving   #-}
{-# LANGUAGE DeriveDataTypeable   #-}
{-# LANGUAGE FlexibleContexts     #-}
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeApplications     #-}
{-# LANGUAGE TypeFamilies         #-}
{-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow]
                                      -- in module Language.Haskell.Syntax.Extension
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998


GHC.Hs.ImpExp: Abstract syntax: imports, exports, interfaces
-}

module GHC.Hs.ImpExp
    ( module Language.Haskell.Syntax.ImpExp
    , module GHC.Hs.ImpExp
    ) where

import Language.Haskell.Syntax.Extension
import Language.Haskell.Syntax.Module.Name
import Language.Haskell.Syntax.ImpExp

import GHC.Prelude

import GHC.Types.SourceText   ( SourceText(..) )
import GHC.Types.SrcLoc
import GHC.Types.Name
import GHC.Types.PkgQual

import GHC.Parser.Annotation
import GHC.Hs.Extension

import GHC.Utils.Outputable
import GHC.Utils.Panic

import GHC.Unit.Module.Warnings

import Data.Data
import Data.Maybe
import GHC.Hs.Doc (LHsDoc)


{-
************************************************************************
*                                                                      *
    Import and export declaration lists
*                                                                      *
************************************************************************

One per import declaration in a module.
-}

type instance Anno (ImportDecl (GhcPass p)) = SrcSpanAnnA

-- | Given two possible located 'qualified' tokens, compute a style
-- (in a conforming Haskell program only one of the two can be not
-- 'Nothing'). This is called from "GHC.Parser".
importDeclQualifiedStyle :: Maybe EpaLocation
                         -> Maybe EpaLocation
                         -> (Maybe EpaLocation, ImportDeclQualifiedStyle)
importDeclQualifiedStyle :: Maybe EpaLocation
-> Maybe EpaLocation
-> (Maybe EpaLocation, ImportDeclQualifiedStyle)
importDeclQualifiedStyle Maybe EpaLocation
mPre Maybe EpaLocation
mPost =
  if Maybe EpaLocation -> Bool
forall a. Maybe a -> Bool
isJust Maybe EpaLocation
mPre then (Maybe EpaLocation
mPre, ImportDeclQualifiedStyle
QualifiedPre)
  else if Maybe EpaLocation -> Bool
forall a. Maybe a -> Bool
isJust Maybe EpaLocation
mPost then (Maybe EpaLocation
mPost,ImportDeclQualifiedStyle
QualifiedPost) else (Maybe EpaLocation
forall a. Maybe a
Nothing, ImportDeclQualifiedStyle
NotQualified)

-- | Convenience function to answer the question if an import decl. is
-- qualified.
isImportDeclQualified :: ImportDeclQualifiedStyle -> Bool
isImportDeclQualified :: ImportDeclQualifiedStyle -> Bool
isImportDeclQualified ImportDeclQualifiedStyle
NotQualified = Bool
False
isImportDeclQualified ImportDeclQualifiedStyle
_ = Bool
True


type instance ImportDeclPkgQual GhcPs = RawPkgQual
type instance ImportDeclPkgQual GhcRn = PkgQual
type instance ImportDeclPkgQual GhcTc = PkgQual

type instance XCImportDecl  GhcPs = XImportDeclPass
type instance XCImportDecl  GhcRn = XImportDeclPass
type instance XCImportDecl  GhcTc = DataConCantHappen
                                 -- Note [Pragma source text] in "GHC.Types.SourceText"

data XImportDeclPass = XImportDeclPass
    { XImportDeclPass -> EpAnn EpAnnImportDecl
ideclAnn        :: EpAnn EpAnnImportDecl
    , XImportDeclPass -> SourceText
ideclSourceText :: SourceText
    , XImportDeclPass -> Bool
ideclImplicit   :: Bool
        -- ^ GHC generates an `ImportDecl` to represent the invisible `import Prelude`
        -- that appears in any file that omits `import Prelude`, setting
        -- this field to indicate that the import doesn't appear in the
        -- original source. True => implicit import (of Prelude)
    }
    deriving (Typeable XImportDeclPass
Typeable XImportDeclPass =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> XImportDeclPass -> c XImportDeclPass)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c XImportDeclPass)
-> (XImportDeclPass -> Constr)
-> (XImportDeclPass -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c XImportDeclPass))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c XImportDeclPass))
-> ((forall b. Data b => b -> b)
    -> XImportDeclPass -> XImportDeclPass)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> XImportDeclPass -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> XImportDeclPass -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> XImportDeclPass -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> XImportDeclPass -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> XImportDeclPass -> m XImportDeclPass)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> XImportDeclPass -> m XImportDeclPass)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> XImportDeclPass -> m XImportDeclPass)
-> Data XImportDeclPass
XImportDeclPass -> Constr
XImportDeclPass -> DataType
(forall b. Data b => b -> b) -> XImportDeclPass -> XImportDeclPass
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> XImportDeclPass -> u
forall u. (forall d. Data d => d -> u) -> XImportDeclPass -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> XImportDeclPass -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> XImportDeclPass -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> XImportDeclPass -> m XImportDeclPass
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> XImportDeclPass -> m XImportDeclPass
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c XImportDeclPass
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> XImportDeclPass -> c XImportDeclPass
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c XImportDeclPass)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c XImportDeclPass)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> XImportDeclPass -> c XImportDeclPass
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> XImportDeclPass -> c XImportDeclPass
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c XImportDeclPass
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c XImportDeclPass
$ctoConstr :: XImportDeclPass -> Constr
toConstr :: XImportDeclPass -> Constr
$cdataTypeOf :: XImportDeclPass -> DataType
dataTypeOf :: XImportDeclPass -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c XImportDeclPass)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c XImportDeclPass)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c XImportDeclPass)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c XImportDeclPass)
$cgmapT :: (forall b. Data b => b -> b) -> XImportDeclPass -> XImportDeclPass
gmapT :: (forall b. Data b => b -> b) -> XImportDeclPass -> XImportDeclPass
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> XImportDeclPass -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> XImportDeclPass -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> XImportDeclPass -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> XImportDeclPass -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> XImportDeclPass -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> XImportDeclPass -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> XImportDeclPass -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> XImportDeclPass -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> XImportDeclPass -> m XImportDeclPass
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> XImportDeclPass -> m XImportDeclPass
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> XImportDeclPass -> m XImportDeclPass
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> XImportDeclPass -> m XImportDeclPass
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> XImportDeclPass -> m XImportDeclPass
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> XImportDeclPass -> m XImportDeclPass
Data)

type instance XXImportDecl  (GhcPass _) = DataConCantHappen

type instance Anno ModuleName = SrcSpanAnnA
type instance Anno [LocatedA (IE (GhcPass p))] = SrcSpanAnnL

deriving instance Data (IEWrappedName GhcPs)
deriving instance Data (IEWrappedName GhcRn)
deriving instance Data (IEWrappedName GhcTc)

deriving instance Eq (IEWrappedName GhcPs)
deriving instance Eq (IEWrappedName GhcRn)
deriving instance Eq (IEWrappedName GhcTc)

-- ---------------------------------------------------------------------

-- API Annotations types

data EpAnnImportDecl = EpAnnImportDecl
  { EpAnnImportDecl -> EpaLocation
importDeclAnnImport    :: EpaLocation
  , EpAnnImportDecl -> Maybe (EpaLocation, EpaLocation)
importDeclAnnPragma    :: Maybe (EpaLocation, EpaLocation)
  , EpAnnImportDecl -> Maybe EpaLocation
importDeclAnnSafe      :: Maybe EpaLocation
  , EpAnnImportDecl -> Maybe EpaLocation
importDeclAnnQualified :: Maybe EpaLocation
  , EpAnnImportDecl -> Maybe EpaLocation
importDeclAnnPackage   :: Maybe EpaLocation
  , EpAnnImportDecl -> Maybe EpaLocation
importDeclAnnAs        :: Maybe EpaLocation
  } deriving (Typeable EpAnnImportDecl
Typeable EpAnnImportDecl =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> EpAnnImportDecl -> c EpAnnImportDecl)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c EpAnnImportDecl)
-> (EpAnnImportDecl -> Constr)
-> (EpAnnImportDecl -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c EpAnnImportDecl))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c EpAnnImportDecl))
-> ((forall b. Data b => b -> b)
    -> EpAnnImportDecl -> EpAnnImportDecl)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> EpAnnImportDecl -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> EpAnnImportDecl -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> EpAnnImportDecl -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> EpAnnImportDecl -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> EpAnnImportDecl -> m EpAnnImportDecl)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> EpAnnImportDecl -> m EpAnnImportDecl)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> EpAnnImportDecl -> m EpAnnImportDecl)
-> Data EpAnnImportDecl
EpAnnImportDecl -> Constr
EpAnnImportDecl -> DataType
(forall b. Data b => b -> b) -> EpAnnImportDecl -> EpAnnImportDecl
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> EpAnnImportDecl -> u
forall u. (forall d. Data d => d -> u) -> EpAnnImportDecl -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EpAnnImportDecl -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EpAnnImportDecl -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EpAnnImportDecl -> m EpAnnImportDecl
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EpAnnImportDecl -> m EpAnnImportDecl
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EpAnnImportDecl
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EpAnnImportDecl -> c EpAnnImportDecl
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EpAnnImportDecl)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EpAnnImportDecl)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EpAnnImportDecl -> c EpAnnImportDecl
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> EpAnnImportDecl -> c EpAnnImportDecl
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EpAnnImportDecl
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c EpAnnImportDecl
$ctoConstr :: EpAnnImportDecl -> Constr
toConstr :: EpAnnImportDecl -> Constr
$cdataTypeOf :: EpAnnImportDecl -> DataType
dataTypeOf :: EpAnnImportDecl -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EpAnnImportDecl)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c EpAnnImportDecl)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EpAnnImportDecl)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c EpAnnImportDecl)
$cgmapT :: (forall b. Data b => b -> b) -> EpAnnImportDecl -> EpAnnImportDecl
gmapT :: (forall b. Data b => b -> b) -> EpAnnImportDecl -> EpAnnImportDecl
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EpAnnImportDecl -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> EpAnnImportDecl -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EpAnnImportDecl -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> EpAnnImportDecl -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> EpAnnImportDecl -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> EpAnnImportDecl -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> EpAnnImportDecl -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> EpAnnImportDecl -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EpAnnImportDecl -> m EpAnnImportDecl
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> EpAnnImportDecl -> m EpAnnImportDecl
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EpAnnImportDecl -> m EpAnnImportDecl
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EpAnnImportDecl -> m EpAnnImportDecl
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EpAnnImportDecl -> m EpAnnImportDecl
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> EpAnnImportDecl -> m EpAnnImportDecl
Data)

instance NoAnn EpAnnImportDecl where
  noAnn :: EpAnnImportDecl
noAnn = EpaLocation
-> Maybe (EpaLocation, EpaLocation)
-> Maybe EpaLocation
-> Maybe EpaLocation
-> Maybe EpaLocation
-> Maybe EpaLocation
-> EpAnnImportDecl
EpAnnImportDecl EpaLocation
forall a. NoAnn a => a
noAnn  Maybe (EpaLocation, EpaLocation)
forall a. Maybe a
Nothing  Maybe EpaLocation
forall a. Maybe a
Nothing  Maybe EpaLocation
forall a. Maybe a
Nothing  Maybe EpaLocation
forall a. Maybe a
Nothing  Maybe EpaLocation
forall a. Maybe a
Nothing
-- ---------------------------------------------------------------------

simpleImportDecl :: ModuleName -> ImportDecl GhcPs
simpleImportDecl :: ModuleName -> ImportDecl GhcPs
simpleImportDecl ModuleName
mn = ImportDecl {
      ideclExt :: XCImportDecl GhcPs
ideclExt        = EpAnn EpAnnImportDecl -> SourceText -> Bool -> XImportDeclPass
XImportDeclPass EpAnn EpAnnImportDecl
forall a. NoAnn a => a
noAnn SourceText
NoSourceText Bool
False,
      ideclName :: XRec GhcPs ModuleName
ideclName       = ModuleName -> GenLocated SrcSpanAnnA ModuleName
forall e a. HasAnnotation e => a -> GenLocated e a
noLocA ModuleName
mn,
      ideclPkgQual :: ImportDeclPkgQual GhcPs
ideclPkgQual    = ImportDeclPkgQual GhcPs
RawPkgQual
NoRawPkgQual,
      ideclSource :: IsBootInterface
ideclSource     = IsBootInterface
NotBoot,
      ideclSafe :: Bool
ideclSafe       = Bool
False,
      ideclQualified :: ImportDeclQualifiedStyle
ideclQualified  = ImportDeclQualifiedStyle
NotQualified,
      ideclAs :: Maybe (XRec GhcPs ModuleName)
ideclAs         = Maybe (XRec GhcPs ModuleName)
Maybe (GenLocated SrcSpanAnnA ModuleName)
forall a. Maybe a
Nothing,
      ideclImportList :: Maybe (ImportListInterpretation, XRec GhcPs [LIE GhcPs])
ideclImportList = Maybe (ImportListInterpretation, XRec GhcPs [LIE GhcPs])
Maybe
  (ImportListInterpretation,
   GenLocated SrcSpanAnnL [GenLocated SrcSpanAnnA (IE GhcPs)])
forall a. Maybe a
Nothing
    }

instance (OutputableBndrId p
         , Outputable (Anno (IE (GhcPass p)))
         , Outputable (ImportDeclPkgQual (GhcPass p)))
       => Outputable (ImportDecl (GhcPass p)) where
    ppr :: ImportDecl (GhcPass p) -> SDoc
ppr (ImportDecl { ideclExt :: forall pass. ImportDecl pass -> XCImportDecl pass
ideclExt = XCImportDecl (GhcPass p)
impExt, ideclName :: forall pass. ImportDecl pass -> XRec pass ModuleName
ideclName = XRec (GhcPass p) ModuleName
mod'
                    , ideclPkgQual :: forall pass. ImportDecl pass -> ImportDeclPkgQual pass
ideclPkgQual = ImportDeclPkgQual (GhcPass p)
pkg
                    , ideclSource :: forall pass. ImportDecl pass -> IsBootInterface
ideclSource = IsBootInterface
from, ideclSafe :: forall pass. ImportDecl pass -> Bool
ideclSafe = Bool
safe
                    , ideclQualified :: forall pass. ImportDecl pass -> ImportDeclQualifiedStyle
ideclQualified = ImportDeclQualifiedStyle
qual
                    , ideclAs :: forall pass. ImportDecl pass -> Maybe (XRec pass ModuleName)
ideclAs = Maybe (XRec (GhcPass p) ModuleName)
as, ideclImportList :: forall pass.
ImportDecl pass
-> Maybe (ImportListInterpretation, XRec pass [LIE pass])
ideclImportList = Maybe
  (ImportListInterpretation, XRec (GhcPass p) [LIE (GhcPass p)])
spec })
      = SDoc -> Int -> SDoc -> SDoc
hang ([SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"import", XCImportDecl (GhcPass p) -> IsBootInterface -> SDoc
ppr_imp XCImportDecl (GhcPass p)
impExt IsBootInterface
from, XCImportDecl (GhcPass p) -> SDoc
pp_implicit XCImportDecl (GhcPass p)
impExt, Bool -> SDoc
forall {doc}. IsLine doc => Bool -> doc
pp_safe Bool
safe,
                    ImportDeclQualifiedStyle -> Bool -> SDoc
forall {doc}. IsLine doc => ImportDeclQualifiedStyle -> Bool -> doc
pp_qual ImportDeclQualifiedStyle
qual Bool
False, ImportDeclPkgQual (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr ImportDeclPkgQual (GhcPass p)
pkg, GenLocated SrcSpanAnnA ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr XRec (GhcPass p) ModuleName
GenLocated SrcSpanAnnA ModuleName
mod', ImportDeclQualifiedStyle -> Bool -> SDoc
forall {doc}. IsLine doc => ImportDeclQualifiedStyle -> Bool -> doc
pp_qual ImportDeclQualifiedStyle
qual Bool
True, Maybe (GenLocated SrcSpanAnnA ModuleName) -> SDoc
forall {a}. Outputable a => Maybe a -> SDoc
pp_as Maybe (XRec (GhcPass p) ModuleName)
Maybe (GenLocated SrcSpanAnnA ModuleName)
as])
             Int
4 (Maybe
  (ImportListInterpretation,
   GenLocated SrcSpanAnnL [GenLocated SrcSpanAnnA (IE (GhcPass p))])
-> SDoc
forall {a} {l}.
Outputable a =>
Maybe (ImportListInterpretation, GenLocated l [a]) -> SDoc
pp_spec Maybe
  (ImportListInterpretation, XRec (GhcPass p) [LIE (GhcPass p)])
Maybe
  (ImportListInterpretation,
   GenLocated SrcSpanAnnL [GenLocated SrcSpanAnnA (IE (GhcPass p))])
spec)
      where
        pp_implicit :: XCImportDecl (GhcPass p) -> SDoc
pp_implicit XCImportDecl (GhcPass p)
ext =
            let implicit :: Bool
implicit = case forall (p :: Pass). IsPass p => GhcPass p
ghcPass @p of
                            GhcPass p
GhcPs | XImportDeclPass { ideclImplicit :: XImportDeclPass -> Bool
ideclImplicit = Bool
implicit } <- XCImportDecl (GhcPass p)
ext -> Bool
implicit
                            GhcPass p
GhcRn | XImportDeclPass { ideclImplicit :: XImportDeclPass -> Bool
ideclImplicit = Bool
implicit } <- XCImportDecl (GhcPass p)
ext -> Bool
implicit
                            GhcPass p
GhcTc -> DataConCantHappen -> Bool
forall a. DataConCantHappen -> a
dataConCantHappen XCImportDecl (GhcPass p)
DataConCantHappen
ext
            in if Bool
implicit then String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"(implicit)"
                           else SDoc
forall doc. IsOutput doc => doc
empty

        pp_qual :: ImportDeclQualifiedStyle -> Bool -> doc
pp_qual ImportDeclQualifiedStyle
QualifiedPre Bool
False = String -> doc
forall doc. IsLine doc => String -> doc
text String
"qualified" -- Prepositive qualifier/prepositive position.
        pp_qual ImportDeclQualifiedStyle
QualifiedPost Bool
True = String -> doc
forall doc. IsLine doc => String -> doc
text String
"qualified" -- Postpositive qualifier/postpositive position.
        pp_qual ImportDeclQualifiedStyle
QualifiedPre Bool
True = doc
forall doc. IsOutput doc => doc
empty -- Prepositive qualifier/postpositive position.
        pp_qual ImportDeclQualifiedStyle
QualifiedPost Bool
False = doc
forall doc. IsOutput doc => doc
empty -- Postpositive qualifier/prepositive position.
        pp_qual ImportDeclQualifiedStyle
NotQualified Bool
_ = doc
forall doc. IsOutput doc => doc
empty

        pp_safe :: Bool -> doc
pp_safe Bool
False   = doc
forall doc. IsOutput doc => doc
empty
        pp_safe Bool
True    = String -> doc
forall doc. IsLine doc => String -> doc
text String
"safe"

        pp_as :: Maybe a -> SDoc
pp_as Maybe a
Nothing   = SDoc
forall doc. IsOutput doc => doc
empty
        pp_as (Just a
a)  = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"as" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
a

        ppr_imp :: XCImportDecl (GhcPass p) -> IsBootInterface -> SDoc
ppr_imp XCImportDecl (GhcPass p)
ext IsBootInterface
IsBoot =
            let mSrcText :: SourceText
mSrcText = case forall (p :: Pass). IsPass p => GhcPass p
ghcPass @p of
                                GhcPass p
GhcPs | XImportDeclPass { ideclSourceText :: XImportDeclPass -> SourceText
ideclSourceText = SourceText
mst } <- XCImportDecl (GhcPass p)
ext -> SourceText
mst
                                GhcPass p
GhcRn | XImportDeclPass { ideclSourceText :: XImportDeclPass -> SourceText
ideclSourceText = SourceText
mst } <- XCImportDecl (GhcPass p)
ext -> SourceText
mst
                                GhcPass p
GhcTc -> DataConCantHappen -> SourceText
forall a. DataConCantHappen -> a
dataConCantHappen XCImportDecl (GhcPass p)
DataConCantHappen
ext
            in case SourceText
mSrcText of
                  SourceText
NoSourceText   -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"{-# SOURCE #-}"
                  SourceText FastString
src -> FastString -> SDoc
forall doc. IsLine doc => FastString -> doc
ftext FastString
src SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"#-}"
        ppr_imp XCImportDecl (GhcPass p)
_ IsBootInterface
NotBoot = SDoc
forall doc. IsOutput doc => doc
empty

        pp_spec :: Maybe (ImportListInterpretation, GenLocated l [a]) -> SDoc
pp_spec Maybe (ImportListInterpretation, GenLocated l [a])
Nothing             = SDoc
forall doc. IsOutput doc => doc
empty
        pp_spec (Just (ImportListInterpretation
Exactly, (L l
_ [a]
ies))) = [a] -> SDoc
forall {a}. Outputable a => [a] -> SDoc
ppr_ies [a]
ies
        pp_spec (Just (ImportListInterpretation
EverythingBut, (L l
_ [a]
ies))) = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"hiding" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [a] -> SDoc
forall {a}. Outputable a => [a] -> SDoc
ppr_ies [a]
ies

        ppr_ies :: [a] -> SDoc
ppr_ies []  = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"()"
        ppr_ies [a]
ies = Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
'(' SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [a] -> SDoc
forall {a}. Outputable a => [a] -> SDoc
interpp'SP [a]
ies SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
')'

{-
************************************************************************
*                                                                      *
\subsection{Imported and exported entities}
*                                                                      *
************************************************************************
-}

type instance XIEName    (GhcPass _) = NoExtField
type instance XIEPattern (GhcPass _) = EpaLocation
type instance XIEType    (GhcPass _) = EpaLocation
type instance XXIEWrappedName (GhcPass _) = DataConCantHappen

type instance Anno (IEWrappedName (GhcPass _)) = SrcSpanAnnA

type instance Anno (IE (GhcPass p)) = SrcSpanAnnA

-- The additional field of type 'Maybe (WarningTxt pass)' holds information
-- about export deprecation annotations and is thus set to Nothing when `IE`
-- is used in an import list (since export deprecation can only be used in exports)
type instance XIEVar       GhcPs = Maybe (LWarningTxt GhcPs)
type instance XIEVar       GhcRn = Maybe (LWarningTxt GhcRn)
type instance XIEVar       GhcTc = NoExtField

-- The additional field of type 'Maybe (WarningTxt pass)' holds information
-- about export deprecation annotations and is thus set to Nothing when `IE`
-- is used in an import list (since export deprecation can only be used in exports)
type instance XIEThingAbs  GhcPs = (Maybe (LWarningTxt GhcPs), [AddEpAnn])
type instance XIEThingAbs  GhcRn = (Maybe (LWarningTxt GhcRn), [AddEpAnn])
type instance XIEThingAbs  GhcTc = [AddEpAnn]

-- The additional field of type 'Maybe (WarningTxt pass)' holds information
-- about export deprecation annotations and is thus set to Nothing when `IE`
-- is used in an import list (since export deprecation can only be used in exports)
type instance XIEThingAll  GhcPs = (Maybe (LWarningTxt GhcPs), [AddEpAnn])
type instance XIEThingAll  GhcRn = (Maybe (LWarningTxt GhcRn), [AddEpAnn])
type instance XIEThingAll  GhcTc = [AddEpAnn]

-- The additional field of type 'Maybe (WarningTxt pass)' holds information
-- about export deprecation annotations and is thus set to Nothing when `IE`
-- is used in an import list (since export deprecation can only be used in exports)
type instance XIEThingWith GhcPs = (Maybe (LWarningTxt GhcPs), [AddEpAnn])
type instance XIEThingWith GhcRn = (Maybe (LWarningTxt GhcRn), [AddEpAnn])
type instance XIEThingWith GhcTc = [AddEpAnn]

-- The additional field of type 'Maybe (WarningTxt pass)' holds information
-- about export deprecation annotations and is thus set to Nothing when `IE`
-- is used in an import list (since export deprecation can only be used in exports)
type instance XIEModuleContents  GhcPs = (Maybe (LWarningTxt GhcPs), [AddEpAnn])
type instance XIEModuleContents  GhcRn = Maybe (LWarningTxt GhcRn)
type instance XIEModuleContents  GhcTc = NoExtField

type instance XIEGroup           (GhcPass _) = NoExtField
type instance XIEDoc             (GhcPass _) = NoExtField
type instance XIEDocNamed        (GhcPass _) = NoExtField
type instance XXIE               (GhcPass _) = DataConCantHappen

type instance Anno (LocatedA (IE (GhcPass p))) = SrcSpanAnnA

ieName :: IE (GhcPass p) -> IdP (GhcPass p)
ieName :: forall (p :: Pass). IE (GhcPass p) -> IdP (GhcPass p)
ieName (IEVar XIEVar (GhcPass p)
_ (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) Maybe (ExportDoc (GhcPass p))
_)           = IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
n
ieName (IEThingAbs  XIEThingAbs (GhcPass p)
_ (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) Maybe (ExportDoc (GhcPass p))
_)     = IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
n
ieName (IEThingWith XIEThingWith (GhcPass p)
_ (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) IEWildcard
_ [LIEWrappedName (GhcPass p)]
_ Maybe (ExportDoc (GhcPass p))
_) = IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
n
ieName (IEThingAll  XIEThingAll (GhcPass p)
_ (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) Maybe (ExportDoc (GhcPass p))
_)     = IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
n
ieName IE (GhcPass p)
_ = String -> IdGhcP p
forall a. HasCallStack => String -> a
panic String
"ieName failed pattern match!"

ieNames :: IE (GhcPass p) -> [IdP (GhcPass p)]
ieNames :: forall (p :: Pass). IE (GhcPass p) -> [IdP (GhcPass p)]
ieNames (IEVar       XIEVar (GhcPass p)
_ (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) Maybe (ExportDoc (GhcPass p))
_)      = [IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
n]
ieNames (IEThingAbs  XIEThingAbs (GhcPass p)
_ (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) Maybe (ExportDoc (GhcPass p))
_)      = [IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
n]
ieNames (IEThingAll  XIEThingAll (GhcPass p)
_ (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) Maybe (ExportDoc (GhcPass p))
_)      = [IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
n]
ieNames (IEThingWith XIEThingWith (GhcPass p)
_ (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) IEWildcard
_ [LIEWrappedName (GhcPass p)]
ns Maybe (ExportDoc (GhcPass p))
_) = IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
n IdGhcP p -> [IdGhcP p] -> [IdGhcP p]
forall a. a -> [a] -> [a]
: (GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p)) -> IdGhcP p)
-> [GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))]
-> [IdGhcP p]
forall a b. (a -> b) -> [a] -> [b]
map (IEWrappedName (GhcPass p) -> IdP (GhcPass p)
IEWrappedName (GhcPass p) -> IdGhcP p
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName (IEWrappedName (GhcPass p) -> IdGhcP p)
-> (GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
    -> IEWrappedName (GhcPass p))
-> GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> IdGhcP p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> IEWrappedName (GhcPass p)
forall l e. GenLocated l e -> e
unLoc) [LIEWrappedName (GhcPass p)]
[GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))]
ns
-- NB the above case does not include names of field selectors
ieNames (IEModuleContents {})     = []
ieNames (IEGroup          {})     = []
ieNames (IEDoc            {})     = []
ieNames (IEDocNamed       {})     = []

ieDeprecation :: forall p. IsPass p => IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
ieDeprecation :: forall (p :: Pass).
IsPass p =>
IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
ieDeprecation = (GenLocated SrcSpanAnnP (WarningTxt (GhcPass p))
 -> WarningTxt (GhcPass p))
-> Maybe (GenLocated SrcSpanAnnP (WarningTxt (GhcPass p)))
-> Maybe (WarningTxt (GhcPass p))
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap GenLocated SrcSpanAnnP (WarningTxt (GhcPass p))
-> WarningTxt (GhcPass p)
forall l e. GenLocated l e -> e
unLoc (Maybe (GenLocated SrcSpanAnnP (WarningTxt (GhcPass p)))
 -> Maybe (WarningTxt (GhcPass p)))
-> (IE (GhcPass p)
    -> Maybe (GenLocated SrcSpanAnnP (WarningTxt (GhcPass p))))
-> IE (GhcPass p)
-> Maybe (WarningTxt (GhcPass p))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GhcPass p -> IE (GhcPass p) -> Maybe (LWarningTxt (GhcPass p))
ie_deprecation (forall (p :: Pass). IsPass p => GhcPass p
ghcPass @p)
  where
    ie_deprecation :: GhcPass p -> IE (GhcPass p) -> Maybe (LWarningTxt (GhcPass p))
    ie_deprecation :: GhcPass p -> IE (GhcPass p) -> Maybe (LWarningTxt (GhcPass p))
ie_deprecation GhcPass p
GhcPs (IEVar XIEVar (GhcPass p)
xie LIEWrappedName (GhcPass p)
_ Maybe (ExportDoc (GhcPass p))
_) = Maybe (LWarningTxt (GhcPass p))
XIEVar (GhcPass p)
xie
    ie_deprecation GhcPass p
GhcPs (IEThingAbs (Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcPs))
xie, [AddEpAnn]
_) LIEWrappedName (GhcPass p)
_ Maybe (ExportDoc (GhcPass p))
_) = Maybe (LWarningTxt (GhcPass p))
Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcPs))
xie
    ie_deprecation GhcPass p
GhcPs (IEThingAll (Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcPs))
xie, [AddEpAnn]
_) LIEWrappedName (GhcPass p)
_ Maybe (ExportDoc (GhcPass p))
_) = Maybe (LWarningTxt (GhcPass p))
Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcPs))
xie
    ie_deprecation GhcPass p
GhcPs (IEThingWith (Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcPs))
xie, [AddEpAnn]
_) LIEWrappedName (GhcPass p)
_ IEWildcard
_ [LIEWrappedName (GhcPass p)]
_ Maybe (ExportDoc (GhcPass p))
_) = Maybe (LWarningTxt (GhcPass p))
Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcPs))
xie
    ie_deprecation GhcPass p
GhcPs (IEModuleContents (Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcPs))
xie, [AddEpAnn]
_) XRec (GhcPass p) ModuleName
_) = Maybe (LWarningTxt (GhcPass p))
Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcPs))
xie
    ie_deprecation GhcPass p
GhcRn (IEVar XIEVar (GhcPass p)
xie LIEWrappedName (GhcPass p)
_ Maybe (ExportDoc (GhcPass p))
_) = Maybe (LWarningTxt (GhcPass p))
XIEVar (GhcPass p)
xie
    ie_deprecation GhcPass p
GhcRn (IEThingAbs (Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcRn))
xie, [AddEpAnn]
_) LIEWrappedName (GhcPass p)
_ Maybe (ExportDoc (GhcPass p))
_) = Maybe (LWarningTxt (GhcPass p))
Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcRn))
xie
    ie_deprecation GhcPass p
GhcRn (IEThingAll (Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcRn))
xie, [AddEpAnn]
_) LIEWrappedName (GhcPass p)
_ Maybe (ExportDoc (GhcPass p))
_) = Maybe (LWarningTxt (GhcPass p))
Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcRn))
xie
    ie_deprecation GhcPass p
GhcRn (IEThingWith (Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcRn))
xie, [AddEpAnn]
_) LIEWrappedName (GhcPass p)
_ IEWildcard
_ [LIEWrappedName (GhcPass p)]
_ Maybe (ExportDoc (GhcPass p))
_) = Maybe (LWarningTxt (GhcPass p))
Maybe (GenLocated SrcSpanAnnP (WarningTxt GhcRn))
xie
    ie_deprecation GhcPass p
GhcRn (IEModuleContents XIEModuleContents (GhcPass p)
xie XRec (GhcPass p) ModuleName
_) = Maybe (LWarningTxt (GhcPass p))
XIEModuleContents (GhcPass p)
xie
    ie_deprecation GhcPass p
_ IE (GhcPass p)
_ = Maybe (LWarningTxt (GhcPass p))
Maybe (GenLocated SrcSpanAnnP (WarningTxt (GhcPass p)))
forall a. Maybe a
Nothing

ieWrappedLName :: IEWrappedName (GhcPass p) -> LIdP (GhcPass p)
ieWrappedLName :: forall (p :: Pass). IEWrappedName (GhcPass p) -> LIdP (GhcPass p)
ieWrappedLName (IEName    XIEName (GhcPass p)
_ (L Anno (IdGhcP p)
l IdGhcP p
n)) = Anno (IdGhcP p)
-> IdGhcP p -> GenLocated (Anno (IdGhcP p)) (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L Anno (IdGhcP p)
l IdGhcP p
n
ieWrappedLName (IEPattern XIEPattern (GhcPass p)
_ (L Anno (IdGhcP p)
l IdGhcP p
n)) = Anno (IdGhcP p)
-> IdGhcP p -> GenLocated (Anno (IdGhcP p)) (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L Anno (IdGhcP p)
l IdGhcP p
n
ieWrappedLName (IEType    XIEType (GhcPass p)
_ (L Anno (IdGhcP p)
l IdGhcP p
n)) = Anno (IdGhcP p)
-> IdGhcP p -> GenLocated (Anno (IdGhcP p)) (IdGhcP p)
forall l e. l -> e -> GenLocated l e
L Anno (IdGhcP p)
l IdGhcP p
n

ieWrappedName :: IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName :: forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName = GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
forall l e. GenLocated l e -> e
unLoc (GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p)
-> (IEWrappedName (GhcPass p)
    -> GenLocated (Anno (IdGhcP p)) (IdGhcP p))
-> IEWrappedName (GhcPass p)
-> IdGhcP p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IEWrappedName (GhcPass p) -> LIdP (GhcPass p)
IEWrappedName (GhcPass p)
-> GenLocated (Anno (IdGhcP p)) (IdGhcP p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> LIdP (GhcPass p)
ieWrappedLName


lieWrappedName :: LIEWrappedName (GhcPass p) -> IdP (GhcPass p)
lieWrappedName :: forall (p :: Pass). LIEWrappedName (GhcPass p) -> IdP (GhcPass p)
lieWrappedName (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) = IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
n

ieLWrappedName :: LIEWrappedName (GhcPass p) -> LIdP (GhcPass p)
ieLWrappedName :: forall (p :: Pass). LIEWrappedName (GhcPass p) -> LIdP (GhcPass p)
ieLWrappedName (L SrcSpanAnnA
_ IEWrappedName (GhcPass p)
n) = IEWrappedName (GhcPass p) -> LIdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> LIdP (GhcPass p)
ieWrappedLName IEWrappedName (GhcPass p)
n

replaceWrappedName :: IEWrappedName GhcPs -> IdP GhcRn -> IEWrappedName GhcRn
replaceWrappedName :: IEWrappedName GhcPs -> IdP GhcRn -> IEWrappedName GhcRn
replaceWrappedName (IEName    XIEName GhcPs
x (L SrcSpanAnnN
l RdrName
_)) IdP GhcRn
n = XIEName GhcRn -> LIdP GhcRn -> IEWrappedName GhcRn
forall p. XIEName p -> LIdP p -> IEWrappedName p
IEName    XIEName GhcPs
XIEName GhcRn
x (SrcSpanAnnN -> Name -> GenLocated SrcSpanAnnN Name
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnN
l IdP GhcRn
Name
n)
replaceWrappedName (IEPattern XIEPattern GhcPs
r (L SrcSpanAnnN
l RdrName
_)) IdP GhcRn
n = XIEPattern GhcRn -> LIdP GhcRn -> IEWrappedName GhcRn
forall p. XIEPattern p -> LIdP p -> IEWrappedName p
IEPattern XIEPattern GhcPs
XIEPattern GhcRn
r (SrcSpanAnnN -> Name -> GenLocated SrcSpanAnnN Name
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnN
l IdP GhcRn
Name
n)
replaceWrappedName (IEType    XIEType GhcPs
r (L SrcSpanAnnN
l RdrName
_)) IdP GhcRn
n = XIEType GhcRn -> LIdP GhcRn -> IEWrappedName GhcRn
forall p. XIEType p -> LIdP p -> IEWrappedName p
IEType    XIEType GhcPs
XIEType GhcRn
r (SrcSpanAnnN -> Name -> GenLocated SrcSpanAnnN Name
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnN
l IdP GhcRn
Name
n)

replaceLWrappedName :: LIEWrappedName GhcPs -> IdP GhcRn -> LIEWrappedName GhcRn
replaceLWrappedName :: LIEWrappedName GhcPs -> IdP GhcRn -> LIEWrappedName GhcRn
replaceLWrappedName (L SrcSpanAnnA
l IEWrappedName GhcPs
n) IdP GhcRn
n' = SrcSpanAnnA
-> IEWrappedName GhcRn
-> GenLocated SrcSpanAnnA (IEWrappedName GhcRn)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
l (IEWrappedName GhcPs -> IdP GhcRn -> IEWrappedName GhcRn
replaceWrappedName IEWrappedName GhcPs
n IdP GhcRn
n')

exportDocstring :: LHsDoc pass -> SDoc
exportDocstring :: forall pass. LHsDoc pass -> SDoc
exportDocstring LHsDoc pass
doc = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"docstring: " SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> LHsDoc pass -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsDoc pass
doc)

instance OutputableBndrId p => Outputable (IE (GhcPass p)) where
    ppr :: IE (GhcPass p) -> SDoc
ppr ie :: IE (GhcPass p)
ie@(IEVar       XIEVar (GhcPass p)
_     LIEWrappedName (GhcPass p)
var Maybe (LHsDoc (GhcPass p))
doc) =
      [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ [Maybe SDoc] -> [SDoc]
forall a. [Maybe a] -> [a]
catMaybes [ WarningTxt (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (WarningTxt (GhcPass p) -> SDoc)
-> Maybe (WarningTxt (GhcPass p)) -> Maybe SDoc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
forall (p :: Pass).
IsPass p =>
IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
ieDeprecation IE (GhcPass p)
ie
                      , SDoc -> Maybe SDoc
forall a. a -> Maybe a
Just (SDoc -> Maybe SDoc) -> SDoc -> Maybe SDoc
forall a b. (a -> b) -> a -> b
$ IEWrappedName (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> IEWrappedName (GhcPass p)
forall l e. GenLocated l e -> e
unLoc LIEWrappedName (GhcPass p)
GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
var)
                      , LHsDoc (GhcPass p) -> SDoc
forall pass. LHsDoc pass -> SDoc
exportDocstring (LHsDoc (GhcPass p) -> SDoc)
-> Maybe (LHsDoc (GhcPass p)) -> Maybe SDoc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (LHsDoc (GhcPass p))
doc
                      ]
    ppr ie :: IE (GhcPass p)
ie@(IEThingAbs  XIEThingAbs (GhcPass p)
_   LIEWrappedName (GhcPass p)
thing Maybe (LHsDoc (GhcPass p))
doc) =
      [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ [Maybe SDoc] -> [SDoc]
forall a. [Maybe a] -> [a]
catMaybes [ WarningTxt (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (WarningTxt (GhcPass p) -> SDoc)
-> Maybe (WarningTxt (GhcPass p)) -> Maybe SDoc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
forall (p :: Pass).
IsPass p =>
IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
ieDeprecation IE (GhcPass p)
ie
                      , SDoc -> Maybe SDoc
forall a. a -> Maybe a
Just (SDoc -> Maybe SDoc) -> SDoc -> Maybe SDoc
forall a b. (a -> b) -> a -> b
$ IEWrappedName (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> IEWrappedName (GhcPass p)
forall l e. GenLocated l e -> e
unLoc LIEWrappedName (GhcPass p)
GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
thing)
                      , LHsDoc (GhcPass p) -> SDoc
forall pass. LHsDoc pass -> SDoc
exportDocstring (LHsDoc (GhcPass p) -> SDoc)
-> Maybe (LHsDoc (GhcPass p)) -> Maybe SDoc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (LHsDoc (GhcPass p))
doc
                      ]
    ppr ie :: IE (GhcPass p)
ie@(IEThingAll  XIEThingAll (GhcPass p)
_   LIEWrappedName (GhcPass p)
thing Maybe (LHsDoc (GhcPass p))
doc) =
      [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ [Maybe SDoc] -> [SDoc]
forall a. [Maybe a] -> [a]
catMaybes [ WarningTxt (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (WarningTxt (GhcPass p) -> SDoc)
-> Maybe (WarningTxt (GhcPass p)) -> Maybe SDoc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
forall (p :: Pass).
IsPass p =>
IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
ieDeprecation IE (GhcPass p)
ie
                      , SDoc -> Maybe SDoc
forall a. a -> Maybe a
Just (SDoc -> Maybe SDoc) -> SDoc -> Maybe SDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hcat [IEWrappedName (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> IEWrappedName (GhcPass p)
forall l e. GenLocated l e -> e
unLoc LIEWrappedName (GhcPass p)
GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
thing)
                      , String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"(..)"]
                      , LHsDoc (GhcPass p) -> SDoc
forall pass. LHsDoc pass -> SDoc
exportDocstring (LHsDoc (GhcPass p) -> SDoc)
-> Maybe (LHsDoc (GhcPass p)) -> Maybe SDoc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (LHsDoc (GhcPass p))
doc
                      ]
    ppr ie :: IE (GhcPass p)
ie@(IEThingWith XIEThingWith (GhcPass p)
_ LIEWrappedName (GhcPass p)
thing IEWildcard
wc [LIEWrappedName (GhcPass p)]
withs Maybe (LHsDoc (GhcPass p))
doc) =
      [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ [Maybe SDoc] -> [SDoc]
forall a. [Maybe a] -> [a]
catMaybes [ WarningTxt (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (WarningTxt (GhcPass p) -> SDoc)
-> Maybe (WarningTxt (GhcPass p)) -> Maybe SDoc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
forall (p :: Pass).
IsPass p =>
IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
ieDeprecation IE (GhcPass p)
ie
                      , SDoc -> Maybe SDoc
forall a. a -> Maybe a
Just (SDoc -> Maybe SDoc) -> SDoc -> Maybe SDoc
forall a b. (a -> b) -> a -> b
$ IEWrappedName (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> IEWrappedName (GhcPass p)
forall l e. GenLocated l e -> e
unLoc LIEWrappedName (GhcPass p)
GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
thing) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens ([SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
fsep (SDoc -> [SDoc] -> [SDoc]
forall doc. IsLine doc => doc -> [doc] -> [doc]
punctuate SDoc
forall doc. IsLine doc => doc
comma [SDoc]
ppWiths))
                      , LHsDoc (GhcPass p) -> SDoc
forall pass. LHsDoc pass -> SDoc
exportDocstring (LHsDoc (GhcPass p) -> SDoc)
-> Maybe (LHsDoc (GhcPass p)) -> Maybe SDoc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (LHsDoc (GhcPass p))
doc
                      ]
      where
        ppWiths :: [SDoc]
ppWiths =
          case IEWildcard
wc of
              IEWildcard
NoIEWildcard ->
                (GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p)) -> SDoc)
-> [GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (IEWrappedName (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (IEWrappedName (GhcPass p) -> SDoc)
-> (GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
    -> IEWrappedName (GhcPass p))
-> GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> IEWrappedName (GhcPass p)
forall l e. GenLocated l e -> e
unLoc) [LIEWrappedName (GhcPass p)]
[GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))]
withs
              IEWildcard Int
pos ->
                let ([SDoc]
bs, [SDoc]
as) = Int -> [SDoc] -> ([SDoc], [SDoc])
forall a. Int -> [a] -> ([a], [a])
splitAt Int
pos ((GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p)) -> SDoc)
-> [GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (IEWrappedName (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (IEWrappedName (GhcPass p) -> SDoc)
-> (GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
    -> IEWrappedName (GhcPass p))
-> GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))
-> IEWrappedName (GhcPass p)
forall l e. GenLocated l e -> e
unLoc) [LIEWrappedName (GhcPass p)]
[GenLocated SrcSpanAnnA (IEWrappedName (GhcPass p))]
withs)
                in [SDoc]
bs [SDoc] -> [SDoc] -> [SDoc]
forall a. [a] -> [a] -> [a]
++ [String -> SDoc
forall doc. IsLine doc => String -> doc
text String
".."] [SDoc] -> [SDoc] -> [SDoc]
forall a. [a] -> [a] -> [a]
++ [SDoc]
as
    ppr ie :: IE (GhcPass p)
ie@(IEModuleContents XIEModuleContents (GhcPass p)
_ XRec (GhcPass p) ModuleName
mod')
        = [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ [Maybe SDoc] -> [SDoc]
forall a. [Maybe a] -> [a]
catMaybes [WarningTxt (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr (WarningTxt (GhcPass p) -> SDoc)
-> Maybe (WarningTxt (GhcPass p)) -> Maybe SDoc
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
forall (p :: Pass).
IsPass p =>
IE (GhcPass p) -> Maybe (WarningTxt (GhcPass p))
ieDeprecation IE (GhcPass p)
ie, SDoc -> Maybe SDoc
forall a. a -> Maybe a
Just (SDoc -> Maybe SDoc) -> SDoc -> Maybe SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"module" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> GenLocated SrcSpanAnnA ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr XRec (GhcPass p) ModuleName
GenLocated SrcSpanAnnA ModuleName
mod']
    ppr (IEGroup XIEGroup (GhcPass p)
_ Int
n LHsDoc (GhcPass p)
_)           = String -> SDoc
forall doc. IsLine doc => String -> doc
text (String
"<IEGroup: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
">")
    ppr (IEDoc XIEDoc (GhcPass p)
_ LHsDoc (GhcPass p)
doc)             = LHsDoc (GhcPass p) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsDoc (GhcPass p)
doc
    ppr (IEDocNamed XIEDocNamed (GhcPass p)
_ String
string)     = String -> SDoc
forall doc. IsLine doc => String -> doc
text (String
"<IEDocNamed: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
string String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
">")

instance (HasOccName (IdP (GhcPass p)), OutputableBndrId p) => HasOccName (IEWrappedName (GhcPass p)) where
  occName :: IEWrappedName (GhcPass p) -> OccName
occName IEWrappedName (GhcPass p)
w = IdGhcP p -> OccName
forall name. HasOccName name => name -> OccName
occName (IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
w)

instance OutputableBndrId p => OutputableBndr (IEWrappedName (GhcPass p)) where
  pprBndr :: BindingSite -> IEWrappedName (GhcPass p) -> SDoc
pprBndr BindingSite
bs   IEWrappedName (GhcPass p)
w = BindingSite -> IdGhcP p -> SDoc
forall a. OutputableBndr a => BindingSite -> a -> SDoc
pprBndr BindingSite
bs   (IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
w)
  pprPrefixOcc :: IEWrappedName (GhcPass p) -> SDoc
pprPrefixOcc IEWrappedName (GhcPass p)
w = IdGhcP p -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc (IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
w)
  pprInfixOcc :: IEWrappedName (GhcPass p) -> SDoc
pprInfixOcc  IEWrappedName (GhcPass p)
w = IdGhcP p -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprInfixOcc  (IEWrappedName (GhcPass p) -> IdP (GhcPass p)
forall (p :: Pass). IEWrappedName (GhcPass p) -> IdP (GhcPass p)
ieWrappedName IEWrappedName (GhcPass p)
w)

instance OutputableBndrId p => Outputable (IEWrappedName (GhcPass p)) where
  ppr :: IEWrappedName (GhcPass p) -> SDoc
ppr (IEName    XIEName (GhcPass p)
_ (L Anno (IdGhcP p)
_ IdGhcP p
n)) = IdGhcP p -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc IdGhcP p
n
  ppr (IEPattern XIEPattern (GhcPass p)
_ (L Anno (IdGhcP p)
_ IdGhcP p
n)) = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"pattern" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> IdGhcP p -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc IdGhcP p
n
  ppr (IEType    XIEType (GhcPass p)
_ (L Anno (IdGhcP p)
_ IdGhcP p
n)) = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"type"    SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> IdGhcP p -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc IdGhcP p
n

pprImpExp :: (HasOccName name, OutputableBndr name) => name -> SDoc
pprImpExp :: forall name. (HasOccName name, OutputableBndr name) => name -> SDoc
pprImpExp name
name = SDoc
type_pref SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> name -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc name
name
    where
    occ :: OccName
occ = name -> OccName
forall name. HasOccName name => name -> OccName
occName name
name
    type_pref :: SDoc
type_pref | OccName -> Bool
isTcOcc OccName
occ Bool -> Bool -> Bool
&& OccName -> Bool
isSymOcc OccName
occ = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"type"
              | Bool
otherwise                   = SDoc
forall doc. IsOutput doc => doc
empty