on master help sign in
Add docs for toText/fromText.
0505bbbAntoine Latter
uuid-types/Data/UUID/Types/Internal.hs+3
@@ -311,9 +311,12 @@ toString (UUID w0 w1 w2 w3) = hexw w0 $ hexw' w1 $ hexw' w2 $ hexw w3 ""
311 hexn :: Word32 -> Int -> Char
311 hexn :: Word32 -> Int -> Char
312 hexn w r = intToDigit $ fromIntegral ((w `shiftR` r) .&. 0xf)
312 hexn w r = intToDigit $ fromIntegral ((w `shiftR` r) .&. 0xf)
313
313
314+-- | If the passed in `Text` can be parsed as an ASCII representation of
315+-- a `UUID`, it will be. The hyphens may not be omitted.
314fromText :: Text -> Maybe UUID
316fromText :: Text -> Maybe UUID
315fromText = fromString . T.unpack
317fromText = fromString . T.unpack
316
318
319+-- | Convert a UUID into a hyphentated string using lower-case letters.
317toText :: UUID -> Text
320toText :: UUID -> Text
318toText = T.pack . toString
321toText = T.pack . toString
319
322