#if MIN_VERSION_base(4,8,0)
#endif
module TextShow.Numeric.Natural (showbNaturalPrec) where
import Data.Text.Lazy.Builder (Builder)
#if MIN_VERSION_base(4,8,0)
import GHC.Integer.GMP.Internals (Integer(..))
import GHC.Natural (Natural(..))
import GHC.Types (Word(..))
import TextShow.Data.Integral (showbWord)
#else
import Numeric.Natural (Natural)
#endif
import TextShow.Classes (TextShow(..))
import TextShow.Data.Integral (showbIntegerPrec)
#include "inline.h"
showbNaturalPrec :: Int -> Natural -> Builder
#if MIN_VERSION_base(4,8,0)
showbNaturalPrec _ (NatS# w#) = showbWord $ W# w#
showbNaturalPrec p (NatJ# bn) = showbIntegerPrec p $ Jp# bn
#else
showbNaturalPrec p = showbIntegerPrec p . toInteger
#endif
instance TextShow Natural where
showbPrec = showbNaturalPrec
INLINE_INST_FUN(showbPrec)