module Text.Show.Text.Trace.Hpc (
showbMixPrec
, showbBoxLabelPrec
, showbCondBox
, showbTixPrec
, showbTixModulePrec
, showbHpcPos
, showbHash
) where
import Data.Monoid.Compat
import Prelude hiding (Show)
import Text.Show.Text (Show(showb, showbPrec), Builder, FromStringShow(..))
import Text.Show.Text.Data.Integral (showbIntPrec)
import Text.Show.Text.Data.Time ()
import Text.Show.Text.TH (deriveShow, deriveShowPragmas,
defaultInlineShowb, defaultInlineShowbPrec)
import Text.Show.Text.Utils (s)
import Trace.Hpc.Mix (Mix, BoxLabel, CondBox)
import Trace.Hpc.Tix (Tix, TixModule)
import Trace.Hpc.Util (HpcPos, Hash, fromHpcPos)
#include "inline.h"
showbMixPrec :: Int -> Mix -> Builder
showbMixPrec = showbPrec
showbBoxLabelPrec :: Int -> BoxLabel -> Builder
showbBoxLabelPrec = showbPrec
showbCondBox :: CondBox -> Builder
showbCondBox = showb
showbTixPrec :: Int -> Tix -> Builder
showbTixPrec = showbPrec
showbTixModulePrec :: Int -> TixModule -> Builder
showbTixModulePrec = showbPrec
showbHpcPos :: HpcPos -> Builder
showbHpcPos hp = case fromHpcPos hp of
(l1, c1, l2, c2) -> showbIntPrec 0 l1
<> (s ':' <> showbIntPrec 0 c1)
<> (s '-' <> showbIntPrec 0 l2)
<> (s ':' <> showbIntPrec 0 c2)
showbHash :: Hash -> Builder
showbHash = showb . FromStringShow
$(deriveShow ''Mix)
$(deriveShow ''BoxLabel)
$(deriveShowPragmas defaultInlineShowb ''CondBox)
$(deriveShowPragmas defaultInlineShowbPrec ''Tix)
$(deriveShow ''TixModule)
instance Show HpcPos where
showb = showbHpcPos
INLINE_INST_FUN(showb)
instance Show Hash where
showb = showbHash
INLINE_INST_FUN(showb)