Improve formatting of various elements
Couldn't think of a better commit message
This commit is contained in:
parent
8f9b082eb4
commit
5fdbf2fbd2
4 changed files with 76 additions and 15 deletions
|
|
@ -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 ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue