Format flag file
This commit is contained in:
parent
f3c7cdf8b3
commit
5b172ad57f
2 changed files with 48 additions and 0 deletions
19
src/Mima/Format/Common.hs
Normal file
19
src/Mima/Format/Common.hs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
module Mima.Format.Common
|
||||
( toHex
|
||||
, fixedWidthHex
|
||||
, fixedWidthHexAddress
|
||||
) where
|
||||
|
||||
import qualified Data.Text as T
|
||||
import Numeric
|
||||
|
||||
import Mima.Word
|
||||
|
||||
toHex :: (Integral a, Show a) => a -> T.Text
|
||||
toHex a = T.pack $ showHex a ""
|
||||
|
||||
fixedWidthHex :: (Integral a, Show a) => Int -> a -> T.Text
|
||||
fixedWidthHex n = T.justifyRight n '0' . toHex
|
||||
|
||||
fixedWidthHexAddress :: MimaAddress -> T.Text
|
||||
fixedWidthHexAddress = fixedWidthHex 5
|
||||
Loading…
Add table
Add a link
Reference in a new issue