module HIndent.Ast.Declaration.Splice
  ( SpliceDeclaration
  , mkSpliceDeclaration
  ) where

import HIndent.Ast.Expression.Splice
import HIndent.Ast.NodeComments
import qualified HIndent.GhcLibParserWrapper.GHC.Hs as GHC
import {-# SOURCE #-} HIndent.Pretty
import HIndent.Pretty.NodeComments

newtype SpliceDeclaration =
  SpliceDeclaration (GHC.SpliceDecl GHC.GhcPs)

instance CommentExtraction SpliceDeclaration where
  nodeComments :: SpliceDeclaration -> NodeComments
nodeComments SpliceDeclaration {} = [LEpaComment] -> [LEpaComment] -> [LEpaComment] -> NodeComments
NodeComments [] [] []

instance Pretty SpliceDeclaration where
  pretty' :: SpliceDeclaration -> Printer ()
pretty' (SpliceDeclaration (GHC.SpliceDecl XSpliceDecl GhcPs
_ XRec GhcPs (HsUntypedSplice GhcPs)
sp SpliceDecoration
_)) =
    GenLocated SrcSpanAnnA Splice -> Printer ()
forall a. Pretty a => a -> Printer ()
pretty (GenLocated SrcSpanAnnA Splice -> Printer ())
-> GenLocated SrcSpanAnnA Splice -> Printer ()
forall a b. (a -> b) -> a -> b
$ (HsUntypedSplice GhcPs -> Splice)
-> GenLocated SrcSpanAnnA (HsUntypedSplice GhcPs)
-> GenLocated SrcSpanAnnA Splice
forall a b.
(a -> b) -> GenLocated SrcSpanAnnA a -> GenLocated SrcSpanAnnA b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HsUntypedSplice GhcPs -> Splice
mkSplice XRec GhcPs (HsUntypedSplice GhcPs)
GenLocated SrcSpanAnnA (HsUntypedSplice GhcPs)
sp

mkSpliceDeclaration :: GHC.SpliceDecl GHC.GhcPs -> SpliceDeclaration
mkSpliceDeclaration :: SpliceDecl GhcPs -> SpliceDeclaration
mkSpliceDeclaration = SpliceDecl GhcPs -> SpliceDeclaration
SpliceDeclaration