{-# LANGUAGE OverloadedStrings #-}

module Prettyprinter.Ext ( (<#>)
                         , prettyHex
                         ) where

import           Numeric       (showHex)
import           Prettyprinter

infixr 6 <#>

(<#>) :: Doc a -> Doc a -> Doc a
<#> :: Doc a -> Doc a -> Doc a
(<#>) Doc a
x Doc a
y = Doc a
x Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a
forall ann. Doc ann
hardline Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a
y

prettyHex :: (Integral a, Show a) => a -> Doc ann
prettyHex :: a -> Doc ann
prettyHex a
x = Doc ann
"0x" Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty (a -> ShowS
forall a. (Integral a, Show a) => a -> ShowS
showHex a
x String
forall a. Monoid a => a
mempty)