on 99cb480 help sign in
2 files changed+60−72
since splitsnapshots
unifiedsplit
id.cabal+56−61 src/Data/Id.hs+4−11
id.cabal+56−61
@@ -1,77 +1,72 @@
1−cabal-version: 2.4
2−name: id
3−version: 0.2.0.0
4−license-file: LICENSE
1+cabal-version: 2.4
52
6−flag cassava
7− description: Enable Postgresql support
8− default: True
9− manual: False
3+name: id
4+version: 0.2.0.0
5+license-file: LICENSE
106
11−flag postgres
12− description: Enable Postgresql support
13− default: True
14− manual: False
7+Flag cassava
8+ Description: Enable Postgresql support
9+ Default: True
10+ Manual: False
1511
16−flag flat
17− description: Enable Flat serialization support
18− default: True
19− manual: False
2012
21−flag store
22− description: Enable Data.Store serialization support
23− default: False
24− manual: False
13+Flag postgres
14+ Description: Enable Postgresql support
15+ Default: True
16+ Manual: False
2517
26−flag uuid-impl
27− description: Include some functions with extra dependencies.
28− Disable to reduce dependencies.
29− default: True
30− manual: False
18+Flag flat
19+ Description: Enable Flat serialization support
20+ Default: True
21+ Manual: False
22+
23+Flag store
24+ Description: Enable Data.Store serialization support
25+ Default: False
26+ Manual: False
3127
3228library
33− exposed-modules: Data.Id
29+ exposed-modules:
30+ Data.Id
31+ -- other-modules:
32+ -- other-extensions:
3433 build-depends:
35− , aeson >=1.0
36− , base >=4.12 && <5
37− , binary
38− , deepseq
39− , hashable
40− , http-api-data
41− , lens
42− , path-pieces
43− , text
44− , uuid-types
45− if flag(uuid-impl)
46− build-depends:
47− , uuid >=1.3.9
48− cpp-options: -DUSE_UUID
49−
50− if !(impl(ghcjs) || arch(javascript) || arch(wasm32))
34+ aeson,
35+ base >=4.12 && <5,
36+ binary,
37+ deepseq,
38+ hashable,
39+ http-api-data,
40+ lens,
41+ path-pieces,
42+ text,
43+ uuid,
44+ if !(impl(ghcjs) || arch(javascript))
5145 build-depends:
52− , openapi3
46+ openapi3
5347 , QuickCheck
54−
55− cpp-options: -DBACKEND
56−
57− if (flag(postgres) && !(impl(ghcjs) || arch(javascript) || arch(wasm32)))
58− build-depends: postgresql-simple
59− cpp-options: -DUSE_POSTGRES
60−
61− if (flag(cassava) && !(impl(ghcjs) || arch(javascript) || arch(wasm32)))
62− build-depends: cassava
63− cpp-options: -DUSE_CASSAVA
64−
48+ cpp-options: -DBACKEND
49+ if flag(postgres) && !(impl(ghcjs) || arch(javascript))
50+ build-depends:
51+ postgresql-simple
52+ cpp-options: -DUSE_POSTGRES
53+ if flag(cassava) && !(impl(ghcjs) || arch(javascript))
54+ build-depends:
55+ cassava
56+ cpp-options: -DUSE_CASSAVA
6557 if flag(flat)
66− build-depends: flat >=0.4
67− cpp-options: -DUSE_FLAT
68−
58+ build-depends:
59+ flat,
60+ cpp-options: -DUSE_FLAT
6961 if flag(store)
70− build-depends: store
71− cpp-options: -DUSE_STORE
62+ build-depends:
63+ store,
64+ cpp-options: -DUSE_STORE
7265
73− hs-source-dirs: src
74− default-language: Haskell2010
66+ hs-source-dirs:
67+ src
68+ default-language:
69+ Haskell2010
7570 default-extensions:
7671 AllowAmbiguousTypes
7772 DeriveGeneric
src/Data/Id.hs+4−11
@@ -4,12 +4,9 @@
44{-# OPTIONS_GHC -Wno-orphans #-}
55
66module Data.Id
7− ( Id, mkId, unId, unsafeIdTagConvert, coerceId, _Id, nilId
7+ ( Id, mkId, unId, randomId, unsafeIdTagConvert, coerceId, _Id, nilId
88 , IntId, mkIntId, unIntId, unsafeIntIdTagConvert, coerceIntId, _IntId
99 , Name, mkName, unName, unsafeNameTagConvert, coerceName, _Name
10−#ifdef USE_UUID
11− , randomId
12−#endif
1310 )
1411 where
1512
@@ -23,17 +20,15 @@ import Data.Data
2320import Data.Hashable (Hashable)
2421import Data.String
2522import Data.Text as T
26−import Data.UUID.Types (UUID)
27−import qualified Data.UUID.Types as UUID
23+import Data.UUID (UUID)
24+import qualified Data.UUID as UUID
25+import qualified Data.UUID.V4 as UUID.V4
2826import GHC.TypeLits
2927import Prelude as P
3028import Text.ParserCombinators.ReadP
3129import Web.HttpApiData
3230import Web.PathPieces (PathPiece(..))
3331
34−#ifdef USE_UUID
35−import qualified Data.UUID.V4 as UUID.V4
36−#endif
3732#ifdef BACKEND
3833import Data.OpenApi
3934import Test.QuickCheck
@@ -76,11 +71,9 @@ mkId :: forall s. UUID -> Id s
7671mkId = coerce
7772{-# INLINE mkId #-}
7873
79−#ifdef USE_UUID
8074randomId :: forall s. IO (Id s)
8175randomId = coerce <$> UUID.V4.nextRandom
8276{-# INLINE randomId #-}
83−#endif
8477
8578instance KnownSymbol s => Show (Id s) where
8679 show (Id v) = "Id-" <> symbolVal (Proxy @s) <> "-" <> P.show v