ez-couch 0.6.0 → 0.6.1
raw patch · 4 files changed
+13/−13 lines, 4 filesdep ~http-conduitPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: http-conduit
API changes (from Hackage documentation)
Files
- ez-couch.cabal +2/−2
- src/EZCouch/Base62.hs +8/−8
- src/EZCouch/Ids.hs +2/−2
- src/EZCouch/View.hs +1/−1
ez-couch.cabal view
@@ -1,5 +1,5 @@ name: ez-couch-version: 0.6.0+version: 0.6.1 cabal-version: >=1.8 build-type: Simple license: MIT@@ -52,7 +52,7 @@ aeson >= 0.6, attoparsec >= 0.10, attoparsec-conduit >= 0.5,- http-conduit >= 1.8,+ http-conduit == 1.8.*, http-types >= 0.7, hslogger >= 1.2, old-locale >= 1.0,
src/EZCouch/Base62.hs view
@@ -13,16 +13,16 @@ charsVector = asVector . fromList $ chars charsLength = fromIntegral $ length charsVector --- | Produces individual values for the whole range of ints including negatives. If you know that the value will allways be positive use `encodeUnsigned` instead.-encodeSigned64 = encodeUnsigned . zzEncode64 +-- | Produces individual values for the whole range of ints including negatives. If you know that the value will allways be positive use `fromUnsigned64` instead.+fromSigned64 = fromUnsigned64 . zzEncode64 -encodeUnsigned 0 = charsVector ! 0 : []-encodeUnsigned a = if a >= 0- then reverse . encodeUnsigned' $ a- else error $ "EZCouch.Base62.encodeUnsigned: Negative value: " ++ show a+fromUnsigned64 0 = charsVector ! 0 : []+fromUnsigned64 a = if a >= 0+ then reverse . fromUnsigned64' $ a+ else error $ "EZCouch.Base62.fromUnsigned64: Negative value: " ++ show a where- encodeUnsigned' 0 = []- encodeUnsigned' a = charsVector ! fromIntegral c : encodeUnsigned' b+ fromUnsigned64' 0 = []+ fromUnsigned64' a = charsVector ! fromIntegral c : fromUnsigned64' b where b = div a charsLength c = mod a charsLength
src/EZCouch/Ids.hs view
@@ -8,11 +8,11 @@ getPicos = getPOSIXTime >>= return . round . (* 1000000) getRndSuffix l = (randomRIO (0, charsLength ^ l) :: IO Word64) >>= - return . zeroPad l . encodeUnsigned+ return . zeroPad l . fromUnsigned64 where zeroPad l s = (replicate (l - length s) '0') ++ s -generateId = (++) <$> fmap encodeUnsigned getPicos <*> getRndSuffix 3 +generateId = (++) <$> fmap fromUnsigned64 getPicos <*> getRndSuffix 3 main = do generateId >>= putStrLn . pack
src/EZCouch/View.hs view
@@ -111,7 +111,7 @@ viewGeneratedName :: View a k -> Maybe Text viewGeneratedName view = case view of ViewById -> Nothing- view -> Just $ pack . Base62.encodeSigned64 . fromIntegral . hash $ view+ view -> Just $ pack . Base62.fromSigned64 . fromIntegral . hash $ view viewDocType :: (Entity a) => View a k -> Text viewDocType = entityType . (undefined :: View a k -> a)