1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-25 13:51:45 +03:00

Don't generate small Uids

This commit is contained in:
Artyom 2016-03-18 23:45:18 +03:00
parent 95d710eaee
commit c268d91927

View File

@ -3,6 +3,7 @@ OverloadedStrings,
TemplateHaskell, TemplateHaskell,
GeneralizedNewtypeDeriving, GeneralizedNewtypeDeriving,
DeriveDataTypeable, DeriveDataTypeable,
NumDecimals,
NoImplicitPrelude NoImplicitPrelude
#-} #-}
@ -104,7 +105,7 @@ instance IsString Uid where
fromString = Uid . T.pack fromString = Uid . T.pack
randomUid :: MonadIO m => m Uid randomUid :: MonadIO m => m Uid
randomUid = liftIO $ Uid . tshow <$> randomRIO (0::Int, 10^(9::Int)) randomUid = liftIO $ Uid . tshow <$> randomRIO (10e8 :: Int, 10e9-1)
uid_ :: Uid -> Attribute uid_ :: Uid -> Attribute
uid_ = id_ . uidToText uid_ = id_ . uidToText