-- Copyright (c) 2020-2023, Shayne Fletcher. All rights reserved.
-- SPDX-License-Identifier: BSD-3-Clause.

{-# LANGUAGE CPP #-}
#include "ghclib_api.h"
module Language.Haskell.GhclibParserEx.GHC.Hs.Decls(
    isNewType, isForD, isDerivD, isClsDefSig
  ) where

#if defined (GHC_9_10) || defined (GHC_9_8) || defined (GHC_9_6) || defined (GHC_9_4) || defined(GHC_9_2) || defined (GHC_9_0) || defined (GHC_8_10)
import GHC.Hs
#else
import HsSyn
#endif
#if defined (GHC_9_10) || defined (GHC_9_8) || defined (GHC_9_6) || defined (GHC_9_4) || defined(GHC_9_2) || defined (GHC_9_0)
import GHC.Types.SrcLoc
#else
import SrcLoc
#endif

isNewType :: NewOrData -> Bool
isNewType NewType = True
isNewType DataType = False

isForD, isDerivD :: LHsDecl GhcPs -> Bool
isForD (L _ ForD{}) = True; isForD _ = False
isDerivD (L _ DerivD{}) = True; isDerivD _ = False

isClsDefSig :: Sig GhcPs -> Bool
isClsDefSig (ClassOpSig _ True _ _) = True; isClsDefSig _ = False
