{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module GHC.BasicTypes.Extra where
#if MIN_VERSION_ghc(9,0,0)
import GHC.Types.Basic
#else
import BasicTypes
#endif
import Control.DeepSeq
import Data.Binary
import GHC.Generics
#if MIN_VERSION_ghc(9,4,0)
import GHC.Types.SourceText
#endif
#if MIN_VERSION_ghc(9,8,0)
import Data.ByteString
import GHC.Data.FastString
import Unsafe.Coerce
#endif
deriving instance Generic InlineSpec
instance NFData InlineSpec
instance Binary InlineSpec
#if MIN_VERSION_ghc(9,8,0)
deriving instance Generic FastString
instance Binary FastString
instance Binary FastZString where
put :: FastZString -> Put
put = ByteString -> Put
forall t. Binary t => t -> Put
put (ByteString -> Put)
-> (FastZString -> ByteString) -> FastZString -> Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FastZString -> ByteString
fastZStringToByteString
get :: Get FastZString
get = Get ByteString -> Get FastZString
forall a b. a -> b
unsafeCoerce (Get ByteString
forall t. Binary t => Get t
get :: Get ByteString)
#endif
#if MIN_VERSION_ghc(9,4,0)
deriving instance Generic SourceText
#if !MIN_VERSION_ghc(9,8,0)
instance NFData SourceText
#endif
instance Binary SourceText
#endif
isNoInline :: InlineSpec -> Bool
isNoInline :: InlineSpec -> Bool
isNoInline NoInline{} = Bool
True
#if MIN_VERSION_ghc(9,4,0)
isNoInline Opaque{} = Bool
True
#endif
isNoInline InlineSpec
_ = Bool
False
isOpaque :: InlineSpec -> Bool
#if MIN_VERSION_ghc(9,4,0)
isOpaque :: InlineSpec -> Bool
isOpaque Opaque{} = Bool
True
#else
isOpaque NoInline{} = True
#endif
isOpaque InlineSpec
_ = Bool
False