{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

-- | Type signature declarations.
module Ormolu.Printer.Meat.Declaration.Signature
  ( p_sigDecl,
    p_typeAscription,
    p_activation,
    p_standaloneKindSig,
  )
where

import Control.Monad
import GHC.Data.BooleanFormula
import GHC.Hs
import GHC.Types.Basic
import GHC.Types.Fixity
import GHC.Types.Name.Reader
import GHC.Types.SourceText
import GHC.Types.SrcLoc
import Ormolu.Printer.Combinators
import Ormolu.Printer.Meat.Common
import Ormolu.Printer.Meat.Type
import Ormolu.Utils

p_sigDecl :: Sig GhcPs -> R ()
p_sigDecl :: Sig GhcPs -> R ()
p_sigDecl = \case
  TypeSig XTypeSig GhcPs
_ [LIdP GhcPs]
names LHsSigWcType GhcPs
hswc -> Bool -> [LocatedN RdrName] -> LHsSigType GhcPs -> R ()
p_typeSig Bool
True [LIdP GhcPs]
[LocatedN RdrName]
names (HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall pass thing. HsWildCardBndrs pass thing -> thing
hswc_body LHsSigWcType GhcPs
HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
hswc)
  PatSynSig XPatSynSig GhcPs
_ [LIdP GhcPs]
names LHsSigType GhcPs
sigType -> [LocatedN RdrName] -> LHsSigType GhcPs -> R ()
p_patSynSig [LIdP GhcPs]
[LocatedN RdrName]
names LHsSigType GhcPs
sigType
  ClassOpSig XClassOpSig GhcPs
_ Bool
def [LIdP GhcPs]
names LHsSigType GhcPs
sigType -> Bool -> [LocatedN RdrName] -> LHsSigType GhcPs -> R ()
p_classOpSig Bool
def [LIdP GhcPs]
[LocatedN RdrName]
names LHsSigType GhcPs
sigType
  FixSig XFixSig GhcPs
_ FixitySig GhcPs
sig -> FixitySig GhcPs -> R ()
p_fixSig FixitySig GhcPs
sig
  InlineSig XInlineSig GhcPs
_ LIdP GhcPs
name InlinePragma
inlinePragma -> LocatedN RdrName -> InlinePragma -> R ()
p_inlineSig LIdP GhcPs
LocatedN RdrName
name InlinePragma
inlinePragma
  SpecSig XSpecSig GhcPs
_ LIdP GhcPs
name [LHsSigType GhcPs]
ts InlinePragma
inlinePragma -> LocatedN RdrName -> [LHsSigType GhcPs] -> InlinePragma -> R ()
p_specSig LIdP GhcPs
LocatedN RdrName
name [LHsSigType GhcPs]
ts InlinePragma
inlinePragma
  SpecInstSig XSpecInstSig GhcPs
_ LHsSigType GhcPs
sigType -> LHsSigType GhcPs -> R ()
p_specInstSig LHsSigType GhcPs
sigType
  MinimalSig XMinimalSig GhcPs
_ LBooleanFormula (LIdP GhcPs)
booleanFormula -> LBooleanFormula (LocatedN RdrName) -> R ()
p_minimalSig LBooleanFormula (LIdP GhcPs)
LBooleanFormula (LocatedN RdrName)
booleanFormula
  CompleteMatchSig XCompleteMatchSig GhcPs
_ XRec GhcPs [LIdP GhcPs]
cs Maybe (LIdP GhcPs)
ty -> Located [LocatedN RdrName] -> Maybe (LocatedN RdrName) -> R ()
p_completeSig XRec GhcPs [LIdP GhcPs]
Located [LocatedN RdrName]
cs Maybe (LIdP GhcPs)
Maybe (LocatedN RdrName)
ty
  SCCFunSig XSCCFunSig GhcPs
_ LIdP GhcPs
name Maybe (XRec GhcPs StringLiteral)
literal -> LocatedN RdrName -> Maybe (XRec GhcPs StringLiteral) -> R ()
p_sccSig LIdP GhcPs
LocatedN RdrName
name Maybe (XRec GhcPs StringLiteral)
literal

p_typeSig ::
  -- | Should the tail of the names be indented
  Bool ->
  -- | Names (before @::@)
  [LocatedN RdrName] ->
  -- | Type
  LHsSigType GhcPs ->
  R ()
p_typeSig :: Bool -> [LocatedN RdrName] -> LHsSigType GhcPs -> R ()
p_typeSig Bool
_ [] LHsSigType GhcPs
_ = () -> R ()
forall a. a -> R a
forall (m :: * -> *) a. Monad m => a -> m a
return () -- should not happen though
p_typeSig Bool
indentTail (LocatedN RdrName
n : [LocatedN RdrName]
ns) LHsSigType GhcPs
sigType = do
  LocatedN RdrName -> R ()
p_rdrName LocatedN RdrName
n
  if [LocatedN RdrName] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [LocatedN RdrName]
ns
    then LHsSigType GhcPs -> R ()
p_typeAscription LHsSigType GhcPs
sigType
    else Bool -> R () -> R ()
inciIf Bool
indentTail (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ do
      R ()
commaDel
      R () -> (LocatedN RdrName -> R ()) -> [LocatedN RdrName] -> R ()
forall a. R () -> (a -> R ()) -> [a] -> R ()
sep R ()
commaDel LocatedN RdrName -> R ()
p_rdrName [LocatedN RdrName]
ns
      LHsSigType GhcPs -> R ()
p_typeAscription LHsSigType GhcPs
sigType

p_typeAscription ::
  LHsSigType GhcPs ->
  R ()
p_typeAscription :: LHsSigType GhcPs -> R ()
p_typeAscription LHsSigType GhcPs
sigType = R () -> R ()
inci (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ do
  R ()
space
  Text -> R ()
txt Text
"::"
  if HsType GhcPs -> Bool
hasDocStrings (GenLocated SrcSpanAnnA (HsType GhcPs) -> HsType GhcPs
forall l e. GenLocated l e -> e
unLoc (GenLocated SrcSpanAnnA (HsType GhcPs) -> HsType GhcPs)
-> (LHsSigType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs))
-> LHsSigType GhcPs
-> HsType GhcPs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HsSigType GhcPs -> LHsType GhcPs
HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs)
forall pass. HsSigType pass -> LHsType pass
sig_body (HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs))
-> (GenLocated SrcSpanAnnA (HsSigType GhcPs) -> HsSigType GhcPs)
-> GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> GenLocated SrcSpanAnnA (HsType GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (HsSigType GhcPs) -> HsSigType GhcPs
forall l e. GenLocated l e -> e
unLoc (LHsSigType GhcPs -> HsType GhcPs)
-> LHsSigType GhcPs -> HsType GhcPs
forall a b. (a -> b) -> a -> b
$ LHsSigType GhcPs
sigType)
    then R ()
newline
    else R ()
breakpoint
  GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> (HsSigType GhcPs -> R ()) -> R ()
forall l a. HasSrcSpan l => GenLocated l a -> (a -> R ()) -> R ()
located LHsSigType GhcPs
GenLocated SrcSpanAnnA (HsSigType GhcPs)
sigType HsSigType GhcPs -> R ()
p_hsSigType

p_patSynSig ::
  [LocatedN RdrName] ->
  LHsSigType GhcPs ->
  R ()
p_patSynSig :: [LocatedN RdrName] -> LHsSigType GhcPs -> R ()
p_patSynSig [LocatedN RdrName]
names LHsSigType GhcPs
sigType = do
  Text -> R ()
txt Text
"pattern"
  let body :: R ()
body = Bool -> [LocatedN RdrName] -> LHsSigType GhcPs -> R ()
p_typeSig Bool
False [LocatedN RdrName]
names LHsSigType GhcPs
sigType
  if [LocatedN RdrName] -> PhaseNum
forall a. [a] -> PhaseNum
forall (t :: * -> *) a. Foldable t => t a -> PhaseNum
length [LocatedN RdrName]
names PhaseNum -> PhaseNum -> Bool
forall a. Ord a => a -> a -> Bool
> PhaseNum
1
    then R ()
breakpoint R () -> R () -> R ()
forall a b. R a -> R b -> R b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> R () -> R ()
inci R ()
body
    else R ()
space R () -> R () -> R ()
forall a b. R a -> R b -> R b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> R ()
body

p_classOpSig ::
  -- | Whether this is a \"default\" signature
  Bool ->
  -- | Names (before @::@)
  [LocatedN RdrName] ->
  -- | Type
  LHsSigType GhcPs ->
  R ()
p_classOpSig :: Bool -> [LocatedN RdrName] -> LHsSigType GhcPs -> R ()
p_classOpSig Bool
def [LocatedN RdrName]
names LHsSigType GhcPs
sigType = do
  Bool -> R () -> R ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
def (Text -> R ()
txt Text
"default" R () -> R () -> R ()
forall a b. R a -> R b -> R b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> R ()
space)
  Bool -> [LocatedN RdrName] -> LHsSigType GhcPs -> R ()
p_typeSig Bool
True [LocatedN RdrName]
names LHsSigType GhcPs
sigType

p_fixSig ::
  FixitySig GhcPs ->
  R ()
p_fixSig :: FixitySig GhcPs -> R ()
p_fixSig = \case
  FixitySig XFixitySig GhcPs
NoExtField
NoExtField [LIdP GhcPs]
names (Fixity SourceText
_ PhaseNum
n FixityDirection
dir) -> do
    Text -> R ()
txt (Text -> R ()) -> Text -> R ()
forall a b. (a -> b) -> a -> b
$ case FixityDirection
dir of
      FixityDirection
InfixL -> Text
"infixl"
      FixityDirection
InfixR -> Text
"infixr"
      FixityDirection
InfixN -> Text
"infix"
    R ()
space
    PhaseNum -> R ()
forall a. Outputable a => a -> R ()
atom PhaseNum
n
    R ()
space
    R () -> R ()
sitcc (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ R () -> (LocatedN RdrName -> R ()) -> [LocatedN RdrName] -> R ()
forall a. R () -> (a -> R ()) -> [a] -> R ()
sep R ()
commaDel LocatedN RdrName -> R ()
p_rdrName [LIdP GhcPs]
[LocatedN RdrName]
names

p_inlineSig ::
  -- | Name
  LocatedN RdrName ->
  -- | Inline pragma specification
  InlinePragma ->
  R ()
p_inlineSig :: LocatedN RdrName -> InlinePragma -> R ()
p_inlineSig LocatedN RdrName
name InlinePragma {Maybe PhaseNum
SourceText
InlineSpec
RuleMatchInfo
Activation
inl_src :: SourceText
inl_inline :: InlineSpec
inl_sat :: Maybe PhaseNum
inl_act :: Activation
inl_rule :: RuleMatchInfo
inl_src :: InlinePragma -> SourceText
inl_inline :: InlinePragma -> InlineSpec
inl_sat :: InlinePragma -> Maybe PhaseNum
inl_act :: InlinePragma -> Activation
inl_rule :: InlinePragma -> RuleMatchInfo
..} = R () -> R ()
pragmaBraces (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ do
  InlineSpec -> R ()
p_inlineSpec InlineSpec
inl_inline
  R ()
space
  case RuleMatchInfo
inl_rule of
    RuleMatchInfo
ConLike -> Text -> R ()
txt Text
"CONLIKE"
    RuleMatchInfo
FunLike -> () -> R ()
forall a. a -> R a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
  R ()
space
  Bool -> R () -> R ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Activation
inl_act Activation -> Activation -> Bool
forall a. Eq a => a -> a -> Bool
/= Activation
NeverActive) (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ Activation -> R ()
p_activation Activation
inl_act
  R ()
space
  LocatedN RdrName -> R ()
p_rdrName LocatedN RdrName
name

p_specSig ::
  -- | Name
  LocatedN RdrName ->
  -- | The types to specialize to
  [LHsSigType GhcPs] ->
  -- | For specialize inline
  InlinePragma ->
  R ()
p_specSig :: LocatedN RdrName -> [LHsSigType GhcPs] -> InlinePragma -> R ()
p_specSig LocatedN RdrName
name [LHsSigType GhcPs]
ts InlinePragma {Maybe PhaseNum
SourceText
InlineSpec
RuleMatchInfo
Activation
inl_src :: InlinePragma -> SourceText
inl_inline :: InlinePragma -> InlineSpec
inl_sat :: InlinePragma -> Maybe PhaseNum
inl_act :: InlinePragma -> Activation
inl_rule :: InlinePragma -> RuleMatchInfo
inl_src :: SourceText
inl_inline :: InlineSpec
inl_sat :: Maybe PhaseNum
inl_act :: Activation
inl_rule :: RuleMatchInfo
..} = R () -> R ()
pragmaBraces (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ do
  Text -> R ()
txt Text
"SPECIALIZE"
  R ()
space
  InlineSpec -> R ()
p_inlineSpec InlineSpec
inl_inline
  R ()
space
  Activation -> R ()
p_activation Activation
inl_act
  R ()
space
  LocatedN RdrName -> R ()
p_rdrName LocatedN RdrName
name
  R ()
space
  Text -> R ()
txt Text
"::"
  R ()
breakpoint
  R () -> R ()
inci (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ R ()
-> (GenLocated SrcSpanAnnA (HsSigType GhcPs) -> R ())
-> [GenLocated SrcSpanAnnA (HsSigType GhcPs)]
-> R ()
forall a. R () -> (a -> R ()) -> [a] -> R ()
sep R ()
commaDel ((HsSigType GhcPs -> R ())
-> GenLocated SrcSpanAnnA (HsSigType GhcPs) -> R ()
forall l a. HasSrcSpan l => (a -> R ()) -> GenLocated l a -> R ()
located' HsSigType GhcPs -> R ()
p_hsSigType) [LHsSigType GhcPs]
[GenLocated SrcSpanAnnA (HsSigType GhcPs)]
ts

p_inlineSpec :: InlineSpec -> R ()
p_inlineSpec :: InlineSpec -> R ()
p_inlineSpec = \case
  Inline SourceText
_ -> Text -> R ()
txt Text
"INLINE"
  Inlinable SourceText
_ -> Text -> R ()
txt Text
"INLINEABLE"
  NoInline SourceText
_ -> Text -> R ()
txt Text
"NOINLINE"
  Opaque SourceText
_ -> Text -> R ()
txt Text
"OPAQUE"
  InlineSpec
NoUserInlinePrag -> () -> R ()
forall a. a -> R a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

p_activation :: Activation -> R ()
p_activation :: Activation -> R ()
p_activation = \case
  Activation
NeverActive -> Text -> R ()
txt Text
"[~]"
  Activation
AlwaysActive -> () -> R ()
forall a. a -> R a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
  ActiveBefore SourceText
_ PhaseNum
n -> do
    Text -> R ()
txt Text
"[~"
    PhaseNum -> R ()
forall a. Outputable a => a -> R ()
atom PhaseNum
n
    Text -> R ()
txt Text
"]"
  ActiveAfter SourceText
_ PhaseNum
n -> do
    Text -> R ()
txt Text
"["
    PhaseNum -> R ()
forall a. Outputable a => a -> R ()
atom PhaseNum
n
    Text -> R ()
txt Text
"]"
  Activation
FinalActive -> String -> R ()
forall a. String -> a
notImplemented String
"FinalActive" -- NOTE(amesgen) is this unreachable or just not implemented?

p_specInstSig :: LHsSigType GhcPs -> R ()
p_specInstSig :: LHsSigType GhcPs -> R ()
p_specInstSig LHsSigType GhcPs
sigType =
  Text -> R () -> R ()
pragma Text
"SPECIALIZE instance" (R () -> R ()) -> (R () -> R ()) -> R () -> R ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. R () -> R ()
inci (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$
    GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> (HsSigType GhcPs -> R ()) -> R ()
forall l a. HasSrcSpan l => GenLocated l a -> (a -> R ()) -> R ()
located LHsSigType GhcPs
GenLocated SrcSpanAnnA (HsSigType GhcPs)
sigType HsSigType GhcPs -> R ()
p_hsSigType

p_minimalSig ::
  -- | Boolean formula
  LBooleanFormula (LocatedN RdrName) ->
  R ()
p_minimalSig :: LBooleanFormula (LocatedN RdrName) -> R ()
p_minimalSig =
  (BooleanFormula (LocatedN RdrName) -> R ())
-> LBooleanFormula (LocatedN RdrName) -> R ()
forall l a. HasSrcSpan l => (a -> R ()) -> GenLocated l a -> R ()
located' ((BooleanFormula (LocatedN RdrName) -> R ())
 -> LBooleanFormula (LocatedN RdrName) -> R ())
-> (BooleanFormula (LocatedN RdrName) -> R ())
-> LBooleanFormula (LocatedN RdrName)
-> R ()
forall a b. (a -> b) -> a -> b
$ \BooleanFormula (LocatedN RdrName)
booleanFormula ->
    Text -> R () -> R ()
pragma Text
"MINIMAL" (R () -> R ()
inci (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ BooleanFormula (LocatedN RdrName) -> R ()
p_booleanFormula BooleanFormula (LocatedN RdrName)
booleanFormula)

p_booleanFormula ::
  -- | Boolean formula
  BooleanFormula (LocatedN RdrName) ->
  R ()
p_booleanFormula :: BooleanFormula (LocatedN RdrName) -> R ()
p_booleanFormula = \case
  Var LocatedN RdrName
name -> LocatedN RdrName -> R ()
p_rdrName LocatedN RdrName
name
  And [LBooleanFormula (LocatedN RdrName)]
xs ->
    R () -> R ()
sitcc (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$
      R ()
-> (LBooleanFormula (LocatedN RdrName) -> R ())
-> [LBooleanFormula (LocatedN RdrName)]
-> R ()
forall a. R () -> (a -> R ()) -> [a] -> R ()
sep
        R ()
commaDel
        ((BooleanFormula (LocatedN RdrName) -> R ())
-> LBooleanFormula (LocatedN RdrName) -> R ()
forall l a. HasSrcSpan l => (a -> R ()) -> GenLocated l a -> R ()
located' BooleanFormula (LocatedN RdrName) -> R ()
p_booleanFormula)
        [LBooleanFormula (LocatedN RdrName)]
xs
  Or [LBooleanFormula (LocatedN RdrName)]
xs ->
    R () -> R ()
sitcc (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$
      R ()
-> (LBooleanFormula (LocatedN RdrName) -> R ())
-> [LBooleanFormula (LocatedN RdrName)]
-> R ()
forall a. R () -> (a -> R ()) -> [a] -> R ()
sep
        (R ()
breakpoint R () -> R () -> R ()
forall a b. R a -> R b -> R b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Text -> R ()
txt Text
"|" R () -> R () -> R ()
forall a b. R a -> R b -> R b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> R ()
space)
        ((BooleanFormula (LocatedN RdrName) -> R ())
-> LBooleanFormula (LocatedN RdrName) -> R ()
forall l a. HasSrcSpan l => (a -> R ()) -> GenLocated l a -> R ()
located' BooleanFormula (LocatedN RdrName) -> R ()
p_booleanFormula)
        [LBooleanFormula (LocatedN RdrName)]
xs
  Parens LBooleanFormula (LocatedN RdrName)
l -> LBooleanFormula (LocatedN RdrName)
-> (BooleanFormula (LocatedN RdrName) -> R ()) -> R ()
forall l a. HasSrcSpan l => GenLocated l a -> (a -> R ()) -> R ()
located LBooleanFormula (LocatedN RdrName)
l (BracketStyle -> R () -> R ()
parens BracketStyle
N (R () -> R ())
-> (BooleanFormula (LocatedN RdrName) -> R ())
-> BooleanFormula (LocatedN RdrName)
-> R ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BooleanFormula (LocatedN RdrName) -> R ()
p_booleanFormula)

p_completeSig ::
  -- | Constructors\/patterns
  Located [LocatedN RdrName] ->
  -- | Type
  Maybe (LocatedN RdrName) ->
  R ()
p_completeSig :: Located [LocatedN RdrName] -> Maybe (LocatedN RdrName) -> R ()
p_completeSig Located [LocatedN RdrName]
cs' Maybe (LocatedN RdrName)
mty =
  Located [LocatedN RdrName] -> ([LocatedN RdrName] -> R ()) -> R ()
forall l a. HasSrcSpan l => GenLocated l a -> (a -> R ()) -> R ()
located Located [LocatedN RdrName]
cs' (([LocatedN RdrName] -> R ()) -> R ())
-> ([LocatedN RdrName] -> R ()) -> R ()
forall a b. (a -> b) -> a -> b
$ \[LocatedN RdrName]
cs ->
    Text -> R () -> R ()
pragma Text
"COMPLETE" (R () -> R ()) -> (R () -> R ()) -> R () -> R ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. R () -> R ()
inci (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ do
      R () -> (LocatedN RdrName -> R ()) -> [LocatedN RdrName] -> R ()
forall a. R () -> (a -> R ()) -> [a] -> R ()
sep R ()
commaDel LocatedN RdrName -> R ()
p_rdrName [LocatedN RdrName]
cs
      Maybe (LocatedN RdrName) -> (LocatedN RdrName -> R ()) -> R ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ Maybe (LocatedN RdrName)
mty ((LocatedN RdrName -> R ()) -> R ())
-> (LocatedN RdrName -> R ()) -> R ()
forall a b. (a -> b) -> a -> b
$ \LocatedN RdrName
ty -> do
        R ()
space
        Text -> R ()
txt Text
"::"
        R ()
breakpoint
        R () -> R ()
inci (LocatedN RdrName -> R ()
p_rdrName LocatedN RdrName
ty)

p_sccSig :: LocatedN RdrName -> Maybe (XRec GhcPs StringLiteral) -> R ()
p_sccSig :: LocatedN RdrName -> Maybe (XRec GhcPs StringLiteral) -> R ()
p_sccSig LocatedN RdrName
loc Maybe (XRec GhcPs StringLiteral)
literal = Text -> R () -> R ()
pragma Text
"SCC" (R () -> R ()) -> (R () -> R ()) -> R () -> R ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. R () -> R ()
inci (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ do
  LocatedN RdrName -> R ()
p_rdrName LocatedN RdrName
loc
  Maybe (GenLocated (SrcAnn NoEpAnns) StringLiteral)
-> (GenLocated (SrcAnn NoEpAnns) StringLiteral -> R ()) -> R ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ Maybe (XRec GhcPs StringLiteral)
Maybe (GenLocated (SrcAnn NoEpAnns) StringLiteral)
literal ((GenLocated (SrcAnn NoEpAnns) StringLiteral -> R ()) -> R ())
-> (GenLocated (SrcAnn NoEpAnns) StringLiteral -> R ()) -> R ()
forall a b. (a -> b) -> a -> b
$ \GenLocated (SrcAnn NoEpAnns) StringLiteral
x -> do
    R ()
breakpoint
    GenLocated (SrcAnn NoEpAnns) StringLiteral -> R ()
forall a. Outputable a => a -> R ()
atom GenLocated (SrcAnn NoEpAnns) StringLiteral
x

p_standaloneKindSig :: StandaloneKindSig GhcPs -> R ()
p_standaloneKindSig :: StandaloneKindSig GhcPs -> R ()
p_standaloneKindSig (StandaloneKindSig XStandaloneKindSig GhcPs
_ LIdP GhcPs
name LHsSigType GhcPs
sigTy) = do
  Text -> R ()
txt Text
"type"
  R () -> R ()
inci (R () -> R ()) -> R () -> R ()
forall a b. (a -> b) -> a -> b
$ do
    R ()
space
    LocatedN RdrName -> R ()
p_rdrName LIdP GhcPs
LocatedN RdrName
name
    R ()
space
    Text -> R ()
txt Text
"::"
    R ()
breakpoint
    GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> (HsSigType GhcPs -> R ()) -> R ()
forall l a. HasSrcSpan l => GenLocated l a -> (a -> R ()) -> R ()
located LHsSigType GhcPs
GenLocated SrcSpanAnnA (HsSigType GhcPs)
sigTy HsSigType GhcPs -> R ()
p_hsSigType