uuid-types 1.0.5.1 → 1.0.6
raw patch · 5 files changed
+19/−99 lines, 5 filesdep ~QuickCheckdep ~basedep ~binary
Dependency ranges changed: QuickCheck, base, binary, bytestring, deepseq, hashable, random, tasty-quickcheck, template-haskell
Files
- ChangeLog.md +4/−0
- src/Data/UUID/Types.hs +0/−4
- src/Data/UUID/Types/Internal.hs +1/−72
- src/Data/UUID/Types/Internal/Builder.hs +0/−3
- uuid-types.cabal +14/−20
ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.0.6 (2023-04-16)++- Support GHC-8.6.5..GHC-9.10.1+ ## 1.0.5 (2021-05-03) - Add (Template Haskell) `Lift UUID` instance
src/Data/UUID/Types.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP #-}--#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif {- | Module : Data.UUID.Types
src/Data/UUID/Types/Internal.hs view
@@ -2,14 +2,9 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ViewPatterns #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Unsafe #-}-#endif-#if __GLASGOW_HASKELL__ >=800 {-# LANGUAGE DeriveLift #-} {-# LANGUAGE StandaloneDeriving #-}-#endif- {-# OPTIONS_HADDOCK hide #-} -- |@@ -76,19 +71,10 @@ import Data.UUID.Types.Internal.Builder -#if MIN_VERSION_random(1,2,0) import System.Random (Random (..), uniform) import System.Random.Stateful (Uniform (..), uniformWord64)-#else-import System.Random (Random (..), next)-#endif -#if __GLASGOW_HASKELL__ >=800 import Language.Haskell.TH.Syntax (Lift)-#else-import Language.Haskell.TH (appE, varE)-import Language.Haskell.TH.Syntax (Lift (..), mkNameG_v, Lit (IntegerL), Exp (LitE))-#endif -- | Type representing <https://en.wikipedia.org/wiki/UUID Universally Unique Identifiers (UUID)> as specified in -- <http://tools.ietf.org/html/rfc4122 RFC 4122>.@@ -471,23 +457,13 @@ -- | Similar to `toASCIIBytes` except we produce a lazy `BL.ByteString`. toLazyASCIIBytes :: UUID -> BL.ByteString toLazyASCIIBytes =-#if MIN_VERSION_bytestring(0,10,0) BL.fromStrict-#else- BL.fromChunks . return-#endif . toASCIIBytes -- | Similar to `fromASCIIBytes` except parses from a lazy `BL.ByteString`. fromLazyASCIIBytes :: BL.ByteString -> Maybe UUID fromLazyASCIIBytes bs =- if BL.length bs == 36 then fromASCIIBytes (-#if MIN_VERSION_bytestring(0,10,0)- BL.toStrict bs-#else- B.concat $ BL.toChunks bs-#endif- ) else Nothing+ if BL.length bs == 36 then fromASCIIBytes (BL.toStrict bs) else Nothing -- -- Class Instances@@ -495,7 +471,6 @@ -- | This 'Random' instance produces __insecure__ version 4 UUIDs as -- specified in <http://tools.ietf.org/html/rfc4122 RFC 4122>.-#if MIN_VERSION_random(1,2,0) instance Random UUID where random = uniform randomR _ = random -- range is ignored@@ -506,30 +481,7 @@ w0 <- uniformWord64 gen w1 <- uniformWord64 gen pure $ buildFromBytes 4 /-/ w0 /-/ w1-#else-instance Random UUID where- random g = (fromGenNext w0 w1 w2 w3 w4, g4)- where (w0, g0) = next g- (w1, g1) = next g0- (w2, g2) = next g1- (w3, g3) = next g2- (w4, g4) = next g3- randomR _ = random -- range is ignored --- |Build a UUID from the results of five calls to next on a StdGen.--- While next on StdGet returns an Int, it doesn't provide 32 bits of--- randomness. This code relies on at last 28 bits of randomness in the--- and optimizes its use so as to make only five random values, not six.-fromGenNext :: Int -> Int -> Int -> Int -> Int -> UUID-fromGenNext w0 w1 w2 w3 w4 =- buildFromBytes 4 /-/ (ThreeByte w0)- /-/ (ThreeByte w1)- /-/ w2 -- use all 4 bytes because we know the version- -- field will "cover" the upper, non-random bits- /-/ (ThreeByte w3)- /-/ (ThreeByte w4)-#endif- -- |A ByteSource to extract only three bytes from an Int, since next on StdGet -- only returns 31 bits of randomness. type instance ByteSink ThreeByte g = Takes3Bytes g@@ -622,27 +574,4 @@ uuidType :: DataType uuidType = mkNoRepType "Data.UUID.Types.UUID" -#if !MIN_VERSION_base(4,5,0)-unsafeShiftR, unsafeShiftL :: Bits w => w -> Int -> w-{-# INLINE unsafeShiftR #-}-unsafeShiftR = shiftR-{-# INLINE unsafeShiftL #-}-unsafeShiftL = shiftL-#endif--#if __GLASGOW_HASKELL__ >=800 deriving instance Lift UUID-#else-instance Lift UUID where- lift (UUID w1 w2) = varE fromWords64Name `appE` liftW64 w1 `appE` liftW64 w2- where- fromWords64Name = mkNameG_v currentPackageKey "Data.UUID.Types.Internal" "fromWords64"- liftW64 x = return (LitE (IntegerL (fromIntegral x)))--currentPackageKey :: String-#ifdef CURRENT_PACKAGE_KEY-currentPackageKey = CURRENT_PACKAGE_KEY-#else-currentPackageKey = "uuid-types-1.0.5"-#endif-#endif
src/Data/UUID/Types/Internal/Builder.hs view
@@ -1,8 +1,5 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Unsafe #-}-#endif {-# OPTIONS_HADDOCK hide #-}
uuid-types.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: uuid-types-version: 1.0.5.1+version: 1.0.6 copyright: (c) 2017-2018 Herbert Valerio Riedel (c) 2008-2014 Antoine Latter@@ -12,21 +12,15 @@ category: Data build-type: Simple tested-with:- GHC ==7.4.2- || ==7.6.3- || ==7.8.4- || ==7.10.3- || ==8.0.2- || ==8.2.2- || ==8.4.4- || ==8.6.4+ GHC ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8- || ==9.4.7- || ==9.6.3- || ==9.8.1+ || ==9.4.8+ || ==9.6.5+ || ==9.8.2+ || ==9.10.1 synopsis: Type definitions for Universally Unique Identifiers description:@@ -50,14 +44,14 @@ library build-depends:- base >=4.5 && <5- , binary >=0.5.1.0 && <0.9- , bytestring >=0.9.2.1 && <0.13- , deepseq >=1.3.0.0 && <1.6- , hashable >=1.2.7.0 && <1.5- , random >=1.1 && <1.3- , template-haskell >=2.7.0.0 && <2.22- , text >=1.2.3.0 && <1.3 || >=2.0 && <2.2+ base >=4.12.0.0 && <5+ , binary >=0.8.6.0 && <0.9+ , bytestring >=0.10.8.2 && <0.13+ , deepseq >=1.4.4.0 && <1.6+ , hashable >=1.4.4.0 && <1.5+ , random >=1.2.1.2 && <1.3+ , template-haskell >=2.14.0.0 && <2.23+ , text >=1.2.3.0 && <1.3 || >=2.0 && <2.2 exposed-modules: Data.UUID.Types