Improve formatting of various elements

Couldn't think of a better commit message
This commit is contained in:
Joscha 2019-11-06 15:59:08 +00:00
parent 8f9b082eb4
commit 5fdbf2fbd2
4 changed files with 76 additions and 15 deletions

View file

@ -1,5 +1,6 @@
module Mima.Util
( ToText(..)
, toDec
, toHex
) where
@ -19,5 +20,8 @@ import qualified Numeric as N
class ToText a where
toText :: a -> T.Text
toDec :: (Integral a, Show a) => Int -> a -> T.Text
toDec digits a = T.justifyRight digits ' ' $ T.pack $ show a
toHex :: (Integral a, Show a) => Int -> a -> T.Text
toHex digits a = T.justifyRight digits '0' $ T.pack $ N.showHex a ""