-- Copyright (c) 2021-2023, Shayne Fletcher. All rights reserved.
-- SPDX-License-Identifier: BSD-3-Clause.
{-# LANGUAGE LambdaCase #-}
#include "ghclib_api.h"
module Language.Haskell.GhclibParserEx.GHC.Hs.Type
  ( fromTyParen,
    isTyQuasiQuote,
    isUnboxedTuple,
    isKindTyApp,
  )
where

#if defined (GHC_8_8)
import HsSyn
#else
import GHC.Hs
#endif
#if defined (GHC_8_8) || defined (GHC_8_10)
import SrcLoc
#else
import GHC.Types.SrcLoc
#endif

isKindTyApp :: LHsType GhcPs -> Bool
isKindTyApp :: LHsType GhcPs -> Bool
isKindTyApp = \case (L SrcSpanAnnA
_ HsAppKindTy {}) -> Bool
True; LHsType GhcPs
_ -> Bool
False

fromTyParen :: LHsType GhcPs -> LHsType GhcPs
fromTyParen :: LHsType GhcPs -> LHsType GhcPs
fromTyParen (L SrcSpanAnnA
_ (HsParTy XParTy GhcPs
_ LHsType GhcPs
x)) = LHsType GhcPs
x
fromTyParen LHsType GhcPs
x = LHsType GhcPs
x

isTyQuasiQuote :: LHsType GhcPs -> Bool
isTyQuasiQuote :: LHsType GhcPs -> Bool
isTyQuasiQuote (L SrcSpanAnnA
_ (HsSpliceTy XSpliceTy GhcPs
_ HsQuasiQuote {})) = Bool
True
isTyQuasiQuote LHsType GhcPs
_ = Bool
False

isUnboxedTuple :: HsTupleSort -> Bool
isUnboxedTuple :: HsTupleSort -> Bool
isUnboxedTuple HsTupleSort
HsUnboxedTuple = Bool
True
isUnboxedTuple HsTupleSort
_ = Bool
False