Skip to content

Instantly share code, notes, and snippets.

@dminuoso

dminuoso/f.hs Secret

Created October 4, 2022 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dminuoso/540361a14d721b430c4bd1f7b84b866a to your computer and use it in GitHub Desktop.
Save dminuoso/540361a14d721b430c4bd1f7b84b866a to your computer and use it in GitHub Desktop.
pprMac :: Mac -> T.Text
pprMac mac = let (w1, w2, w3, w4, w5, w6) = macToWord8s mac
in T.pack [ intToDigit (fromIntegral (w1 `unsafeShiftR` 4))
, intToDigit (fromIntegral (w1 .&. 0xf))
, ':'
, intToDigit (fromIntegral (w2 `unsafeShiftR` 4))
, intToDigit (fromIntegral (w2 .&. 0xf))
, ':'
, intToDigit (fromIntegral (w3 `unsafeShiftR` 4))
, intToDigit (fromIntegral (w3 .&. 0xf))
, ':'
, intToDigit (fromIntegral (w4 `unsafeShiftR` 4))
, intToDigit (fromIntegral (w4 .&. 0xf))
, ':'
, intToDigit (fromIntegral (w5 `unsafeShiftR` 4))
, intToDigit (fromIntegral (w5 .&. 0xf))
, ':'
, intToDigit (fromIntegral (w6 `unsafeShiftR` 4))
, intToDigit (fromIntegral (w6 .&. 0xf))
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment