module TextShow.Trace.Hpc (
showbMixPrec
, showbBoxLabelPrec
, showbCondBox
, showbTixPrec
, showbTixModulePrec
, showbHpcPos
, showbHash
) where
import Data.Monoid.Compat
import TextShow (TextShow(..), Builder, FromStringShow(..), singleton)
import TextShow.Data.Integral (showbIntPrec)
import TextShow.Data.Time ()
import TextShow.TH (deriveTextShow)
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
<> (singleton ':' <> showbIntPrec 0 c1)
<> (singleton '-' <> showbIntPrec 0 l2)
<> (singleton ':' <> showbIntPrec 0 c2)
showbHash :: Hash -> Builder
showbHash = showb . FromStringShow
$(deriveTextShow ''Mix)
$(deriveTextShow ''BoxLabel)
$(deriveTextShow ''CondBox)
$(deriveTextShow ''Tix)
$(deriveTextShow ''TixModule)
instance TextShow HpcPos where
showb = showbHpcPos
INLINE_INST_FUN(showb)
instance TextShow Hash where
showb = showbHash
INLINE_INST_FUN(showb)