    {-# LANGUAGE AllowAmbiguousTypes #-} -- used to pass the phase to ppr_mult_ann since MultAnn is a type family
    {-# LANGUAGE CPP #-}
    {-# LANGUAGE ConstraintKinds #-}
    {-# LANGUAGE DataKinds #-}
    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE FlexibleContexts #-}
    {-# LANGUAGE FlexibleInstances #-}
    {-# LANGUAGE LambdaCase #-}
    {-# LANGUAGE ScopedTypeVariables #-}
    {-# LANGUAGE TypeApplications #-}
    {-# LANGUAGE TypeFamilies #-}
    {-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow]
                                          -- in module Language.Haskell.Syntax.Extension

    {-# OPTIONS_GHC -Wno-orphans #-} -- Outputable

    {-
    (c) The University of Glasgow 2006
    (c) The GRASP/AQUA Project, Glasgow University, 1992-1998

    \section[HsBinds]{Abstract syntax: top-level bindings and signatures}

    Datatype for: @BindGroup@, @Bind@, @Sig@, @Bind@.
    -}

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

    import GHC.Prelude

    import Language.Haskell.Syntax.Extension
    import Language.Haskell.Syntax.Binds

    import {-# SOURCE #-} GHC.Hs.Expr ( pprExpr, pprFunBind, pprPatBind )
    import {-# SOURCE #-} GHC.Hs.Pat  (pprLPat )

    import GHC.Types.Tickish
    import GHC.Hs.Extension
    import GHC.Parser.Annotation
    import GHC.Hs.Type
    import GHC.Tc.Types.Evidence
    import GHC.Core.Type
    import GHC.Types.Name.Set
    import GHC.Types.Basic
    import GHC.Types.SourceText
    import GHC.Types.SrcLoc as SrcLoc
    import GHC.Types.Var
    import GHC.Data.BooleanFormula (LBooleanFormula)
    import GHC.Types.Name

    import GHC.Utils.Outputable
    import GHC.Utils.Panic
    import GHC.Utils.Misc ((<||>))

    import Data.Function
    import Data.List (sortBy)
    import Data.Data (Data)

    {-
    ************************************************************************
    *                                                                      *
    \subsection{Bindings: @BindGroup@}
    *                                                                      *
    ************************************************************************

    Global bindings (where clauses)
    -}

    -- the ...LR datatypes are parameterized by two id types,
    -- one for the left and one for the right.

    type instance XHsValBinds      (GhcPass pL) (GhcPass pR) = EpAnn (AnnList (EpToken "where"))
    type instance XHsIPBinds       (GhcPass pL) (GhcPass pR) = EpAnn (AnnList (EpToken "where"))
    type instance XEmptyLocalBinds (GhcPass pL) (GhcPass pR) = NoExtField
    type instance XXHsLocalBindsLR (GhcPass pL) (GhcPass pR) = DataConCantHappen

    -- ---------------------------------------------------------------------
    -- Deal with ValBindsOut

    -- TODO: make this the only type for ValBinds
    data NHsValBindsLR idL
      = NValBinds
          [(RecFlag, LHsBinds idL)]
          [LSig GhcRn]

    type instance XValBinds    (GhcPass pL) (GhcPass pR) = AnnSortKey BindTag
    type instance XXValBindsLR (GhcPass pL) pR
                = NHsValBindsLR (GhcPass pL)

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

    type instance XFunBind    (GhcPass pL) GhcPs = NoExtField
    type instance XFunBind    (GhcPass pL) GhcRn = NameSet
    -- ^ After the renamer (but before the type-checker), the FunBind
    -- extension field contains the locally-bound free variables of this
    -- defn. See Note [Bind free vars]

    type instance XFunBind    (GhcPass pL) GhcTc = (HsWrapper, [CoreTickish])
    -- ^ After the type-checker, the FunBind extension field contains
    -- the ticks to put on the rhs, if any, and a coercion from the
    -- type of the MatchGroup to the type of the Id.
    -- Example:
    --
    -- @
    --      f :: Int -> forall a. a -> a
    --      f x y = y
    -- @
    --
    -- Then the MatchGroup will have type (Int -> a' -> a')
    -- (with a free type variable a').  The coercion will take
    -- a CoreExpr of this type and convert it to a CoreExpr of
    -- type         Int -> forall a'. a' -> a'
    -- Notice that the coercion captures the free a'.

    type instance XPatBind    GhcPs (GhcPass pR) = NoExtField
    type instance XPatBind    GhcRn (GhcPass pR) = NameSet -- See Note [Bind free vars]
    type instance XPatBind    GhcTc (GhcPass pR) =
        ( Type                  -- Type of the GRHSs
        , ( [CoreTickish]       -- Ticks to put on the rhs, if any
          , [[CoreTickish]] ) ) -- and ticks to put on the bound variables.

    type instance XVarBind (GhcPass pL) (GhcPass pR) = XVarBindGhc pL pR
    type family XVarBindGhc pL pR where
      XVarBindGhc 'Typechecked 'Typechecked = NoExtField
      XVarBindGhc _     _                   = DataConCantHappen

    type instance XPatSynBind (GhcPass pL) (GhcPass pR) = NoExtField

    type instance XXHsBindsLR GhcPs pR = DataConCantHappen
    type instance XXHsBindsLR GhcRn pR = DataConCantHappen
    type instance XXHsBindsLR GhcTc pR = AbsBinds

    type instance XPSB         (GhcPass idL) GhcPs = AnnPSB
    type instance XPSB         (GhcPass idL) GhcRn = NameSet -- Post renaming, FVs. See Note [Bind free vars]
    type instance XPSB         (GhcPass idL) GhcTc = NameSet

    type instance XXPatSynBind (GhcPass idL) (GhcPass idR) = DataConCantHappen

    type instance XNoMultAnn GhcPs = NoExtField
    type instance XNoMultAnn GhcRn = NoExtField
    type instance XNoMultAnn GhcTc = Mult

    type instance XPct1Ann   GhcPs = EpToken "%1"
    type instance XPct1Ann   GhcRn = NoExtField
    type instance XPct1Ann   GhcTc = Mult

    type instance XMultAnn   GhcPs = EpToken "%"
    type instance XMultAnn   GhcRn = NoExtField
    type instance XMultAnn   GhcTc = Mult

    type instance XXMultAnn  (GhcPass _) = DataConCantHappen

    data AnnPSB
      = AnnPSB {
          AnnPSB -> EpToken "pattern"
    ap_pattern :: EpToken "pattern",
          AnnPSB -> Maybe (EpToken "{")
    ap_openc   :: Maybe (EpToken "{"),
          AnnPSB -> Maybe (EpToken "}")
    ap_closec  :: Maybe (EpToken "}"),
          AnnPSB -> Maybe (EpUniToken "<-" "\8592")
    ap_larrow  :: Maybe (EpUniToken "<-" "←"),
          AnnPSB -> Maybe (EpToken "=")
    ap_equal   :: Maybe (EpToken "=")
        } deriving Typeable AnnPSB
    Typeable AnnPSB =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> AnnPSB -> c AnnPSB)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c AnnPSB)
    -> (AnnPSB -> Constr)
    -> (AnnPSB -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c AnnPSB))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnPSB))
    -> ((forall b. Data b => b -> b) -> AnnPSB -> AnnPSB)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> AnnPSB -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> AnnPSB -> r)
    -> (forall u. (forall d. Data d => d -> u) -> AnnPSB -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> AnnPSB -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB)
    -> Data AnnPSB
    AnnPSB -> Constr
    AnnPSB -> DataType
    (forall b. Data b => b -> b) -> AnnPSB -> AnnPSB
    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) -> AnnPSB -> u
    forall u. (forall d. Data d => d -> u) -> AnnPSB -> [u]
    forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AnnPSB -> r
    forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AnnPSB -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AnnPSB
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AnnPSB -> c AnnPSB
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AnnPSB)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnPSB)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AnnPSB -> c AnnPSB
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AnnPSB -> c AnnPSB
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AnnPSB
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AnnPSB
    $ctoConstr :: AnnPSB -> Constr
    toConstr :: AnnPSB -> Constr
    $cdataTypeOf :: AnnPSB -> DataType
    dataTypeOf :: AnnPSB -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AnnPSB)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AnnPSB)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnPSB)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnPSB)
    $cgmapT :: (forall b. Data b => b -> b) -> AnnPSB -> AnnPSB
    gmapT :: (forall b. Data b => b -> b) -> AnnPSB -> AnnPSB
    $cgmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AnnPSB -> r
    gmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AnnPSB -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AnnPSB -> r
    gmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AnnPSB -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> AnnPSB -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> AnnPSB -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AnnPSB -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AnnPSB -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnPSB -> m AnnPSB
    Data

    instance NoAnn AnnPSB where
      noAnn :: AnnPSB
    noAnn = EpToken "pattern"
    -> Maybe (EpToken "{")
    -> Maybe (EpToken "}")
    -> Maybe (EpUniToken "<-" "\8592")
    -> Maybe (EpToken "=")
    -> AnnPSB
    AnnPSB EpToken "pattern"
    forall a. NoAnn a => a
    noAnn Maybe (EpToken "{")
    forall a. NoAnn a => a
    noAnn Maybe (EpToken "}")
    forall a. NoAnn a => a
    noAnn Maybe (EpUniToken "<-" "\8592")
    forall a. NoAnn a => a
    noAnn Maybe (EpToken "=")
    forall a. NoAnn a => a
    noAnn

    setTcMultAnn :: Mult -> HsMultAnn GhcRn -> HsMultAnn GhcTc
    setTcMultAnn :: Mult -> HsMultAnn GhcRn -> HsMultAnn GhcTc
    setTcMultAnn Mult
    mult (HsPct1Ann XPct1Ann GhcRn
    _)   = XPct1Ann GhcTc -> HsMultAnn GhcTc
    forall pass. XPct1Ann pass -> HsMultAnn pass
    HsPct1Ann Mult
    XPct1Ann GhcTc
    mult
    setTcMultAnn Mult
    mult (HsMultAnn XMultAnn GhcRn
    _ LHsType (NoGhcTc GhcRn)
    p) = XMultAnn GhcTc -> LHsType (NoGhcTc GhcTc) -> HsMultAnn GhcTc
    forall pass.
    XMultAnn pass -> LHsType (NoGhcTc pass) -> HsMultAnn pass
    HsMultAnn Mult
    XMultAnn GhcTc
    mult LHsType (NoGhcTc GhcRn)
    LHsType (NoGhcTc GhcTc)
    p
    setTcMultAnn Mult
    mult (HsNoMultAnn XNoMultAnn GhcRn
    _) = XNoMultAnn GhcTc -> HsMultAnn GhcTc
    forall pass. XNoMultAnn pass -> HsMultAnn pass
    HsNoMultAnn Mult
    XNoMultAnn GhcTc
    mult

    getTcMultAnn :: HsMultAnn GhcTc -> Mult
    getTcMultAnn :: HsMultAnn GhcTc -> Mult
    getTcMultAnn (HsPct1Ann XPct1Ann GhcTc
    mult)   = Mult
    XPct1Ann GhcTc
    mult
    getTcMultAnn (HsMultAnn XMultAnn GhcTc
    mult LHsType (NoGhcTc GhcTc)
    _) = Mult
    XMultAnn GhcTc
    mult
    getTcMultAnn (HsNoMultAnn XNoMultAnn GhcTc
    mult) = Mult
    XNoMultAnn GhcTc
    mult

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

    -- | Typechecked, generalised bindings, used in the output to the type checker.
    -- See Note [AbsBinds].
    data AbsBinds = AbsBinds {
          AbsBinds -> [TyVar]
    abs_tvs     :: [TyVar],
          AbsBinds -> [TyVar]
    abs_ev_vars :: [EvVar],  -- ^ Includes equality constraints

         -- | AbsBinds only gets used when idL = idR after renaming,
         -- but these need to be idL's for the collect... code in HsUtil
         -- to have the right type
          AbsBinds -> [ABExport]
    abs_exports :: [ABExport],

          -- | Evidence bindings
          -- Why a list? See "GHC.Tc.TyCl.Instance"
          -- Note [Typechecking plan for instance declarations]
          AbsBinds -> [TcEvBinds]
    abs_ev_binds :: [TcEvBinds],

          -- | Typechecked user bindings
          AbsBinds -> LHsBinds GhcTc
    abs_binds    :: LHsBinds GhcTc,

          AbsBinds -> Bool
    abs_sig :: Bool  -- See Note [The abs_sig field of AbsBinds]
      }

            -- Consider (AbsBinds tvs ds [(ftvs, poly_f, mono_f) binds]
            --
            -- Creates bindings for (polymorphic, overloaded) poly_f
            -- in terms of monomorphic, non-overloaded mono_f
            --
            -- Invariants:
            --      1. 'binds' binds mono_f
            --      2. ftvs is a subset of tvs
            --      3. ftvs includes all tyvars free in ds
            --
            -- See Note [AbsBinds]

    -- | Abstraction Bindings Export
    data ABExport
      = ABE { ABExport -> TyVar
    abe_poly      :: Id           -- ^ Any INLINE pragma is attached to this Id
            , ABExport -> TyVar
    abe_mono      :: Id
            , ABExport -> HsWrapper
    abe_wrap      :: HsWrapper    -- ^ See Note [ABExport wrapper]
                 -- Shape: (forall abs_tvs. abs_ev_vars => abe_mono) ~ abe_poly
            , ABExport -> TcSpecPrags
    abe_prags     :: TcSpecPrags  -- ^ SPECIALISE pragmas
            }

    {-
    Note [AbsBinds]
    ~~~~~~~~~~~~~~~
    The AbsBinds constructor is used in the output of the type checker, to
    record *typechecked* and *generalised* bindings.  Specifically

             AbsBinds { abs_tvs      = tvs
                      , abs_ev_vars  = [d1,d2]
                      , abs_exports  = [ABE { abe_poly = fp, abe_mono = fm
                                            , abe_wrap = fwrap }
                                        ABE { slly for g } ]
                      , abs_ev_binds = DBINDS
                      , abs_binds    = BIND[fm,gm] }

    where 'BIND' binds the monomorphic Ids 'fm' and 'gm', means

            fp = fwrap [/\ tvs. \d1 d2. letrec { DBINDS        ]
                       [                       ; BIND[fm,gm] } ]
                       [                 in fm                 ]

            gp = ...same again, with gm instead of fm

    The 'fwrap' is an impedance-matcher that typically does nothing; see
    Note [ABExport wrapper].

    This is a pretty bad translation, because it duplicates all the bindings.
    So the desugarer tries to do a better job:

            fp = /\ [a,b] -> \ [d1,d2] -> case tp [a,b] [d1,d2] of
                                            (fm,gm) -> fm
            ..ditto for gp..

            tp = /\ [a,b] -> \ [d1,d2] -> letrec { DBINDS; BIND }
                                          in (fm,gm)

    In general:

      * abs_tvs are the type variables over which the binding group is
        generalised
      * abs_ev_var are the evidence variables (usually dictionaries)
        over which the binding group is generalised
      * abs_binds are the monomorphic bindings
      * abs_ex_binds are the evidence bindings that wrap the abs_binds
      * abs_exports connects the monomorphic Ids bound by abs_binds
        with the polymorphic Ids bound by the AbsBinds itself.

    For example, consider a module M, with this top-level binding, where
    there is no type signature for M.reverse,
        M.reverse []     = []
        M.reverse (x:xs) = M.reverse xs ++ [x]

    In Hindley-Milner, a recursive binding is typechecked with the
    *recursive* uses being *monomorphic*.  So after typechecking *and*
    desugaring we will get something like this

        M.reverse :: forall a. [a] -> [a]
          = /\a. letrec
                    reverse :: [a] -> [a] = \xs -> case xs of
                                                    []     -> []
                                                    (x:xs) -> reverse xs ++ [x]
                 in reverse

    Notice that 'M.reverse' is polymorphic as expected, but there is a local
    definition for plain 'reverse' which is *monomorphic*.  The type variable
    'a' scopes over the entire letrec.

    That's after desugaring.  What about after type checking but before
    desugaring?  That's where AbsBinds comes in.  It looks like this:

       AbsBinds { abs_tvs     = [a]
                , abs_ev_vars = []
                , abs_exports = [ABE { abe_poly = M.reverse :: forall a. [a] -> [a],
                                     , abe_mono = reverse :: [a] -> [a]}]
                , abs_ev_binds = {}
                , abs_binds = { reverse :: [a] -> [a]
                                   = \xs -> case xs of
                                                []     -> []
                                                (x:xs) -> reverse xs ++ [x] } }

    Here,

      * abs_tvs says what type variables are abstracted over the binding
        group, just 'a' in this case.
      * abs_binds is the *monomorphic* bindings of the group
      * abs_exports describes how to get the polymorphic Id 'M.reverse'
        from the monomorphic one 'reverse'

    Notice that the *original* function (the polymorphic one you thought
    you were defining) appears in the abe_poly field of the
    abs_exports. The bindings in abs_binds are for fresh, local, Ids with
    a *monomorphic* Id.

    If there is a group of mutually recursive (see Note [Polymorphic
    recursion]) functions without type signatures, we get one AbsBinds
    with the monomorphic versions of the bindings in abs_binds, and one
    element of abe_exports for each variable bound in the mutually
    recursive group.  This is true even for pattern bindings.  Example:
            (f,g) = (\x -> x, f)
    After type checking we get
       AbsBinds { abs_tvs     = [a]
                , abs_exports = [ ABE { abe_poly = M.f :: forall a. a -> a
                                      , abe_mono = f :: a -> a }
                                , ABE { abe_poly = M.g :: forall a. a -> a
                                      , abe_mono = g :: a -> a }]
                , abs_binds = { (f,g) = (\x -> x, f) }

    Note [Polymorphic recursion]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Consider
       Rec { f x = ...(g ef)...

           ; g :: forall a. [a] -> [a]
           ; g y = ...(f eg)...  }

    These bindings /are/ mutually recursive (f calls g, and g calls f).
    But we can use the type signature for g to break the recursion,
    like this:

      1. Add g :: forall a. [a] -> [a] to the type environment

      2. Typecheck the definition of f, all by itself,
         including generalising it to find its most general
         type, say f :: forall b. b -> b -> [b]

      3. Extend the type environment with that type for f

      4. Typecheck the definition of g, all by itself,
         checking that it has the type claimed by its signature

    Steps 2 and 4 each generate a separate AbsBinds, so we end
    up with
       Rec { AbsBinds { ...for f ... }
           ; AbsBinds { ...for g ... } }

    This approach allows both f and to call each other
    polymorphically, even though only g has a signature.

    We get an AbsBinds that encompasses multiple source-program
    bindings only when
     * Each binding in the group has at least one binder that
       lacks a user type signature
     * The group forms a strongly connected component

    Note [The abs_sig field of AbsBinds]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The abs_sig field supports a couple of special cases for bindings.
    Consider

      x :: Num a => (# a, a #)
      x = (# 3, 4 #)

    The general desugaring for AbsBinds would give

      x = /\a. \ ($dNum :: Num a) ->
          letrec xm = (# fromInteger $dNum 3, fromInteger $dNum 4 #) in
          xm

    But that has an illegal let-binding for an unboxed tuple.  In this
    case we'd prefer to generate the (more direct)

      x = /\ a. \ ($dNum :: Num a) ->
         (# fromInteger $dNum 3, fromInteger $dNum 4 #)

    A similar thing happens with representation-polymorphic defns
    (#11405):

      undef :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
      undef = error "undef"

    Again, the vanilla desugaring gives a local let-binding for a
    representation-polymorphic (undefm :: a), which is illegal.  But
    again we can desugar without a let:

      undef = /\ a. \ (d:HasCallStack) -> error a d "undef"

    The abs_sig field supports this direct desugaring, with no local
    let-binding.  When abs_sig = True

     * the abs_binds is single FunBind

     * the abs_exports is a singleton

     * we have a complete type sig for binder
       and hence the abs_binds is non-recursive
       (it binds the mono_id but refers to the poly_id

    These properties are exploited in GHC.HsToCore.Binds.dsAbsBinds to
    generate code without a let-binding.

    Note [ABExport wrapper]
    ~~~~~~~~~~~~~~~~~~~~~~~
    Consider
       (f,g) = (\x.x, \y.y)
    This ultimately desugars to something like this:
       tup :: forall a b. (a->a, b->b)
       tup = /\a b. (\x:a.x, \y:b.y)
       f :: forall a. a -> a
       f = /\a. case tup a Any of
                   (fm::a->a,gm:Any->Any) -> fm
       ...similarly for g...

    The abe_wrap field deals with impedance-matching between
        (/\a b. case tup a b of { (f,g) -> f })
    and the thing we really want, which may have fewer type
    variables.  The action happens in GHC.Tc.Gen.Bind.mkExport.

    Note [Bind free vars]
    ~~~~~~~~~~~~~~~~~~~~~
    The extension fields of FunBind, PatBind and PatSynBind at GhcRn records the free
    variables of the definition.  It is used for the following purposes:

    a) Dependency analysis prior to type checking
        (see GHC.Tc.Gen.Bind.tc_group)

    b) Deciding whether we can do generalisation of the binding
        (see GHC.Tc.Gen.Bind.decideGeneralisationPlan)

    c) Deciding whether the binding can be used in static forms
        (see GHC.Tc.Gen.Expr.checkClosedInStaticForm for the HsStatic case and
         GHC.Tc.Gen.Bind.isClosedBndrGroup).

    Specifically,

      * it includes all free vars that are defined in this module
        (including top-level things and lexically scoped type variables)

      * it excludes imported vars; this is just to keep the set smaller

      * Before renaming, and after typechecking, the field is unused;
        it's just an error thunk
    -}

    instance (OutputableBndrId pl, OutputableBndrId pr)
            => Outputable (HsLocalBindsLR (GhcPass pl) (GhcPass pr)) where
      ppr :: HsLocalBindsLR (GhcPass pl) (GhcPass pr) -> SDoc
    ppr (HsValBinds XHsValBinds (GhcPass pl) (GhcPass pr)
    _ HsValBindsLR (GhcPass pl) (GhcPass pr)
    bs)   = HsValBindsLR (GhcPass pl) (GhcPass pr) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr HsValBindsLR (GhcPass pl) (GhcPass pr)
    bs
      ppr (HsIPBinds XHsIPBinds (GhcPass pl) (GhcPass pr)
    _ HsIPBinds (GhcPass pr)
    bs)    = HsIPBinds (GhcPass pr) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr HsIPBinds (GhcPass pr)
    bs
      ppr (EmptyLocalBinds XEmptyLocalBinds (GhcPass pl) (GhcPass pr)
    _) = SDoc
    forall doc. IsOutput doc => doc
    empty

    instance (OutputableBndrId pl, OutputableBndrId pr)
            => Outputable (HsValBindsLR (GhcPass pl) (GhcPass pr)) where
      ppr :: HsValBindsLR (GhcPass pl) (GhcPass pr) -> SDoc
    ppr (ValBinds XValBinds (GhcPass pl) (GhcPass pr)
    _ LHsBindsLR (GhcPass pl) (GhcPass pr)
    binds [LSig (GhcPass pr)]
    sigs)
       = [SDoc] -> SDoc
    pprDeclList (LHsBindsLR (GhcPass pl) (GhcPass pr)
    -> [LSig (GhcPass pr)] -> [SDoc]
    forall (idL :: Pass) (idR :: Pass) (id2 :: Pass).
    (OutputableBndrId idL, OutputableBndrId idR,
     OutputableBndrId id2) =>
    LHsBindsLR (GhcPass idL) (GhcPass idR)
    -> [LSig (GhcPass id2)] -> [SDoc]
    pprLHsBindsForUser LHsBindsLR (GhcPass pl) (GhcPass pr)
    binds [LSig (GhcPass pr)]
    sigs)

      ppr (XValBindsLR (NValBinds [(RecFlag, LHsBinds (GhcPass pl))]
    sccs [LSig GhcRn]
    sigs))
        = (Bool -> SDoc) -> SDoc
    forall doc. IsOutput doc => (Bool -> doc) -> doc
    getPprDebug ((Bool -> SDoc) -> SDoc) -> (Bool -> SDoc) -> SDoc
    forall a b. (a -> b) -> a -> b
    $ \case
            -- Print with sccs showing
            Bool
    True  -> [SDoc] -> SDoc
    forall doc. IsDoc doc => [doc] -> doc
    vcat ((GenLocated SrcSpanAnnA (Sig GhcRn) -> SDoc)
    -> [GenLocated SrcSpanAnnA (Sig GhcRn)] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map GenLocated SrcSpanAnnA (Sig GhcRn) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr [LSig GhcRn]
    [GenLocated SrcSpanAnnA (Sig GhcRn)]
    sigs) SDoc -> SDoc -> SDoc
    forall doc. IsDoc doc => doc -> doc -> doc
    $$ [SDoc] -> SDoc
    forall doc. IsDoc doc => [doc] -> doc
    vcat (((RecFlag,
      [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))])
     -> SDoc)
    -> [(RecFlag,
         [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))])]
    -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map (RecFlag,
     [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))])
    -> SDoc
    forall {idR :: Pass} {idL :: Pass}.
    (OutputableBndr (IdGhcP idL), OutputableBndr (IdGhcP idR),
     OutputableBndr (IdGhcP (NoGhcTcPass idL)),
     OutputableBndr (IdGhcP (NoGhcTcPass idR)), IsPass idL, IsPass idR,
     Outputable (GenLocated (Anno (IdGhcP idL)) (IdGhcP idL)),
     Outputable (GenLocated (Anno (IdGhcP idR)) (IdGhcP idR)),
     Outputable
       (GenLocated
          (Anno (IdGhcP (NoGhcTcPass idL))) (IdGhcP (NoGhcTcPass idL))),
     Outputable
       (GenLocated
          (Anno (IdGhcP (NoGhcTcPass idR))) (IdGhcP (NoGhcTcPass idR)))) =>
    (RecFlag,
     [GenLocated SrcSpanAnnA (HsBindLR (GhcPass idL) (GhcPass idR))])
    -> SDoc
    ppr_scc [(RecFlag, LHsBinds (GhcPass pl))]
    [(RecFlag,
      [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))])]
    sccs)
            Bool
    False -> [SDoc] -> SDoc
    pprDeclList (LHsBinds (GhcPass pl) -> [LSig GhcRn] -> [SDoc]
    forall (idL :: Pass) (idR :: Pass) (id2 :: Pass).
    (OutputableBndrId idL, OutputableBndrId idR,
     OutputableBndrId id2) =>
    LHsBindsLR (GhcPass idL) (GhcPass idR)
    -> [LSig (GhcPass id2)] -> [SDoc]
    pprLHsBindsForUser ([[GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))]]
    -> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat (((RecFlag,
      [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))])
     -> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))])
    -> [(RecFlag,
         [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))])]
    -> [[GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))]]
    forall a b. (a -> b) -> [a] -> [b]
    map (RecFlag,
     [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))])
    -> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))]
    forall a b. (a, b) -> b
    snd [(RecFlag, LHsBinds (GhcPass pl))]
    [(RecFlag,
      [GenLocated SrcSpanAnnA (HsBindLR (GhcPass pl) (GhcPass pl))])]
    sccs)) [LSig GhcRn]
    sigs)
       where
         ppr_scc :: (RecFlag,
     [GenLocated SrcSpanAnnA (HsBindLR (GhcPass idL) (GhcPass idR))])
    -> SDoc
    ppr_scc (RecFlag
    rec_flag, [GenLocated SrcSpanAnnA (HsBindLR (GhcPass idL) (GhcPass idR))]
    binds) = RecFlag -> SDoc
    forall {doc}. IsLine doc => RecFlag -> doc
    pp_rec RecFlag
    rec_flag SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
    forall (idL :: Pass) (idR :: Pass).
    (OutputableBndrId idL, OutputableBndrId idR) =>
    LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
    pprLHsBinds LHsBindsLR (GhcPass idL) (GhcPass idR)
    [GenLocated SrcSpanAnnA (HsBindLR (GhcPass idL) (GhcPass idR))]
    binds
         pp_rec :: RecFlag -> doc
    pp_rec RecFlag
    Recursive    = String -> doc
    forall doc. IsLine doc => String -> doc
    text String
    "rec"
         pp_rec RecFlag
    NonRecursive = String -> doc
    forall doc. IsLine doc => String -> doc
    text String
    "nonrec"

    pprLHsBinds :: (OutputableBndrId idL, OutputableBndrId idR)
                => LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
    pprLHsBinds :: forall (idL :: Pass) (idR :: Pass).
    (OutputableBndrId idL, OutputableBndrId idR) =>
    LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
    pprLHsBinds LHsBindsLR (GhcPass idL) (GhcPass idR)
    binds
      | LHsBindsLR (GhcPass idL) (GhcPass idR) -> Bool
    forall (idL :: Pass) idR. LHsBindsLR (GhcPass idL) idR -> Bool
    isEmptyLHsBinds LHsBindsLR (GhcPass idL) (GhcPass idR)
    binds = SDoc
    forall doc. IsOutput doc => doc
    empty
      | Bool
    otherwise = [SDoc] -> SDoc
    pprDeclList ((GenLocated SrcSpanAnnA (HsBindLR (GhcPass idL) (GhcPass idR))
     -> SDoc)
    -> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass idL) (GhcPass idR))]
    -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map GenLocated SrcSpanAnnA (HsBindLR (GhcPass idL) (GhcPass idR))
    -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LHsBindsLR (GhcPass idL) (GhcPass idR)
    [GenLocated SrcSpanAnnA (HsBindLR (GhcPass idL) (GhcPass idR))]
    binds)

    pprLHsBindsForUser :: (OutputableBndrId idL,
                           OutputableBndrId idR,
                           OutputableBndrId id2)
         => LHsBindsLR (GhcPass idL) (GhcPass idR) -> [LSig (GhcPass id2)] -> [SDoc]
    --  pprLHsBindsForUser is different to pprLHsBinds because
    --  a) No braces: 'let' and 'where' include a list of HsBindGroups
    --     and we don't want several groups of bindings each
    --     with braces around
    --  b) Sort by location before printing
    --  c) Include signatures
    pprLHsBindsForUser :: forall (idL :: Pass) (idR :: Pass) (id2 :: Pass).
    (OutputableBndrId idL, OutputableBndrId idR,
     OutputableBndrId id2) =>
    LHsBindsLR (GhcPass idL) (GhcPass idR)
    -> [LSig (GhcPass id2)] -> [SDoc]
    pprLHsBindsForUser LHsBindsLR (GhcPass idL) (GhcPass idR)
    binds [LSig (GhcPass id2)]
    sigs
      = ((SrcSpan, SDoc) -> SDoc) -> [(SrcSpan, SDoc)] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map (SrcSpan, SDoc) -> SDoc
    forall a b. (a, b) -> b
    snd ([(SrcSpan, SDoc)] -> [(SrcSpan, SDoc)]
    forall {b}. [(SrcSpan, b)] -> [(SrcSpan, b)]
    sort_by_loc [(SrcSpan, SDoc)]
    decls)
      where

        decls :: [(SrcSpan, SDoc)]
        decls :: [(SrcSpan, SDoc)]
    decls = [(SrcSpanAnnA -> SrcSpan
    forall a. HasLoc a => a -> SrcSpan
    locA SrcSpanAnnA
    loc, Sig (GhcPass id2) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr Sig (GhcPass id2)
    sig)  | L SrcSpanAnnA
    loc Sig (GhcPass id2)
    sig <- [LSig (GhcPass id2)]
    [GenLocated SrcSpanAnnA (Sig (GhcPass id2))]
    sigs] [(SrcSpan, SDoc)] -> [(SrcSpan, SDoc)] -> [(SrcSpan, SDoc)]
    forall a. [a] -> [a] -> [a]
    ++
                [(SrcSpanAnnA -> SrcSpan
    forall a. HasLoc a => a -> SrcSpan
    locA SrcSpanAnnA
    loc, HsBindLR (GhcPass idL) (GhcPass idR) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr HsBindLR (GhcPass idL) (GhcPass idR)
    bind) | L SrcSpanAnnA
    loc HsBindLR (GhcPass idL) (GhcPass idR)
    bind <- LHsBindsLR (GhcPass idL) (GhcPass idR)
    [GenLocated SrcSpanAnnA (HsBindLR (GhcPass idL) (GhcPass idR))]
    binds]

        sort_by_loc :: [(SrcSpan, b)] -> [(SrcSpan, b)]
    sort_by_loc [(SrcSpan, b)]
    decls = ((SrcSpan, b) -> (SrcSpan, b) -> Ordering)
    -> [(SrcSpan, b)] -> [(SrcSpan, b)]
    forall a. (a -> a -> Ordering) -> [a] -> [a]
    sortBy (SrcSpan -> SrcSpan -> Ordering
    SrcLoc.leftmost_smallest (SrcSpan -> SrcSpan -> Ordering)
    -> ((SrcSpan, b) -> SrcSpan)
    -> (SrcSpan, b)
    -> (SrcSpan, b)
    -> Ordering
    forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
    `on` (SrcSpan, b) -> SrcSpan
    forall a b. (a, b) -> a
    fst) [(SrcSpan, b)]
    decls

    pprDeclList :: [SDoc] -> SDoc   -- Braces with a space
    -- Print a bunch of declarations
    -- One could choose  { d1; d2; ... }, using 'sep'
    -- or      d1
    --         d2
    --         ..
    --    using vcat
    -- At the moment we chose the latter
    -- Also we do the 'pprDeeperList' thing.
    pprDeclList :: [SDoc] -> SDoc
    pprDeclList [SDoc]
    ds = ([SDoc] -> SDoc) -> [SDoc] -> SDoc
    pprDeeperList [SDoc] -> SDoc
    forall doc. IsDoc doc => [doc] -> doc
    vcat [SDoc]
    ds

    ------------
    emptyLocalBinds :: HsLocalBindsLR (GhcPass a) (GhcPass b)
    emptyLocalBinds :: forall (a :: Pass) (b :: Pass).
    HsLocalBindsLR (GhcPass a) (GhcPass b)
    emptyLocalBinds = XEmptyLocalBinds (GhcPass a) (GhcPass b)
    -> HsLocalBindsLR (GhcPass a) (GhcPass b)
    forall idL idR. XEmptyLocalBinds idL idR -> HsLocalBindsLR idL idR
    EmptyLocalBinds XEmptyLocalBinds (GhcPass a) (GhcPass b)
    NoExtField
    noExtField

    eqEmptyLocalBinds :: HsLocalBindsLR a b -> Bool
    eqEmptyLocalBinds :: forall a b. HsLocalBindsLR a b -> Bool
    eqEmptyLocalBinds (EmptyLocalBinds XEmptyLocalBinds a b
    _) = Bool
    True
    eqEmptyLocalBinds HsLocalBindsLR a b
    _                   = Bool
    False

    isEmptyValBinds :: HsValBindsLR (GhcPass a) (GhcPass b) -> Bool
    isEmptyValBinds :: forall (a :: Pass) (b :: Pass).
    HsValBindsLR (GhcPass a) (GhcPass b) -> Bool
    isEmptyValBinds (ValBinds XValBinds (GhcPass a) (GhcPass b)
    _ LHsBindsLR (GhcPass a) (GhcPass b)
    ds [LSig (GhcPass b)]
    sigs)  = LHsBindsLR (GhcPass a) (GhcPass b) -> Bool
    forall (idL :: Pass) idR. LHsBindsLR (GhcPass idL) idR -> Bool
    isEmptyLHsBinds LHsBindsLR (GhcPass a) (GhcPass b)
    ds Bool -> Bool -> Bool
    && [GenLocated SrcSpanAnnA (Sig (GhcPass b))] -> Bool
    forall a. [a] -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null [LSig (GhcPass b)]
    [GenLocated SrcSpanAnnA (Sig (GhcPass b))]
    sigs
    isEmptyValBinds (XValBindsLR (NValBinds [(RecFlag, LHsBinds (GhcPass a))]
    ds [LSig GhcRn]
    sigs)) = [(RecFlag,
      [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))])]
    -> Bool
    forall a. [a] -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null [(RecFlag, LHsBinds (GhcPass a))]
    [(RecFlag,
      [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))])]
    ds Bool -> Bool -> Bool
    && [GenLocated SrcSpanAnnA (Sig GhcRn)] -> Bool
    forall a. [a] -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null [LSig GhcRn]
    [GenLocated SrcSpanAnnA (Sig GhcRn)]
    sigs

    emptyValBindsIn, emptyValBindsOut :: HsValBindsLR (GhcPass a) (GhcPass b)
    emptyValBindsIn :: forall (a :: Pass) (b :: Pass).
    HsValBindsLR (GhcPass a) (GhcPass b)
    emptyValBindsIn  = XValBinds (GhcPass a) (GhcPass b)
    -> LHsBindsLR (GhcPass a) (GhcPass b)
    -> [LSig (GhcPass b)]
    -> HsValBindsLR (GhcPass a) (GhcPass b)
    forall idL idR.
    XValBinds idL idR
    -> LHsBindsLR idL idR -> [LSig idR] -> HsValBindsLR idL idR
    ValBinds XValBinds (GhcPass a) (GhcPass b)
    AnnSortKey BindTag
    forall tag. AnnSortKey tag
    NoAnnSortKey [] []
    emptyValBindsOut :: forall (a :: Pass) (b :: Pass).
    HsValBindsLR (GhcPass a) (GhcPass b)
    emptyValBindsOut = XXValBindsLR (GhcPass a) (GhcPass b)
    -> HsValBindsLR (GhcPass a) (GhcPass b)
    forall idL idR. XXValBindsLR idL idR -> HsValBindsLR idL idR
    XValBindsLR ([(RecFlag, LHsBinds (GhcPass a))]
    -> [LSig GhcRn] -> NHsValBindsLR (GhcPass a)
    forall idL.
    [(RecFlag, LHsBinds idL)] -> [LSig GhcRn] -> NHsValBindsLR idL
    NValBinds [] [])

    emptyLHsBinds :: LHsBindsLR (GhcPass idL) idR
    emptyLHsBinds :: forall (idL :: Pass) idR. LHsBindsLR (GhcPass idL) idR
    emptyLHsBinds = []

    isEmptyLHsBinds :: LHsBindsLR (GhcPass idL) idR -> Bool
    isEmptyLHsBinds :: forall (idL :: Pass) idR. LHsBindsLR (GhcPass idL) idR -> Bool
    isEmptyLHsBinds = [XRec (GhcPass idL) (HsBindLR (GhcPass idL) idR)] -> Bool
    [GenLocated
       (Anno (HsBindLR (GhcPass idL) idR)) (HsBindLR (GhcPass idL) idR)]
    -> Bool
    forall a. [a] -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null

    ------------
    plusHsValBinds :: HsValBinds (GhcPass a) -> HsValBinds (GhcPass a)
                   -> HsValBinds(GhcPass a)
    plusHsValBinds :: forall (a :: Pass).
    HsValBinds (GhcPass a)
    -> HsValBinds (GhcPass a) -> HsValBinds (GhcPass a)
    plusHsValBinds (ValBinds XValBinds (GhcPass a) (GhcPass a)
    _ LHsBindsLR (GhcPass a) (GhcPass a)
    ds1 [LSig (GhcPass a)]
    sigs1) (ValBinds XValBinds (GhcPass a) (GhcPass a)
    _ LHsBindsLR (GhcPass a) (GhcPass a)
    ds2 [LSig (GhcPass a)]
    sigs2)
      = XValBinds (GhcPass a) (GhcPass a)
    -> LHsBindsLR (GhcPass a) (GhcPass a)
    -> [LSig (GhcPass a)]
    -> HsValBindsLR (GhcPass a) (GhcPass a)
    forall idL idR.
    XValBinds idL idR
    -> LHsBindsLR idL idR -> [LSig idR] -> HsValBindsLR idL idR
    ValBinds XValBinds (GhcPass a) (GhcPass a)
    AnnSortKey BindTag
    forall tag. AnnSortKey tag
    NoAnnSortKey (LHsBindsLR (GhcPass a) (GhcPass a)
    [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))]
    ds1 [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))]
    -> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))]
    -> [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))]
    forall a. [a] -> [a] -> [a]
    ++ LHsBindsLR (GhcPass a) (GhcPass a)
    [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))]
    ds2) ([LSig (GhcPass a)]
    [GenLocated SrcSpanAnnA (Sig (GhcPass a))]
    sigs1 [GenLocated SrcSpanAnnA (Sig (GhcPass a))]
    -> [GenLocated SrcSpanAnnA (Sig (GhcPass a))]
    -> [GenLocated SrcSpanAnnA (Sig (GhcPass a))]
    forall a. [a] -> [a] -> [a]
    ++ [LSig (GhcPass a)]
    [GenLocated SrcSpanAnnA (Sig (GhcPass a))]
    sigs2)
    plusHsValBinds (XValBindsLR (NValBinds [(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
    ds1 [LSig GhcRn]
    sigs1))
                   (XValBindsLR (NValBinds [(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
    ds2 [LSig GhcRn]
    sigs2))
      = XXValBindsLR (GhcPass a) (GhcPass a)
    -> HsValBindsLR (GhcPass a) (GhcPass a)
    forall idL idR. XXValBindsLR idL idR -> HsValBindsLR idL idR
    XValBindsLR ([(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
    -> [LSig GhcRn] -> NHsValBindsLR (GhcPass a)
    forall idL.
    [(RecFlag, LHsBinds idL)] -> [LSig GhcRn] -> NHsValBindsLR idL
    NValBinds ([(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
    [(RecFlag,
      [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))])]
    ds1 [(RecFlag,
      [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))])]
    -> [(RecFlag,
         [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))])]
    -> [(RecFlag,
         [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))])]
    forall a. [a] -> [a] -> [a]
    ++ [(RecFlag, LHsBindsLR (GhcPass a) (GhcPass a))]
    [(RecFlag,
      [GenLocated SrcSpanAnnA (HsBindLR (GhcPass a) (GhcPass a))])]
    ds2) ([LSig GhcRn]
    [GenLocated SrcSpanAnnA (Sig GhcRn)]
    sigs1 [GenLocated SrcSpanAnnA (Sig GhcRn)]
    -> [GenLocated SrcSpanAnnA (Sig GhcRn)]
    -> [GenLocated SrcSpanAnnA (Sig GhcRn)]
    forall a. [a] -> [a] -> [a]
    ++ [LSig GhcRn]
    [GenLocated SrcSpanAnnA (Sig GhcRn)]
    sigs2))
    plusHsValBinds HsValBindsLR (GhcPass a) (GhcPass a)
    _ HsValBindsLR (GhcPass a) (GhcPass a)
    _
      = String -> HsValBindsLR (GhcPass a) (GhcPass a)
    forall a. HasCallStack => String -> a
    panic String
    "HsBinds.plusHsValBinds"

    -- Used to print, for instance, let bindings:
    --   let %1 x = …
    pprHsMultAnn :: forall id. OutputableBndrId id => HsMultAnn (GhcPass id) -> SDoc
    pprHsMultAnn :: forall (id :: Pass).
    OutputableBndrId id =>
    HsMultAnn (GhcPass id) -> SDoc
    pprHsMultAnn (HsNoMultAnn XNoMultAnn (GhcPass id)
    _) = SDoc
    forall doc. IsOutput doc => doc
    empty
    pprHsMultAnn (HsPct1Ann XPct1Ann (GhcPass id)
    _) = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "%1"
    pprHsMultAnn (HsMultAnn XMultAnn (GhcPass id)
    _ LHsType (NoGhcTc (GhcPass id))
    p) = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "%" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <> GenLocated SrcSpanAnnA (HsType (GhcPass (NoGhcTcPass id))) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LHsType (NoGhcTc (GhcPass id))
    GenLocated SrcSpanAnnA (HsType (GhcPass (NoGhcTcPass id)))
    p

    instance (OutputableBndrId pl, OutputableBndrId pr)
             => Outputable (HsBindLR (GhcPass pl) (GhcPass pr)) where
        ppr :: HsBindLR (GhcPass pl) (GhcPass pr) -> SDoc
    ppr HsBindLR (GhcPass pl) (GhcPass pr)
    mbind = HsBindLR (GhcPass pl) (GhcPass pr) -> SDoc
    forall (pl :: Pass) (pr :: Pass).
    (OutputableBndrId pl, OutputableBndrId pr) =>
    HsBindLR (GhcPass pl) (GhcPass pr) -> SDoc
    ppr_monobind HsBindLR (GhcPass pl) (GhcPass pr)
    mbind

    ppr_monobind :: forall idL idR.
                    (OutputableBndrId idL, OutputableBndrId idR)
                 => HsBindLR (GhcPass idL) (GhcPass idR) -> SDoc

    ppr_monobind :: forall (pl :: Pass) (pr :: Pass).
    (OutputableBndrId pl, OutputableBndrId pr) =>
    HsBindLR (GhcPass pl) (GhcPass pr) -> SDoc
    ppr_monobind (PatBind { pat_lhs :: forall idL idR. HsBindLR idL idR -> LPat idL
    pat_lhs = LPat (GhcPass idL)
    pat, pat_mult :: forall idL idR. HsBindLR idL idR -> HsMultAnn idL
    pat_mult = HsMultAnn (GhcPass idL)
    mult_ann, pat_rhs :: forall idL idR. HsBindLR idL idR -> GRHSs idR (LHsExpr idR)
    pat_rhs = GRHSs (GhcPass idR) (LHsExpr (GhcPass idR))
    grhss })
      = forall (id :: Pass).
    OutputableBndrId id =>
    HsMultAnn (GhcPass id) -> SDoc
    pprHsMultAnn @idL HsMultAnn (GhcPass idL)
    mult_ann
        SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> LPat (GhcPass idL)
    -> GRHSs (GhcPass idR) (LHsExpr (GhcPass idR)) -> SDoc
    forall (bndr :: Pass) (p :: Pass).
    (OutputableBndrId bndr, OutputableBndrId p) =>
    LPat (GhcPass bndr)
    -> GRHSs (GhcPass p) (LHsExpr (GhcPass p)) -> SDoc
    pprPatBind LPat (GhcPass idL)
    pat GRHSs (GhcPass idR) (LHsExpr (GhcPass idR))
    grhss
    ppr_monobind (VarBind { var_id :: forall idL idR. HsBindLR idL idR -> IdP idL
    var_id = IdP (GhcPass idL)
    var, var_rhs :: forall idL idR. HsBindLR idL idR -> LHsExpr idR
    var_rhs = LHsExpr (GhcPass idR)
    rhs })
      = [SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    sep [BindingSite -> IdGhcP idL -> SDoc
    forall a. OutputableBndr a => BindingSite -> a -> SDoc
    pprBndr BindingSite
    CasePatBind IdP (GhcPass idL)
    IdGhcP idL
    var, Int -> SDoc -> SDoc
    nest Int
    2 (SDoc -> SDoc) -> SDoc -> SDoc
    forall a b. (a -> b) -> a -> b
    $ SDoc
    forall doc. IsLine doc => doc
    equals SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> HsExpr (GhcPass idR) -> SDoc
    forall (p :: Pass).
    OutputableBndrId p =>
    HsExpr (GhcPass p) -> SDoc
    pprExpr (GenLocated (Anno (HsExpr (GhcPass idR))) (HsExpr (GhcPass idR))
    -> HsExpr (GhcPass idR)
    forall l e. GenLocated l e -> e
    unLoc LHsExpr (GhcPass idR)
    GenLocated (Anno (HsExpr (GhcPass idR))) (HsExpr (GhcPass idR))
    rhs)]
    ppr_monobind (FunBind { fun_id :: forall idL idR. HsBindLR idL idR -> LIdP idL
    fun_id = LIdP (GhcPass idL)
    fun,
                            fun_matches :: forall idL idR. HsBindLR idL idR -> MatchGroup idR (LHsExpr idR)
    fun_matches = MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR))
    matches,
                            fun_ext :: forall idL idR. HsBindLR idL idR -> XFunBind idL idR
    fun_ext = XFunBind (GhcPass idL) (GhcPass idR)
    ext })
      = SDoc -> SDoc -> SDoc
    pprTicks SDoc
    forall doc. IsOutput doc => doc
    empty SDoc
    ticksDoc
        SDoc -> SDoc -> SDoc
    forall doc. IsDoc doc => doc -> doc -> doc
    $$  SDoc -> SDoc
    forall doc. IsOutput doc => doc -> doc
    whenPprDebug (BindingSite -> IdGhcP idL -> SDoc
    forall a. OutputableBndr a => BindingSite -> a -> SDoc
    pprBndr BindingSite
    LetBind (GenLocated (Anno (IdGhcP idL)) (IdGhcP idL) -> IdGhcP idL
    forall l e. GenLocated l e -> e
    unLoc LIdP (GhcPass idL)
    GenLocated (Anno (IdGhcP idL)) (IdGhcP idL)
    fun))
        SDoc -> SDoc -> SDoc
    forall doc. IsDoc doc => doc -> doc -> doc
    $$  MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR)) -> SDoc
    forall (idR :: Pass).
    OutputableBndrId idR =>
    MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR)) -> SDoc
    pprFunBind  MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR))
    matches
        SDoc -> SDoc -> SDoc
    forall doc. IsDoc doc => doc -> doc -> doc
    $$  SDoc -> SDoc
    forall doc. IsOutput doc => doc -> doc
    whenPprDebug (forall (p :: Pass).
    IsPass p =>
    ((p ~ 'Typechecked) => SDoc) -> SDoc
    pprIfTc @idR (((idR ~ 'Typechecked) => SDoc) -> SDoc)
    -> ((idR ~ 'Typechecked) => SDoc) -> SDoc
    forall a b. (a -> b) -> a -> b
    $ SDoc
    (idR ~ 'Typechecked) => SDoc
    wrapDoc)
            where
                ticksDoc :: SDoc
                ticksDoc :: SDoc
    ticksDoc = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @idR of
                             GhcPass idR
    GhcPs -> SDoc
    forall doc. IsOutput doc => doc
    empty
                             GhcPass idR
    GhcRn -> SDoc
    forall doc. IsOutput doc => doc
    empty
                             GhcPass idR
    GhcTc | (HsWrapper
    _, [CoreTickish]
    ticks) <- XFunBind (GhcPass idL) (GhcPass idR)
    ext ->
                                 if [CoreTickish] -> Bool
    forall a. [a] -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null [CoreTickish]
    ticks
                                    then SDoc
    forall doc. IsOutput doc => doc
    empty
                                    else String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "-- ticks = " SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <> [CoreTickish] -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr [CoreTickish]
    ticks
                wrapDoc :: SDoc
                wrapDoc :: SDoc
    wrapDoc = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @idR of
                            GhcPass idR
    GhcPs -> SDoc
    forall doc. IsOutput doc => doc
    empty
                            GhcPass idR
    GhcRn -> SDoc
    forall doc. IsOutput doc => doc
    empty
                            GhcPass idR
    GhcTc | (HsWrapper
    wrap, [CoreTickish]
    _) <- XFunBind (GhcPass idL) (GhcPass idR)
    ext -> HsWrapper -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr HsWrapper
    wrap

    ppr_monobind (PatSynBind XPatSynBind (GhcPass idL) (GhcPass idR)
    _ PatSynBind (GhcPass idL) (GhcPass idR)
    psb) = PatSynBind (GhcPass idL) (GhcPass idR) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr PatSynBind (GhcPass idL) (GhcPass idR)
    psb
    ppr_monobind (XHsBindsLR XXHsBindsLR (GhcPass idL) (GhcPass idR)
    b) = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @idL of
      GhcPass idL
    GhcTc -> AbsBinds -> SDoc
    ppr_absbinds XXHsBindsLR (GhcPass idL) (GhcPass idR)
    AbsBinds
    b
        where
          ppr_absbinds :: AbsBinds -> SDoc
    ppr_absbinds (AbsBinds { abs_tvs :: AbsBinds -> [TyVar]
    abs_tvs = [TyVar]
    tyvars, abs_ev_vars :: AbsBinds -> [TyVar]
    abs_ev_vars = [TyVar]
    dictvars
                                 , abs_exports :: AbsBinds -> [ABExport]
    abs_exports = [ABExport]
    exports, abs_binds :: AbsBinds -> LHsBinds GhcTc
    abs_binds = LHsBinds GhcTc
    val_binds
                                 , abs_ev_binds :: AbsBinds -> [TcEvBinds]
    abs_ev_binds = [TcEvBinds]
    ev_binds })
            = (SDocContext -> Bool) -> (Bool -> SDoc) -> SDoc
    forall a. (SDocContext -> a) -> (a -> SDoc) -> SDoc
    sdocOption SDocContext -> Bool
    sdocPrintTypecheckerElaboration ((Bool -> SDoc) -> SDoc) -> (Bool -> SDoc) -> SDoc
    forall a b. (a -> b) -> a -> b
    $ \case
              Bool
    False -> LHsBinds GhcTc -> SDoc
    forall (idL :: Pass) (idR :: Pass).
    (OutputableBndrId idL, OutputableBndrId idR) =>
    LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
    pprLHsBinds LHsBinds GhcTc
    val_binds
              Bool
    True  -> -- Show extra information (bug number: #10662)
                       SDoc -> Int -> SDoc -> SDoc
    hang (String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "AbsBinds"
                             SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> [SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    sep [ SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc
    brackets ([TyVar] -> SDoc
    forall a. Outputable a => [a] -> SDoc
    interpp'SP [TyVar]
    tyvars)
                                     , SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc
    brackets ([TyVar] -> SDoc
    forall a. Outputable a => [a] -> SDoc
    interpp'SP [TyVar]
    dictvars) ])
                          Int
    2 (SDoc -> SDoc) -> SDoc -> SDoc
    forall a b. (a -> b) -> a -> b
    $ SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc
    braces (SDoc -> SDoc) -> SDoc -> SDoc
    forall a b. (a -> b) -> a -> b
    $ [SDoc] -> SDoc
    forall doc. IsDoc doc => [doc] -> doc
    vcat
                       [ String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "Exports:" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+>
                           SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc
    brackets ([SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    sep (SDoc -> [SDoc] -> [SDoc]
    forall doc. IsLine doc => doc -> [doc] -> [doc]
    punctuate SDoc
    forall doc. IsLine doc => doc
    comma ((ABExport -> SDoc) -> [ABExport] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map ABExport -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr [ABExport]
    exports)))
                       , String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "Exported types:" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+>
                           [SDoc] -> SDoc
    forall doc. IsDoc doc => [doc] -> doc
    vcat [BindingSite -> TyVar -> SDoc
    forall a. OutputableBndr a => BindingSite -> a -> SDoc
    pprBndr BindingSite
    LetBind (ABExport -> TyVar
    abe_poly ABExport
    ex) | ABExport
    ex <- [ABExport]
    exports]
                       , String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "Binds:" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> LHsBinds GhcTc -> SDoc
    forall (idL :: Pass) (idR :: Pass).
    (OutputableBndrId idL, OutputableBndrId idR) =>
    LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc
    pprLHsBinds LHsBinds GhcTc
    val_binds
                       , forall (p :: Pass).
    IsPass p =>
    ((p ~ 'Typechecked) => SDoc) -> SDoc
    pprIfTc @idR (String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "Evidence:" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> [TcEvBinds] -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr [TcEvBinds]
    ev_binds)
                       ]

    instance Outputable ABExport where
      ppr :: ABExport -> SDoc
    ppr (ABE { abe_wrap :: ABExport -> HsWrapper
    abe_wrap = HsWrapper
    wrap, abe_poly :: ABExport -> TyVar
    abe_poly = TyVar
    gbl, abe_mono :: ABExport -> TyVar
    abe_mono = TyVar
    lcl, abe_prags :: ABExport -> TcSpecPrags
    abe_prags = TcSpecPrags
    prags })
        = [SDoc] -> SDoc
    forall doc. IsDoc doc => [doc] -> doc
    vcat [ [SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    sep [ TyVar -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr TyVar
    gbl, Int -> SDoc -> SDoc
    nest Int
    2 (String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "<=" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> TyVar -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr TyVar
    lcl) ]
               , Int -> SDoc -> SDoc
    nest Int
    2 (TcSpecPrags -> SDoc
    pprTcSpecPrags TcSpecPrags
    prags)
               , SDoc -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr (SDoc -> SDoc) -> SDoc -> SDoc
    forall a b. (a -> b) -> a -> b
    $ Int -> SDoc -> SDoc
    nest Int
    2 (String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "wrap:" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> HsWrapper -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr HsWrapper
    wrap) ]

    instance (OutputableBndrId l, OutputableBndrId r)
              => Outputable (PatSynBind (GhcPass l) (GhcPass r)) where
      ppr :: PatSynBind (GhcPass l) (GhcPass r) -> SDoc
    ppr (PSB{ psb_id :: forall idL idR. PatSynBind idL idR -> LIdP idL
    psb_id = (L Anno (IdGhcP l)
    _ IdGhcP l
    psyn), psb_args :: forall idL idR. PatSynBind idL idR -> HsPatSynDetails idR
    psb_args = HsPatSynDetails (GhcPass r)
    details, psb_def :: forall idL idR. PatSynBind idL idR -> LPat idR
    psb_def = LPat (GhcPass r)
    pat,
                psb_dir :: forall idL idR. PatSynBind idL idR -> HsPatSynDir idR
    psb_dir = HsPatSynDir (GhcPass r)
    dir })
          = SDoc
    ppr_lhs SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> SDoc
    ppr_rhs
        where
          ppr_lhs :: SDoc
    ppr_lhs = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "pattern" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> SDoc
    ppr_details
          ppr_simple :: SDoc -> SDoc
    ppr_simple SDoc
    syntax = SDoc
    syntax SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> LPat (GhcPass r) -> SDoc
    forall (p :: Pass). OutputableBndrId p => LPat (GhcPass p) -> SDoc
    pprLPat LPat (GhcPass r)
    pat

          ppr_details :: SDoc
    ppr_details = case HsPatSynDetails (GhcPass r)
    details of
              InfixCon LIdP (GhcPass r)
    v1 LIdP (GhcPass r)
    v2 -> [SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    hsep [GenLocated (Anno (IdGhcP r)) (IdGhcP r) -> SDoc
    ppr_v LIdP (GhcPass r)
    GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    v1, IdGhcP l -> SDoc
    forall a. OutputableBndr a => a -> SDoc
    pprInfixOcc IdGhcP l
    psyn, GenLocated (Anno (IdGhcP r)) (IdGhcP r) -> SDoc
    ppr_v  LIdP (GhcPass r)
    GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    v2]
                where
                    ppr_v :: GenLocated (Anno (IdGhcP r)) (IdGhcP r) -> SDoc
    ppr_v GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    v = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @r of
                        GhcPass r
    GhcPs -> GenLocated SrcSpanAnnN RdrName -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    GenLocated SrcSpanAnnN RdrName
    v
                        GhcPass r
    GhcRn -> GenLocated SrcSpanAnnN Name -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    GenLocated SrcSpanAnnN Name
    v
                        GhcPass r
    GhcTc -> GenLocated SrcSpanAnnN TyVar -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    GenLocated SrcSpanAnnN TyVar
    v
              PrefixCon [Void]
    _ [LIdP (GhcPass r)]
    vs -> [SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    hsep (IdGhcP l -> SDoc
    forall a. OutputableBndr a => a -> SDoc
    pprPrefixOcc IdGhcP l
    psyn SDoc -> [SDoc] -> [SDoc]
    forall a. a -> [a] -> [a]
    : (GenLocated (Anno (IdGhcP r)) (IdGhcP r) -> SDoc)
    -> [GenLocated (Anno (IdGhcP r)) (IdGhcP r)] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map GenLocated (Anno (IdGhcP r)) (IdGhcP r) -> SDoc
    ppr_v [LIdP (GhcPass r)]
    [GenLocated (Anno (IdGhcP r)) (IdGhcP r)]
    vs)
                where
                    ppr_v :: GenLocated (Anno (IdGhcP r)) (IdGhcP r) -> SDoc
    ppr_v GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    v = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @r of
                        GhcPass r
    GhcPs -> GenLocated SrcSpanAnnN RdrName -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    GenLocated SrcSpanAnnN RdrName
    v
                        GhcPass r
    GhcRn -> GenLocated SrcSpanAnnN Name -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    GenLocated SrcSpanAnnN Name
    v
                        GhcPass r
    GhcTc -> GenLocated SrcSpanAnnN TyVar -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr GenLocated (Anno (IdGhcP r)) (IdGhcP r)
    GenLocated SrcSpanAnnN TyVar
    v
              RecCon [RecordPatSynField (GhcPass r)]
    vs      -> IdGhcP l -> SDoc
    forall a. OutputableBndr a => a -> SDoc
    pprPrefixOcc IdGhcP l
    psyn
                                SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc
    braces ([SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    sep (SDoc -> [SDoc] -> [SDoc]
    forall doc. IsLine doc => doc -> [doc] -> [doc]
    punctuate SDoc
    forall doc. IsLine doc => doc
    comma ((RecordPatSynField (GhcPass r) -> SDoc)
    -> [RecordPatSynField (GhcPass r)] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map RecordPatSynField (GhcPass r) -> SDoc
    ppr_v [RecordPatSynField (GhcPass r)]
    vs)))
                where
                    ppr_v :: RecordPatSynField (GhcPass r) -> SDoc
    ppr_v RecordPatSynField (GhcPass r)
    v = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @r of
                        GhcPass r
    GhcPs -> RecordPatSynField (GhcPass 'Parsed) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr RecordPatSynField (GhcPass r)
    RecordPatSynField (GhcPass 'Parsed)
    v
                        GhcPass r
    GhcRn -> RecordPatSynField GhcRn -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr RecordPatSynField (GhcPass r)
    RecordPatSynField GhcRn
    v
                        GhcPass r
    GhcTc -> RecordPatSynField GhcTc -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr RecordPatSynField (GhcPass r)
    RecordPatSynField GhcTc
    v

          ppr_rhs :: SDoc
    ppr_rhs = case HsPatSynDir (GhcPass r)
    dir of
              HsPatSynDir (GhcPass r)
    Unidirectional           -> SDoc -> SDoc
    ppr_simple (String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "<-")
              HsPatSynDir (GhcPass r)
    ImplicitBidirectional    -> SDoc -> SDoc
    ppr_simple SDoc
    forall doc. IsLine doc => doc
    equals
              ExplicitBidirectional MatchGroup (GhcPass r) (LHsExpr (GhcPass r))
    mg -> SDoc -> SDoc
    ppr_simple (String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "<-") SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "where" SDoc -> SDoc -> SDoc
    forall doc. IsDoc doc => doc -> doc -> doc
    $$
                                          (Int -> SDoc -> SDoc
    nest Int
    2 (SDoc -> SDoc) -> SDoc -> SDoc
    forall a b. (a -> b) -> a -> b
    $ MatchGroup (GhcPass r) (LHsExpr (GhcPass r)) -> SDoc
    forall (idR :: Pass).
    OutputableBndrId idR =>
    MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR)) -> SDoc
    pprFunBind MatchGroup (GhcPass r) (LHsExpr (GhcPass r))
    mg)

    pprTicks :: SDoc -> SDoc -> SDoc
    -- Print stuff about ticks only when -dppr-debug is on, to avoid
    -- them appearing in error messages (from the desugarer); see # 3263
    -- Also print ticks in dumpStyle, so that -ddump-hpc actually does
    -- something useful.
    pprTicks :: SDoc -> SDoc -> SDoc
    pprTicks SDoc
    pp_no_debug SDoc
    pp_when_debug
      = (PprStyle -> SDoc) -> SDoc
    getPprStyle ((PprStyle -> SDoc) -> SDoc) -> (PprStyle -> SDoc) -> SDoc
    forall a b. (a -> b) -> a -> b
    $ \PprStyle
    sty ->
        (Bool -> SDoc) -> SDoc
    forall doc. IsOutput doc => (Bool -> doc) -> doc
    getPprDebug ((Bool -> SDoc) -> SDoc) -> (Bool -> SDoc) -> SDoc
    forall a b. (a -> b) -> a -> b
    $ \Bool
    debug ->
          if Bool
    debug Bool -> Bool -> Bool
    || PprStyle -> Bool
    dumpStyle PprStyle
    sty
             then SDoc
    pp_when_debug
             else SDoc
    pp_no_debug

    instance Outputable (XRec pass (IdP pass)) => Outputable (RecordPatSynField pass) where
        ppr :: RecordPatSynField pass -> SDoc
    ppr (RecordPatSynField { recordPatSynField :: forall pass. RecordPatSynField pass -> FieldOcc pass
    recordPatSynField = FieldOcc pass
    v }) = FieldOcc pass -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr FieldOcc pass
    v

    {-
    ************************************************************************
    *                                                                      *
                    Implicit parameter bindings
    *                                                                      *
    ************************************************************************
    -}

    type instance XIPBinds       GhcPs = NoExtField
    type instance XIPBinds       GhcRn = NoExtField
    type instance XIPBinds       GhcTc = TcEvBinds -- binds uses of the
                                                   -- implicit parameters

    type instance XXHsIPBinds    (GhcPass p) = DataConCantHappen

    isEmptyIPBindsPR :: HsIPBinds (GhcPass p) -> Bool
    isEmptyIPBindsPR :: forall (p :: Pass). HsIPBinds (GhcPass p) -> Bool
    isEmptyIPBindsPR (IPBinds XIPBinds (GhcPass p)
    _ [LIPBind (GhcPass p)]
    is) = [GenLocated SrcSpanAnnA (IPBind (GhcPass p))] -> Bool
    forall a. [a] -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null [LIPBind (GhcPass p)]
    [GenLocated SrcSpanAnnA (IPBind (GhcPass p))]
    is

    isEmptyIPBindsTc :: HsIPBinds GhcTc -> Bool
    isEmptyIPBindsTc :: HsIPBinds GhcTc -> Bool
    isEmptyIPBindsTc (IPBinds XIPBinds GhcTc
    ds [LIPBind GhcTc]
    is) = [GenLocated SrcSpanAnnA (IPBind GhcTc)] -> Bool
    forall a. [a] -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null [LIPBind GhcTc]
    [GenLocated SrcSpanAnnA (IPBind GhcTc)]
    is Bool -> Bool -> Bool
    && TcEvBinds -> Bool
    isEmptyTcEvBinds XIPBinds GhcTc
    TcEvBinds
    ds

    -- EPA annotations in GhcPs, dictionary Id in GhcTc
    type instance XCIPBind GhcPs = EpToken "="
    type instance XCIPBind GhcRn = NoExtField
    type instance XCIPBind GhcTc = Id
    type instance XXIPBind    (GhcPass p) = DataConCantHappen

    instance OutputableBndrId p
           => Outputable (HsIPBinds (GhcPass p)) where
      ppr :: HsIPBinds (GhcPass p) -> SDoc
    ppr (IPBinds XIPBinds (GhcPass p)
    ds [LIPBind (GhcPass p)]
    bs) = ([SDoc] -> SDoc) -> [SDoc] -> SDoc
    pprDeeperList [SDoc] -> SDoc
    forall doc. IsDoc doc => [doc] -> doc
    vcat ((GenLocated SrcSpanAnnA (IPBind (GhcPass p)) -> SDoc)
    -> [GenLocated SrcSpanAnnA (IPBind (GhcPass p))] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map GenLocated SrcSpanAnnA (IPBind (GhcPass p)) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr [LIPBind (GhcPass p)]
    [GenLocated SrcSpanAnnA (IPBind (GhcPass p))]
    bs)
                            SDoc -> SDoc -> SDoc
    forall doc. IsDoc doc => doc -> doc -> doc
    $$ SDoc -> SDoc
    forall doc. IsOutput doc => doc -> doc
    whenPprDebug (forall (p :: Pass).
    IsPass p =>
    ((p ~ 'Typechecked) => SDoc) -> SDoc
    pprIfTc @p (((p ~ 'Typechecked) => SDoc) -> SDoc)
    -> ((p ~ 'Typechecked) => SDoc) -> SDoc
    forall a b. (a -> b) -> a -> b
    $ TcEvBinds -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr XIPBinds (GhcPass p)
    TcEvBinds
    ds)

    instance OutputableBndrId p => Outputable (IPBind (GhcPass p)) where
      ppr :: IPBind (GhcPass p) -> SDoc
    ppr (IPBind XCIPBind (GhcPass p)
    x (L EpAnnCO
    _ HsIPName
    ip) LHsExpr (GhcPass p)
    rhs) = SDoc
    name SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> SDoc
    forall doc. IsLine doc => doc
    equals SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> HsExpr (GhcPass p) -> SDoc
    forall (p :: Pass).
    OutputableBndrId p =>
    HsExpr (GhcPass p) -> SDoc
    pprExpr (GenLocated (Anno (HsExpr (GhcPass p))) (HsExpr (GhcPass p))
    -> HsExpr (GhcPass p)
    forall l e. GenLocated l e -> e
    unLoc LHsExpr (GhcPass p)
    GenLocated (Anno (HsExpr (GhcPass p))) (HsExpr (GhcPass p))
    rhs)
        where name :: SDoc
    name = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @p of
                GhcPass p
    GhcPs -> BindingSite -> HsIPName -> SDoc
    forall a. OutputableBndr a => BindingSite -> a -> SDoc
    pprBndr BindingSite
    LetBind HsIPName
    ip
                GhcPass p
    GhcRn -> BindingSite -> HsIPName -> SDoc
    forall a. OutputableBndr a => BindingSite -> a -> SDoc
    pprBndr BindingSite
    LetBind HsIPName
    ip
                GhcPass p
    GhcTc -> BindingSite -> TyVar -> SDoc
    forall a. OutputableBndr a => BindingSite -> a -> SDoc
    pprBndr BindingSite
    LetBind XCIPBind (GhcPass p)
    TyVar
    x

    {-
    ************************************************************************
    *                                                                      *
    \subsection{@Sig@: type signatures and value-modifying user pragmas}
    *                                                                      *
    ************************************************************************
    -}

    type instance XTypeSig          (GhcPass p) = AnnSig
    type instance XPatSynSig        (GhcPass p) = AnnSig
    type instance XClassOpSig       (GhcPass p) = AnnSig
    type instance XFixSig           (GhcPass p) = ((EpaLocation, Maybe EpaLocation), SourceText)
    type instance XInlineSig        (GhcPass p) = (EpaLocation, EpToken "#-}", ActivationAnn)
    type instance XSpecSig          (GhcPass p) = AnnSpecSig
    type instance XSpecInstSig      (GhcPass p) = ((EpaLocation, EpToken "instance", EpToken "#-}"), SourceText)
    type instance XMinimalSig       (GhcPass p) = ((EpaLocation, EpToken "#-}"), SourceText)
    type instance XSCCFunSig        (GhcPass p) = ((EpaLocation, EpToken "#-}"), SourceText)
    type instance XCompleteMatchSig (GhcPass p) = ((EpaLocation, Maybe TokDcolon, EpToken "#-}"), SourceText)
        -- SourceText: See Note [Pragma source text] in "GHC.Types.SourceText"
    type instance XXSig             GhcPs = DataConCantHappen
    type instance XXSig             GhcRn = IdSig
    type instance XXSig             GhcTc = IdSig

    type instance XFixitySig  GhcPs = NamespaceSpecifier
    type instance XFixitySig  GhcRn = NamespaceSpecifier
    type instance XFixitySig  GhcTc = NoExtField
    type instance XXFixitySig (GhcPass p) = DataConCantHappen

    data AnnSpecSig
      = AnnSpecSig {
          AnnSpecSig -> EpaLocation
    ass_open   :: EpaLocation,
          AnnSpecSig -> EpToken "#-}"
    ass_close  :: EpToken "#-}",
          AnnSpecSig -> TokDcolon
    ass_dcolon :: TokDcolon,
          AnnSpecSig -> ActivationAnn
    ass_act    :: ActivationAnn
        } deriving Typeable AnnSpecSig
    Typeable AnnSpecSig =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> AnnSpecSig -> c AnnSpecSig)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c AnnSpecSig)
    -> (AnnSpecSig -> Constr)
    -> (AnnSpecSig -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c AnnSpecSig))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c AnnSpecSig))
    -> ((forall b. Data b => b -> b) -> AnnSpecSig -> AnnSpecSig)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> AnnSpecSig -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> AnnSpecSig -> r)
    -> (forall u. (forall d. Data d => d -> u) -> AnnSpecSig -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> AnnSpecSig -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig)
    -> Data AnnSpecSig
    AnnSpecSig -> Constr
    AnnSpecSig -> DataType
    (forall b. Data b => b -> b) -> AnnSpecSig -> AnnSpecSig
    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) -> AnnSpecSig -> u
    forall u. (forall d. Data d => d -> u) -> AnnSpecSig -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AnnSpecSig -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AnnSpecSig -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AnnSpecSig
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AnnSpecSig -> c AnnSpecSig
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AnnSpecSig)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnSpecSig)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AnnSpecSig -> c AnnSpecSig
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AnnSpecSig -> c AnnSpecSig
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AnnSpecSig
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AnnSpecSig
    $ctoConstr :: AnnSpecSig -> Constr
    toConstr :: AnnSpecSig -> Constr
    $cdataTypeOf :: AnnSpecSig -> DataType
    dataTypeOf :: AnnSpecSig -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AnnSpecSig)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AnnSpecSig)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnSpecSig)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnSpecSig)
    $cgmapT :: (forall b. Data b => b -> b) -> AnnSpecSig -> AnnSpecSig
    gmapT :: (forall b. Data b => b -> b) -> AnnSpecSig -> AnnSpecSig
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AnnSpecSig -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AnnSpecSig -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AnnSpecSig -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AnnSpecSig -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> AnnSpecSig -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> AnnSpecSig -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AnnSpecSig -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AnnSpecSig -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSpecSig -> m AnnSpecSig
    Data

    instance NoAnn AnnSpecSig where
      noAnn :: AnnSpecSig
    noAnn = EpaLocation
    -> EpToken "#-}" -> TokDcolon -> ActivationAnn -> AnnSpecSig
    AnnSpecSig EpaLocation
    forall a. NoAnn a => a
    noAnn EpToken "#-}"
    forall a. NoAnn a => a
    noAnn TokDcolon
    forall a. NoAnn a => a
    noAnn ActivationAnn
    forall a. NoAnn a => a
    noAnn

    data ActivationAnn
      = ActivationAnn {
          ActivationAnn -> EpToken "["
    aa_openc  :: EpToken "[",
          ActivationAnn -> EpToken "]"
    aa_closec :: EpToken "]",
          ActivationAnn -> Maybe (EpToken "~")
    aa_tilde  :: Maybe (EpToken "~"),
          ActivationAnn -> Maybe EpaLocation
    aa_val    :: Maybe EpaLocation
        } deriving (Typeable ActivationAnn
    Typeable ActivationAnn =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> ActivationAnn -> c ActivationAnn)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c ActivationAnn)
    -> (ActivationAnn -> Constr)
    -> (ActivationAnn -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c ActivationAnn))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c ActivationAnn))
    -> ((forall b. Data b => b -> b) -> ActivationAnn -> ActivationAnn)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> ActivationAnn -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> ActivationAnn -> r)
    -> (forall u. (forall d. Data d => d -> u) -> ActivationAnn -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> ActivationAnn -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn)
    -> Data ActivationAnn
    ActivationAnn -> Constr
    ActivationAnn -> DataType
    (forall b. Data b => b -> b) -> ActivationAnn -> ActivationAnn
    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) -> ActivationAnn -> u
    forall u. (forall d. Data d => d -> u) -> ActivationAnn -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ActivationAnn -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ActivationAnn -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ActivationAnn
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ActivationAnn -> c ActivationAnn
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ActivationAnn)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ActivationAnn)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ActivationAnn -> c ActivationAnn
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ActivationAnn -> c ActivationAnn
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ActivationAnn
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ActivationAnn
    $ctoConstr :: ActivationAnn -> Constr
    toConstr :: ActivationAnn -> Constr
    $cdataTypeOf :: ActivationAnn -> DataType
    dataTypeOf :: ActivationAnn -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ActivationAnn)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ActivationAnn)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ActivationAnn)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ActivationAnn)
    $cgmapT :: (forall b. Data b => b -> b) -> ActivationAnn -> ActivationAnn
    gmapT :: (forall b. Data b => b -> b) -> ActivationAnn -> ActivationAnn
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ActivationAnn -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ActivationAnn -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ActivationAnn -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ActivationAnn -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> ActivationAnn -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> ActivationAnn -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ActivationAnn -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ActivationAnn -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ActivationAnn -> m ActivationAnn
    Data, ActivationAnn -> ActivationAnn -> Bool
    (ActivationAnn -> ActivationAnn -> Bool)
    -> (ActivationAnn -> ActivationAnn -> Bool) -> Eq ActivationAnn
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ActivationAnn -> ActivationAnn -> Bool
    == :: ActivationAnn -> ActivationAnn -> Bool
    $c/= :: ActivationAnn -> ActivationAnn -> Bool
    /= :: ActivationAnn -> ActivationAnn -> Bool
    Eq)

    instance NoAnn ActivationAnn where
      noAnn :: ActivationAnn
    noAnn = EpToken "["
    -> EpToken "]"
    -> Maybe (EpToken "~")
    -> Maybe EpaLocation
    -> ActivationAnn
    ActivationAnn EpToken "["
    forall a. NoAnn a => a
    noAnn EpToken "]"
    forall a. NoAnn a => a
    noAnn Maybe (EpToken "~")
    forall a. NoAnn a => a
    noAnn Maybe EpaLocation
    forall a. NoAnn a => a
    noAnn

    -- | Optional namespace specifier for fixity signatures,
    --  WARNINIG and DEPRECATED pragmas.
    --
    -- Examples:
    --
    --   {-# WARNING in "x-partial" data Head "don't use this pattern synonym" #-}
    --                            -- ↑ DataNamespaceSpecifier
    --
    --   {-# DEPRECATED type D "This type was deprecated" #-}
    --                -- ↑ TypeNamespaceSpecifier
    --
    --   infixr 6 data $
    --          -- ↑ DataNamespaceSpecifier
    data NamespaceSpecifier
      = NoNamespaceSpecifier
      | TypeNamespaceSpecifier (EpToken "type")
      | DataNamespaceSpecifier (EpToken "data")
      deriving (NamespaceSpecifier -> NamespaceSpecifier -> Bool
    (NamespaceSpecifier -> NamespaceSpecifier -> Bool)
    -> (NamespaceSpecifier -> NamespaceSpecifier -> Bool)
    -> Eq NamespaceSpecifier
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: NamespaceSpecifier -> NamespaceSpecifier -> Bool
    == :: NamespaceSpecifier -> NamespaceSpecifier -> Bool
    $c/= :: NamespaceSpecifier -> NamespaceSpecifier -> Bool
    /= :: NamespaceSpecifier -> NamespaceSpecifier -> Bool
    Eq, Typeable NamespaceSpecifier
    Typeable NamespaceSpecifier =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g)
     -> NamespaceSpecifier
     -> c NamespaceSpecifier)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c NamespaceSpecifier)
    -> (NamespaceSpecifier -> Constr)
    -> (NamespaceSpecifier -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c NamespaceSpecifier))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c NamespaceSpecifier))
    -> ((forall b. Data b => b -> b)
        -> NamespaceSpecifier -> NamespaceSpecifier)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> NamespaceSpecifier -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> NamespaceSpecifier -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> NamespaceSpecifier -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> NamespaceSpecifier -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> NamespaceSpecifier -> m NamespaceSpecifier)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> NamespaceSpecifier -> m NamespaceSpecifier)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> NamespaceSpecifier -> m NamespaceSpecifier)
    -> Data NamespaceSpecifier
    NamespaceSpecifier -> Constr
    NamespaceSpecifier -> DataType
    (forall b. Data b => b -> b)
    -> NamespaceSpecifier -> NamespaceSpecifier
    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) -> NamespaceSpecifier -> u
    forall u. (forall d. Data d => d -> u) -> NamespaceSpecifier -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NamespaceSpecifier -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NamespaceSpecifier -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> NamespaceSpecifier -> m NamespaceSpecifier
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> NamespaceSpecifier -> m NamespaceSpecifier
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NamespaceSpecifier
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> NamespaceSpecifier
    -> c NamespaceSpecifier
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NamespaceSpecifier)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c NamespaceSpecifier)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> NamespaceSpecifier
    -> c NamespaceSpecifier
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> NamespaceSpecifier
    -> c NamespaceSpecifier
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NamespaceSpecifier
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NamespaceSpecifier
    $ctoConstr :: NamespaceSpecifier -> Constr
    toConstr :: NamespaceSpecifier -> Constr
    $cdataTypeOf :: NamespaceSpecifier -> DataType
    dataTypeOf :: NamespaceSpecifier -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NamespaceSpecifier)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NamespaceSpecifier)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c NamespaceSpecifier)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c NamespaceSpecifier)
    $cgmapT :: (forall b. Data b => b -> b)
    -> NamespaceSpecifier -> NamespaceSpecifier
    gmapT :: (forall b. Data b => b -> b)
    -> NamespaceSpecifier -> NamespaceSpecifier
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NamespaceSpecifier -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NamespaceSpecifier -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NamespaceSpecifier -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NamespaceSpecifier -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> NamespaceSpecifier -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> NamespaceSpecifier -> [u]
    $cgmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> NamespaceSpecifier -> u
    gmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> NamespaceSpecifier -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> NamespaceSpecifier -> m NamespaceSpecifier
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> NamespaceSpecifier -> m NamespaceSpecifier
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> NamespaceSpecifier -> m NamespaceSpecifier
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> NamespaceSpecifier -> m NamespaceSpecifier
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> NamespaceSpecifier -> m NamespaceSpecifier
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> NamespaceSpecifier -> m NamespaceSpecifier
    Data)

    -- | Check if namespace specifiers overlap, i.e. if they are equal or
    -- if at least one of them doesn't specify a namespace
    overlappingNamespaceSpecifiers :: NamespaceSpecifier -> NamespaceSpecifier -> Bool
    overlappingNamespaceSpecifiers :: NamespaceSpecifier -> NamespaceSpecifier -> Bool
    overlappingNamespaceSpecifiers NamespaceSpecifier
    NoNamespaceSpecifier NamespaceSpecifier
    _ = Bool
    True
    overlappingNamespaceSpecifiers NamespaceSpecifier
    _ NamespaceSpecifier
    NoNamespaceSpecifier = Bool
    True
    overlappingNamespaceSpecifiers TypeNamespaceSpecifier{} TypeNamespaceSpecifier{} = Bool
    True
    overlappingNamespaceSpecifiers DataNamespaceSpecifier{} DataNamespaceSpecifier{} = Bool
    True
    overlappingNamespaceSpecifiers NamespaceSpecifier
    _ NamespaceSpecifier
    _ = Bool
    False

    -- | Check if namespace is covered by a namespace specifier:
    --     * NoNamespaceSpecifier covers both namespaces
    --     * TypeNamespaceSpecifier covers the type namespace only
    --     * DataNamespaceSpecifier covers the data namespace only
    coveredByNamespaceSpecifier :: NamespaceSpecifier -> NameSpace -> Bool
    coveredByNamespaceSpecifier :: NamespaceSpecifier -> NameSpace -> Bool
    coveredByNamespaceSpecifier NamespaceSpecifier
    NoNamespaceSpecifier = Bool -> NameSpace -> Bool
    forall a b. a -> b -> a
    const Bool
    True
    coveredByNamespaceSpecifier TypeNamespaceSpecifier{} = NameSpace -> Bool
    isTcClsNameSpace (NameSpace -> Bool) -> (NameSpace -> Bool) -> NameSpace -> Bool
    forall (f :: * -> *). Applicative f => f Bool -> f Bool -> f Bool
    <||> NameSpace -> Bool
    isTvNameSpace
    coveredByNamespaceSpecifier DataNamespaceSpecifier{} = NameSpace -> Bool
    isValNameSpace
    instance Outputable NamespaceSpecifier where
      ppr :: NamespaceSpecifier -> SDoc
    ppr NamespaceSpecifier
    NoNamespaceSpecifier = SDoc
    forall doc. IsOutput doc => doc
    empty
      ppr TypeNamespaceSpecifier{} = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "type"
      ppr DataNamespaceSpecifier{} = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "data"

    -- | A type signature in generated code, notably the code
    -- generated for record selectors. We simply record the desired Id
    -- itself, replete with its name, type and IdDetails. Otherwise it's
    -- just like a type signature: there should be an accompanying binding
    newtype IdSig = IdSig { IdSig -> TyVar
    unIdSig :: Id }
        deriving Typeable IdSig
    Typeable IdSig =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> IdSig -> c IdSig)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c IdSig)
    -> (IdSig -> Constr)
    -> (IdSig -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c IdSig))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdSig))
    -> ((forall b. Data b => b -> b) -> IdSig -> IdSig)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IdSig -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IdSig -> r)
    -> (forall u. (forall d. Data d => d -> u) -> IdSig -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> IdSig -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> IdSig -> m IdSig)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> IdSig -> m IdSig)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> IdSig -> m IdSig)
    -> Data IdSig
    IdSig -> Constr
    IdSig -> DataType
    (forall b. Data b => b -> b) -> IdSig -> IdSig
    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) -> IdSig -> u
    forall u. (forall d. Data d => d -> u) -> IdSig -> [u]
    forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IdSig -> r
    forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IdSig -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> IdSig -> m IdSig
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IdSig -> m IdSig
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c IdSig
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> IdSig -> c IdSig
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c IdSig)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdSig)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> IdSig -> c IdSig
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> IdSig -> c IdSig
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c IdSig
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c IdSig
    $ctoConstr :: IdSig -> Constr
    toConstr :: IdSig -> Constr
    $cdataTypeOf :: IdSig -> DataType
    dataTypeOf :: IdSig -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c IdSig)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c IdSig)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdSig)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IdSig)
    $cgmapT :: (forall b. Data b => b -> b) -> IdSig -> IdSig
    gmapT :: (forall b. Data b => b -> b) -> IdSig -> IdSig
    $cgmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IdSig -> r
    gmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IdSig -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IdSig -> r
    gmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IdSig -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> IdSig -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> IdSig -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IdSig -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IdSig -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> IdSig -> m IdSig
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> IdSig -> m IdSig
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IdSig -> m IdSig
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IdSig -> m IdSig
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IdSig -> m IdSig
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> IdSig -> m IdSig
    Data

    data AnnSig
      = AnnSig {
          AnnSig -> TokDcolon
    asDcolon  :: EpUniToken "::" "∷",
          AnnSig -> Maybe (EpToken "pattern")
    asPattern :: Maybe (EpToken "pattern"),
          AnnSig -> Maybe (EpToken "default")
    asDefault :: Maybe (EpToken "default")
          } deriving Typeable AnnSig
    Typeable AnnSig =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> AnnSig -> c AnnSig)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c AnnSig)
    -> (AnnSig -> Constr)
    -> (AnnSig -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c AnnSig))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnSig))
    -> ((forall b. Data b => b -> b) -> AnnSig -> AnnSig)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> AnnSig -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> AnnSig -> r)
    -> (forall u. (forall d. Data d => d -> u) -> AnnSig -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> AnnSig -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig)
    -> Data AnnSig
    AnnSig -> Constr
    AnnSig -> DataType
    (forall b. Data b => b -> b) -> AnnSig -> AnnSig
    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) -> AnnSig -> u
    forall u. (forall d. Data d => d -> u) -> AnnSig -> [u]
    forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AnnSig -> r
    forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AnnSig -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AnnSig
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AnnSig -> c AnnSig
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AnnSig)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnSig)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AnnSig -> c AnnSig
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AnnSig -> c AnnSig
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AnnSig
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AnnSig
    $ctoConstr :: AnnSig -> Constr
    toConstr :: AnnSig -> Constr
    $cdataTypeOf :: AnnSig -> DataType
    dataTypeOf :: AnnSig -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AnnSig)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AnnSig)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnSig)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnnSig)
    $cgmapT :: (forall b. Data b => b -> b) -> AnnSig -> AnnSig
    gmapT :: (forall b. Data b => b -> b) -> AnnSig -> AnnSig
    $cgmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AnnSig -> r
    gmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AnnSig -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AnnSig -> r
    gmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AnnSig -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> AnnSig -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> AnnSig -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AnnSig -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AnnSig -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> AnnSig -> m AnnSig
    Data

    instance NoAnn AnnSig where
      noAnn :: AnnSig
    noAnn = TokDcolon
    -> Maybe (EpToken "pattern") -> Maybe (EpToken "default") -> AnnSig
    AnnSig TokDcolon
    forall a. NoAnn a => a
    noAnn Maybe (EpToken "pattern")
    forall a. NoAnn a => a
    noAnn Maybe (EpToken "default")
    forall a. NoAnn a => a
    noAnn

    -- | Type checker Specialisation Pragmas
    --
    -- 'TcSpecPrags' conveys @SPECIALISE@ pragmas from the type checker to the desugarer
    data TcSpecPrags
      = IsDefaultMethod     -- ^ Super-specialised: a default method should
                            -- be macro-expanded at every call site
      | SpecPrags [LTcSpecPrag]
      deriving Typeable TcSpecPrags
    Typeable TcSpecPrags =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> TcSpecPrags -> c TcSpecPrags)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c TcSpecPrags)
    -> (TcSpecPrags -> Constr)
    -> (TcSpecPrags -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c TcSpecPrags))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c TcSpecPrags))
    -> ((forall b. Data b => b -> b) -> TcSpecPrags -> TcSpecPrags)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r)
    -> (forall u. (forall d. Data d => d -> u) -> TcSpecPrags -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> TcSpecPrags -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags)
    -> Data TcSpecPrags
    TcSpecPrags -> Constr
    TcSpecPrags -> DataType
    (forall b. Data b => b -> b) -> TcSpecPrags -> TcSpecPrags
    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) -> TcSpecPrags -> u
    forall u. (forall d. Data d => d -> u) -> TcSpecPrags -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TcSpecPrags
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TcSpecPrags -> c TcSpecPrags
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TcSpecPrags)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TcSpecPrags)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TcSpecPrags -> c TcSpecPrags
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TcSpecPrags -> c TcSpecPrags
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TcSpecPrags
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TcSpecPrags
    $ctoConstr :: TcSpecPrags -> Constr
    toConstr :: TcSpecPrags -> Constr
    $cdataTypeOf :: TcSpecPrags -> DataType
    dataTypeOf :: TcSpecPrags -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TcSpecPrags)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TcSpecPrags)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TcSpecPrags)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TcSpecPrags)
    $cgmapT :: (forall b. Data b => b -> b) -> TcSpecPrags -> TcSpecPrags
    gmapT :: (forall b. Data b => b -> b) -> TcSpecPrags -> TcSpecPrags
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrags -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> TcSpecPrags -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> TcSpecPrags -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrags -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrags -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrags -> m TcSpecPrags
    Data

    -- | Located Type checker Specification Pragmas
    type LTcSpecPrag = Located TcSpecPrag

    -- | Type checker Specification Pragma
    data TcSpecPrag
      = SpecPrag
            Id
            HsWrapper
            InlinePragma
      -- ^ The Id to be specialised, a wrapper that specialises the
      -- polymorphic function, and inlining spec for the specialised function
      deriving Typeable TcSpecPrag
    Typeable TcSpecPrag =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> TcSpecPrag -> c TcSpecPrag)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c TcSpecPrag)
    -> (TcSpecPrag -> Constr)
    -> (TcSpecPrag -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c TcSpecPrag))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c TcSpecPrag))
    -> ((forall b. Data b => b -> b) -> TcSpecPrag -> TcSpecPrag)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r)
    -> (forall u. (forall d. Data d => d -> u) -> TcSpecPrag -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> TcSpecPrag -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag)
    -> Data TcSpecPrag
    TcSpecPrag -> Constr
    TcSpecPrag -> DataType
    (forall b. Data b => b -> b) -> TcSpecPrag -> TcSpecPrag
    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) -> TcSpecPrag -> u
    forall u. (forall d. Data d => d -> u) -> TcSpecPrag -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TcSpecPrag
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TcSpecPrag -> c TcSpecPrag
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TcSpecPrag)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TcSpecPrag)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TcSpecPrag -> c TcSpecPrag
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> TcSpecPrag -> c TcSpecPrag
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TcSpecPrag
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TcSpecPrag
    $ctoConstr :: TcSpecPrag -> Constr
    toConstr :: TcSpecPrag -> Constr
    $cdataTypeOf :: TcSpecPrag -> DataType
    dataTypeOf :: TcSpecPrag -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TcSpecPrag)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TcSpecPrag)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TcSpecPrag)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TcSpecPrag)
    $cgmapT :: (forall b. Data b => b -> b) -> TcSpecPrag -> TcSpecPrag
    gmapT :: (forall b. Data b => b -> b) -> TcSpecPrag -> TcSpecPrag
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TcSpecPrag -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> TcSpecPrag -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> TcSpecPrag -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrag -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TcSpecPrag -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TcSpecPrag -> m TcSpecPrag
    Data

    noSpecPrags :: TcSpecPrags
    noSpecPrags :: TcSpecPrags
    noSpecPrags = [LTcSpecPrag] -> TcSpecPrags
    SpecPrags []

    hasSpecPrags :: TcSpecPrags -> Bool
    hasSpecPrags :: TcSpecPrags -> Bool
    hasSpecPrags (SpecPrags [LTcSpecPrag]
    ps) = Bool -> Bool
    not ([LTcSpecPrag] -> Bool
    forall a. [a] -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null [LTcSpecPrag]
    ps)
    hasSpecPrags TcSpecPrags
    IsDefaultMethod = Bool
    False

    isDefaultMethod :: TcSpecPrags -> Bool
    isDefaultMethod :: TcSpecPrags -> Bool
    isDefaultMethod TcSpecPrags
    IsDefaultMethod = Bool
    True
    isDefaultMethod (SpecPrags {})  = Bool
    False

    instance OutputableBndrId p => Outputable (Sig (GhcPass p)) where
        ppr :: Sig (GhcPass p) -> SDoc
    ppr Sig (GhcPass p)
    sig = Sig (GhcPass p) -> SDoc
    forall (p :: Pass). OutputableBndrId p => Sig (GhcPass p) -> SDoc
    ppr_sig Sig (GhcPass p)
    sig

    ppr_sig :: forall p. OutputableBndrId p
            => Sig (GhcPass p) -> SDoc
    ppr_sig :: forall (p :: Pass). OutputableBndrId p => Sig (GhcPass p) -> SDoc
    ppr_sig (TypeSig XTypeSig (GhcPass p)
    _ [LIdP (GhcPass p)]
    vars LHsSigWcType (GhcPass p)
    ty)  = [IdGhcP p] -> SDoc -> SDoc
    forall id. OutputableBndr id => [id] -> SDoc -> SDoc
    pprVarSig ((GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p)
    -> [GenLocated (Anno (IdGhcP p)) (IdGhcP p)] -> [IdGhcP p]
    forall a b. (a -> b) -> [a] -> [b]
    map GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
    forall l e. GenLocated l e -> e
    unLoc [LIdP (GhcPass p)]
    [GenLocated (Anno (IdGhcP p)) (IdGhcP p)]
    vars) (HsWildCardBndrs
      (GhcPass p) (GenLocated SrcSpanAnnA (HsSigType (GhcPass p)))
    -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LHsSigWcType (GhcPass p)
    HsWildCardBndrs
      (GhcPass p) (GenLocated SrcSpanAnnA (HsSigType (GhcPass p)))
    ty)
    ppr_sig (ClassOpSig XClassOpSig (GhcPass p)
    _ Bool
    is_deflt [LIdP (GhcPass p)]
    vars LHsSigType (GhcPass p)
    ty)
      | Bool
    is_deflt                 = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "default" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> [IdGhcP p] -> SDoc -> SDoc
    forall id. OutputableBndr id => [id] -> SDoc -> SDoc
    pprVarSig ((GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p)
    -> [GenLocated (Anno (IdGhcP p)) (IdGhcP p)] -> [IdGhcP p]
    forall a b. (a -> b) -> [a] -> [b]
    map GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
    forall l e. GenLocated l e -> e
    unLoc [LIdP (GhcPass p)]
    [GenLocated (Anno (IdGhcP p)) (IdGhcP p)]
    vars) (GenLocated SrcSpanAnnA (HsSigType (GhcPass p)) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LHsSigType (GhcPass p)
    GenLocated SrcSpanAnnA (HsSigType (GhcPass p))
    ty)
      | Bool
    otherwise                = [IdGhcP p] -> SDoc -> SDoc
    forall id. OutputableBndr id => [id] -> SDoc -> SDoc
    pprVarSig ((GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p)
    -> [GenLocated (Anno (IdGhcP p)) (IdGhcP p)] -> [IdGhcP p]
    forall a b. (a -> b) -> [a] -> [b]
    map GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
    forall l e. GenLocated l e -> e
    unLoc [LIdP (GhcPass p)]
    [GenLocated (Anno (IdGhcP p)) (IdGhcP p)]
    vars) (GenLocated SrcSpanAnnA (HsSigType (GhcPass p)) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LHsSigType (GhcPass p)
    GenLocated SrcSpanAnnA (HsSigType (GhcPass p))
    ty)
    ppr_sig (FixSig XFixSig (GhcPass p)
    _ FixitySig (GhcPass p)
    fix_sig)   = FixitySig (GhcPass p) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr FixitySig (GhcPass p)
    fix_sig
    ppr_sig (SpecSig XSpecSig (GhcPass p)
    _ LIdP (GhcPass p)
    var [LHsSigType (GhcPass p)]
    ty inl :: InlinePragma
    inl@(InlinePragma { inl_inline :: InlinePragma -> InlineSpec
    inl_inline = InlineSpec
    spec }))
      = SourceText -> String -> SDoc -> SDoc
    pragSrcBrackets (InlinePragma -> SourceText
    inlinePragmaSource InlinePragma
    inl) String
    pragmaSrc (IdGhcP p -> SDoc -> InlinePragma -> SDoc
    forall id. OutputableBndr id => id -> SDoc -> InlinePragma -> SDoc
    pprSpec (GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
    forall l e. GenLocated l e -> e
    unLoc LIdP (GhcPass p)
    GenLocated (Anno (IdGhcP p)) (IdGhcP p)
    var)
                                                 ([GenLocated SrcSpanAnnA (HsSigType (GhcPass p))] -> SDoc
    forall a. Outputable a => [a] -> SDoc
    interpp'SP [LHsSigType (GhcPass p)]
    [GenLocated SrcSpanAnnA (HsSigType (GhcPass p))]
    ty) InlinePragma
    inl)
        where
          pragmaSrc :: String
    pragmaSrc = case InlineSpec
    spec of
            InlineSpec
    NoUserInlinePrag -> String
    "{-# " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ SourceText -> String
    extractSpecPragName (InlinePragma -> SourceText
    inl_src InlinePragma
    inl)
            InlineSpec
    _                -> String
    "{-# " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ SourceText -> String
    extractSpecPragName (InlinePragma -> SourceText
    inl_src InlinePragma
    inl)  String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    "_INLINE"
    ppr_sig (InlineSig XInlineSig (GhcPass p)
    _ LIdP (GhcPass p)
    var InlinePragma
    inl)
      = SDoc
    ppr_pfx SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> InlinePragma -> SDoc
    pprInline InlinePragma
    inl SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> IdGhcP p -> SDoc
    forall a. OutputableBndr a => a -> SDoc
    pprPrefixOcc (GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
    forall l e. GenLocated l e -> e
    unLoc LIdP (GhcPass p)
    GenLocated (Anno (IdGhcP p)) (IdGhcP p)
    var) SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "#-}"
        where
          ppr_pfx :: SDoc
    ppr_pfx = case InlinePragma -> SourceText
    inlinePragmaSource InlinePragma
    inl of
            SourceText FastString
    src -> FastString -> SDoc
    forall doc. IsLine doc => FastString -> doc
    ftext FastString
    src
            SourceText
    NoSourceText   -> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "{-#" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> InlineSpec -> SDoc
    inlinePragmaName (InlinePragma -> InlineSpec
    inl_inline InlinePragma
    inl)
    ppr_sig (SpecInstSig ((EpaLocation, EpToken "instance", EpToken "#-}")
    _, SourceText
    src) LHsSigType (GhcPass p)
    ty)
      = SourceText -> String -> SDoc -> SDoc
    pragSrcBrackets SourceText
    src String
    "{-# pragma" (String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "instance" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> GenLocated SrcSpanAnnA (HsSigType (GhcPass p)) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LHsSigType (GhcPass p)
    GenLocated SrcSpanAnnA (HsSigType (GhcPass p))
    ty)
    ppr_sig (MinimalSig ((EpaLocation, EpToken "#-}")
    _, SourceText
    src) LBooleanFormula (LIdP (GhcPass p))
    bf)
      = SourceText -> String -> SDoc -> SDoc
    pragSrcBrackets SourceText
    src String
    "{-# MINIMAL" (LBooleanFormula (GenLocated (Anno (IdGhcP p)) (IdGhcP p)) -> SDoc
    forall name l.
    OutputableBndr name =>
    LBooleanFormula (GenLocated l name) -> SDoc
    pprMinimalSig LBooleanFormula (LIdP (GhcPass p))
    LBooleanFormula (GenLocated (Anno (IdGhcP p)) (IdGhcP p))
    bf)
    ppr_sig (PatSynSig XPatSynSig (GhcPass p)
    _ [LIdP (GhcPass p)]
    names LHsSigType (GhcPass p)
    sig_ty)
      = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "pattern" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> [IdGhcP p] -> SDoc -> SDoc
    forall id. OutputableBndr id => [id] -> SDoc -> SDoc
    pprVarSig ((GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p)
    -> [GenLocated (Anno (IdGhcP p)) (IdGhcP p)] -> [IdGhcP p]
    forall a b. (a -> b) -> [a] -> [b]
    map GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
    forall l e. GenLocated l e -> e
    unLoc [LIdP (GhcPass p)]
    [GenLocated (Anno (IdGhcP p)) (IdGhcP p)]
    names) (GenLocated SrcSpanAnnA (HsSigType (GhcPass p)) -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LHsSigType (GhcPass p)
    GenLocated SrcSpanAnnA (HsSigType (GhcPass p))
    sig_ty)
    ppr_sig (SCCFunSig ((EpaLocation, EpToken "#-}")
    _, SourceText
    src) LIdP (GhcPass p)
    fn Maybe (XRec (GhcPass p) StringLiteral)
    mlabel)
      = SourceText -> String -> SDoc -> SDoc
    pragSrcBrackets SourceText
    src String
    "{-# SCC" (SDoc
    ppr_fn SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> SDoc
    -> (GenLocated EpAnnCO StringLiteral -> SDoc)
    -> Maybe (GenLocated EpAnnCO StringLiteral)
    -> SDoc
    forall b a. b -> (a -> b) -> Maybe a -> b
    maybe SDoc
    forall doc. IsOutput doc => doc
    empty GenLocated EpAnnCO StringLiteral -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr Maybe (XRec (GhcPass p) StringLiteral)
    Maybe (GenLocated EpAnnCO StringLiteral)
    mlabel )
          where
            ppr_fn :: SDoc
    ppr_fn = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @p of
              GhcPass p
    GhcPs -> GenLocated SrcSpanAnnN RdrName -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LIdP (GhcPass p)
    GenLocated SrcSpanAnnN RdrName
    fn
              GhcPass p
    GhcRn -> GenLocated SrcSpanAnnN Name -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LIdP (GhcPass p)
    GenLocated SrcSpanAnnN Name
    fn
              GhcPass p
    GhcTc -> GenLocated SrcSpanAnnN TyVar -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr LIdP (GhcPass p)
    GenLocated SrcSpanAnnN TyVar
    fn
    ppr_sig (CompleteMatchSig ((EpaLocation, Maybe TokDcolon, EpToken "#-}")
    _, SourceText
    src) [LIdP (GhcPass p)]
    cs Maybe (LIdP (GhcPass p))
    mty)
      = SourceText -> String -> SDoc -> SDoc
    pragSrcBrackets SourceText
    src String
    "{-# COMPLETE"
          (([SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    hsep (SDoc -> [SDoc] -> [SDoc]
    forall doc. IsLine doc => doc -> [doc] -> [doc]
    punctuate SDoc
    forall doc. IsLine doc => doc
    comma ((GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> SDoc)
    -> [GenLocated (Anno (IdGhcP p)) (IdGhcP p)] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> SDoc
    ppr_n [LIdP (GhcPass p)]
    [GenLocated (Anno (IdGhcP p)) (IdGhcP p)]
    cs)))
            SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> SDoc
    opt_sig)
      where
        opt_sig :: SDoc
    opt_sig = SDoc
    -> (GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> SDoc)
    -> Maybe (GenLocated (Anno (IdGhcP p)) (IdGhcP p))
    -> SDoc
    forall b a. b -> (a -> b) -> Maybe a -> b
    maybe SDoc
    forall doc. IsOutput doc => doc
    empty ((\IdGhcP p
    t -> SDoc
    dcolon SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> IdGhcP p -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr IdGhcP p
    t) (IdGhcP p -> SDoc)
    -> (GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p)
    -> GenLocated (Anno (IdGhcP p)) (IdGhcP p)
    -> SDoc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
    forall l e. GenLocated l e -> e
    unLoc) Maybe (LIdP (GhcPass p))
    Maybe (GenLocated (Anno (IdGhcP p)) (IdGhcP p))
    mty
        ppr_n :: GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> SDoc
    ppr_n GenLocated (Anno (IdGhcP p)) (IdGhcP p)
    n = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @p of
            GhcPass p
    GhcPs -> GenLocated SrcSpanAnnN RdrName -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr GenLocated (Anno (IdGhcP p)) (IdGhcP p)
    GenLocated SrcSpanAnnN RdrName
    n
            GhcPass p
    GhcRn -> GenLocated SrcSpanAnnN Name -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr GenLocated (Anno (IdGhcP p)) (IdGhcP p)
    GenLocated SrcSpanAnnN Name
    n
            GhcPass p
    GhcTc -> GenLocated SrcSpanAnnN TyVar -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr GenLocated (Anno (IdGhcP p)) (IdGhcP p)
    GenLocated SrcSpanAnnN TyVar
    n
    ppr_sig (XSig XXSig (GhcPass p)
    x) = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @p of
                          GhcPass p
    GhcRn | IdSig TyVar
    id <- XXSig (GhcPass p)
    x -> [TyVar] -> SDoc -> SDoc
    forall id. OutputableBndr id => [id] -> SDoc -> SDoc
    pprVarSig [TyVar
    id] (Mult -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr (TyVar -> Mult
    varType TyVar
    id))
                          GhcPass p
    GhcTc | IdSig TyVar
    id <- XXSig (GhcPass p)
    x -> [TyVar] -> SDoc -> SDoc
    forall id. OutputableBndr id => [id] -> SDoc -> SDoc
    pprVarSig [TyVar
    id] (Mult -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr (TyVar -> Mult
    varType TyVar
    id))

    hsSigDoc :: forall p. IsPass p => Sig (GhcPass p) -> SDoc
    hsSigDoc :: forall (p :: Pass). IsPass p => Sig (GhcPass p) -> SDoc
    hsSigDoc (TypeSig {})           = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "type signature"
    hsSigDoc (PatSynSig {})         = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "pattern synonym signature"
    hsSigDoc (ClassOpSig XClassOpSig (GhcPass p)
    _ Bool
    is_deflt [LIdP (GhcPass p)]
    _ LHsSigType (GhcPass p)
    _)
     | Bool
    is_deflt                     = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "default type signature"
     | Bool
    otherwise                    = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "class method signature"
    hsSigDoc (SpecSig XSpecSig (GhcPass p)
    _ LIdP (GhcPass p)
    _ [LHsSigType (GhcPass p)]
    _ InlinePragma
    inl)    = (InlineSpec -> SDoc
    inlinePragmaName (InlineSpec -> SDoc)
    -> (InlinePragma -> InlineSpec) -> InlinePragma -> SDoc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . InlinePragma -> InlineSpec
    inl_inline (InlinePragma -> SDoc) -> InlinePragma -> SDoc
    forall a b. (a -> b) -> a -> b
    $ InlinePragma
    inl) SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "pragma"
    hsSigDoc (InlineSig XInlineSig (GhcPass p)
    _ LIdP (GhcPass p)
    _ InlinePragma
    prag)   = (InlineSpec -> SDoc
    inlinePragmaName (InlineSpec -> SDoc)
    -> (InlinePragma -> InlineSpec) -> InlinePragma -> SDoc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . InlinePragma -> InlineSpec
    inl_inline (InlinePragma -> SDoc) -> InlinePragma -> SDoc
    forall a b. (a -> b) -> a -> b
    $ InlinePragma
    prag) SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "pragma"
    -- Using the 'inlinePragmaName' function ensures that the pragma name for any
    -- one of the INLINE/INLINABLE/NOINLINE pragmas are printed after being extracted
    -- from the InlineSpec field of the pragma.
    hsSigDoc (SpecInstSig ((EpaLocation, EpToken "instance", EpToken "#-}")
    _, SourceText
    src) LHsSigType (GhcPass p)
    _)  = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text (SourceText -> String
    extractSpecPragName SourceText
    src) SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "instance pragma"
    hsSigDoc (FixSig {})            = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "fixity declaration"
    hsSigDoc (MinimalSig {})        = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "MINIMAL pragma"
    hsSigDoc (SCCFunSig {})         = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "SCC pragma"
    hsSigDoc (CompleteMatchSig {})  = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "COMPLETE pragma"
    hsSigDoc (XSig XXSig (GhcPass p)
    _)               = case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @p of
                                        GhcPass p
    GhcRn -> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "id signature"
                                        GhcPass p
    GhcTc -> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "id signature"

    -- | Extracts the name for a SPECIALIZE instance pragma. In 'hsSigDoc', the src
    -- field of 'SpecInstSig' signature contains the SourceText for a SPECIALIZE
    -- instance pragma of the form: "SourceText {-# SPECIALIZE"
    --
    -- Extraction ensures that all variants of the pragma name (with a 'Z' or an
    -- 'S') are output exactly as used in the pragma.
    extractSpecPragName :: SourceText -> String
    extractSpecPragName :: SourceText -> String
    extractSpecPragName SourceText
    srcTxt =  case (String -> [String]
    words (String -> [String]) -> String -> [String]
    forall a b. (a -> b) -> a -> b
    $ SourceText -> String
    forall a. Show a => a -> String
    show SourceText
    srcTxt) of
         (String
    _:String
    _:String
    pragName:[String]
    _) -> (Char -> Bool) -> String -> String
    forall a. (a -> Bool) -> [a] -> [a]
    filter (Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    /= Char
    '\"') String
    pragName
         [String]
    _                -> String -> SDoc -> String
    forall a. HasCallStack => String -> SDoc -> a
    pprPanic String
    "hsSigDoc: Misformed SPECIALISE instance pragma:" (SourceText -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr SourceText
    srcTxt)

    instance OutputableBndrId p
           => Outputable (FixitySig (GhcPass p)) where
      ppr :: FixitySig (GhcPass p) -> SDoc
    ppr (FixitySig XFixitySig (GhcPass p)
    ns_spec [LIdP (GhcPass p)]
    names Fixity
    fixity) = [SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    sep [Fixity -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr Fixity
    fixity, SDoc
    ppr_ns_spec, SDoc
    pprops]
        where
          ppr_ns_spec :: SDoc
    ppr_ns_spec =
            case forall (p :: Pass). IsPass p => GhcPass p
    ghcPass @p of
              GhcPass p
    GhcPs -> NamespaceSpecifier -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr XFixitySig (GhcPass p)
    NamespaceSpecifier
    ns_spec
              GhcPass p
    GhcRn -> NamespaceSpecifier -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr XFixitySig (GhcPass p)
    NamespaceSpecifier
    ns_spec
              GhcPass p
    GhcTc -> SDoc
    forall doc. IsOutput doc => doc
    empty
          pprops :: SDoc
    pprops = [SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    hsep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
    forall a b. (a -> b) -> a -> b
    $ SDoc -> [SDoc] -> [SDoc]
    forall doc. IsLine doc => doc -> [doc] -> [doc]
    punctuate SDoc
    forall doc. IsLine doc => doc
    comma ((GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> SDoc)
    -> [GenLocated (Anno (IdGhcP p)) (IdGhcP p)] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map (IdGhcP p -> SDoc
    forall a. OutputableBndr a => a -> SDoc
    pprInfixOcc (IdGhcP p -> SDoc)
    -> (GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p)
    -> GenLocated (Anno (IdGhcP p)) (IdGhcP p)
    -> SDoc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . GenLocated (Anno (IdGhcP p)) (IdGhcP p) -> IdGhcP p
    forall l e. GenLocated l e -> e
    unLoc) [LIdP (GhcPass p)]
    [GenLocated (Anno (IdGhcP p)) (IdGhcP p)]
    names)

    pragBrackets :: SDoc -> SDoc
    pragBrackets :: SDoc -> SDoc
    pragBrackets SDoc
    doc = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "{-#" SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> SDoc
    doc SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "#-}"

    -- | Using SourceText in case the pragma was spelled differently or used mixed
    -- case
    pragSrcBrackets :: SourceText -> String -> SDoc -> SDoc
    pragSrcBrackets :: SourceText -> String -> SDoc -> SDoc
    pragSrcBrackets (SourceText FastString
    src) String
    _   SDoc
    doc = FastString -> SDoc
    forall doc. IsLine doc => FastString -> doc
    ftext FastString
    src SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> SDoc
    doc SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "#-}"
    pragSrcBrackets SourceText
    NoSourceText     String
    alt SDoc
    doc = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    alt SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> SDoc
    doc SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "#-}"

    pprVarSig :: (OutputableBndr id) => [id] -> SDoc -> SDoc
    pprVarSig :: forall id. OutputableBndr id => [id] -> SDoc -> SDoc
    pprVarSig [id]
    vars SDoc
    pp_ty = [SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    sep [SDoc
    pprvars SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> SDoc
    dcolon, Int -> SDoc -> SDoc
    nest Int
    2 SDoc
    pp_ty]
      where
        pprvars :: SDoc
    pprvars = [SDoc] -> SDoc
    forall doc. IsLine doc => [doc] -> doc
    hsep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
    forall a b. (a -> b) -> a -> b
    $ SDoc -> [SDoc] -> [SDoc]
    forall doc. IsLine doc => doc -> [doc] -> [doc]
    punctuate SDoc
    forall doc. IsLine doc => doc
    comma ((id -> SDoc) -> [id] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map id -> SDoc
    forall a. OutputableBndr a => a -> SDoc
    pprPrefixOcc [id]
    vars)

    pprSpec :: (OutputableBndr id) => id -> SDoc -> InlinePragma -> SDoc
    pprSpec :: forall id. OutputableBndr id => id -> SDoc -> InlinePragma -> SDoc
    pprSpec id
    var SDoc
    pp_ty InlinePragma
    inl = SDoc
    pp_inl SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> [id] -> SDoc -> SDoc
    forall id. OutputableBndr id => [id] -> SDoc -> SDoc
    pprVarSig [id
    var] SDoc
    pp_ty
      where
        pp_inl :: SDoc
    pp_inl | InlinePragma -> Bool
    isDefaultInlinePragma InlinePragma
    inl = SDoc
    forall doc. IsOutput doc => doc
    empty
               | Bool
    otherwise = InlinePragma -> SDoc
    pprInline InlinePragma
    inl

    pprTcSpecPrags :: TcSpecPrags -> SDoc
    pprTcSpecPrags :: TcSpecPrags -> SDoc
    pprTcSpecPrags TcSpecPrags
    IsDefaultMethod = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "<default method>"
    pprTcSpecPrags (SpecPrags [LTcSpecPrag]
    ps)  = [SDoc] -> SDoc
    forall doc. IsDoc doc => [doc] -> doc
    vcat ((LTcSpecPrag -> SDoc) -> [LTcSpecPrag] -> [SDoc]
    forall a b. (a -> b) -> [a] -> [b]
    map (TcSpecPrag -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr (TcSpecPrag -> SDoc)
    -> (LTcSpecPrag -> TcSpecPrag) -> LTcSpecPrag -> SDoc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . LTcSpecPrag -> TcSpecPrag
    forall l e. GenLocated l e -> e
    unLoc) [LTcSpecPrag]
    ps)

    instance Outputable TcSpecPrag where
      ppr :: TcSpecPrag -> SDoc
    ppr (SpecPrag TyVar
    var HsWrapper
    _ InlinePragma
    inl)
        = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text (SourceText -> String
    extractSpecPragName (SourceText -> String) -> SourceText -> String
    forall a b. (a -> b) -> a -> b
    $ InlinePragma -> SourceText
    inl_src InlinePragma
    inl) SDoc -> SDoc -> SDoc
    forall doc. IsLine doc => doc -> doc -> doc
    <+> TyVar -> SDoc -> InlinePragma -> SDoc
    forall id. OutputableBndr id => id -> SDoc -> InlinePragma -> SDoc
    pprSpec TyVar
    var (String -> SDoc
    forall doc. IsLine doc => String -> doc
    text String
    "<type>") InlinePragma
    inl

    pprMinimalSig :: (OutputableBndr name)
                  => LBooleanFormula (GenLocated l name) -> SDoc
    pprMinimalSig :: forall name l.
    OutputableBndr name =>
    LBooleanFormula (GenLocated l name) -> SDoc
    pprMinimalSig (L SrcSpanAnnL
    _ BooleanFormula (GenLocated l name)
    bf) = BooleanFormula name -> SDoc
    forall a. Outputable a => a -> SDoc
    ppr ((GenLocated l name -> name)
    -> BooleanFormula (GenLocated l name) -> BooleanFormula name
    forall a b. (a -> b) -> BooleanFormula a -> BooleanFormula b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap GenLocated l name -> name
    forall l e. GenLocated l e -> e
    unLoc BooleanFormula (GenLocated l name)
    bf)

    {-
    ************************************************************************
    *                                                                      *
    \subsection{Anno instances}
    *                                                                      *
    ************************************************************************
    -}

    type instance Anno (HsBindLR (GhcPass idL) (GhcPass idR)) = SrcSpanAnnA
    type instance Anno (IPBind (GhcPass p)) = SrcSpanAnnA
    type instance Anno (Sig (GhcPass p)) = SrcSpanAnnA

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

    type instance Anno StringLiteral = EpAnnCO