on master help sign in
Add docs for toText/fromText.
commit0505bbb39906edc5fd2f5abe0d3eff61c746aac3 authorAntoine Latter <aslatter@gmail.com> dateSat 1 Aug 2015, 23:01 (11 years ago) parent24c9b51
1 file changed+3
uuid-types/Data/UUID/Types/Internal.hs+3
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 ""
311311 hexn :: Word32 -> Int -> Char
312312 hexn w r = intToDigit $ fromIntegral ((w `shiftR` r) .&. 0xf)
313313
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.
314316fromText :: Text -> Maybe UUID
315317fromText = fromString . T.unpack
316318
319+-- | Convert a UUID into a hyphentated string using lower-case letters.
317320toText :: UUID -> Text
318321toText = T.pack . toString
319322