-
-
Save dminuoso/a49bd924e96c26fbd1d2869336bc6fc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pprMac :: Mac -> T.Text | |
pprMac mac = let (w1, w2, w3, w4, w5, w6) = macToWord8s mac | |
in T.pack . fromDList $ | |
showHex w1 | |
<> dlistSingleton ':' | |
<> showHex w2 | |
<> dlistSingleton ':' | |
<> showHex w3 | |
<> dlistSingleton ':' | |
<> showHex w4 | |
<> dlistSingleton ':' | |
<> showHex w5 | |
<> dlistSingleton ':' | |
<> showHex 6 | |
where | |
{-# INLINE showHex #-} | |
showHex :: Word8 -> DList Char | |
showHex w = dlistSingleton (intToDigit (fromIntegral (w `unsafeShiftR` 4))) | |
<> dlistSingleton (intToDigit (fromIntegral (w .&. 0xf))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment