on master help sign in
Merge pull request #10 from 4e6/ghc-84
87a2553Denis Redozubov
ChangeLog.md+4
@@ -1,5 +1,9 @@
1# Revision history for schematic
1# Revision history for schematic
2
2
3+## HEAD
4+
5+Support ghc-8.4 and drop support for older versions
6+
3## 0.4.1.0 -- 2017-11-05
7## 0.4.1.0 -- 2017-11-05
4
8
5Convenience isomorphisms: txt, num, opt, bln etc
9Convenience isomorphisms: txt, num, opt, bln etc
schematic.cabal+6−6
@@ -57,7 +57,7 @@ library
57 , TypeOperators
57 , TypeOperators
58 , TypeSynonymInstances
58 , TypeSynonymInstances
59 , UndecidableInstances
59 , UndecidableInstances
60− build-depends: base >=4.9 && <4.11
60+ build-depends: base >=4.11 && <4.12
61 , bytestring
61 , bytestring
62 , aeson >= 1
62 , aeson >= 1
63 , containers
63 , containers
@@ -67,14 +67,14 @@ library
67 , regex-tdfa
67 , regex-tdfa
68 , regex-tdfa-text
68 , regex-tdfa-text
69 , scientific
69 , scientific
70− , singletons >= 2.2
70+ , singletons >= 2.4
71 , smallcheck
71 , smallcheck
72 , tagged
72 , tagged
73 , template-haskell
73 , template-haskell
74 , text
74 , text
75 , union
75 , union
76 , unordered-containers
76 , unordered-containers
77− , validationt >= 0.1.0.1
77+ , validationt >= 0.2.1.0
78 , vector
78 , vector
79 , vinyl
79 , vinyl
80 hs-source-dirs: src
80 hs-source-dirs: src
@@ -87,7 +87,7 @@ test-suite spec
87 default-language: Haskell2010
87 default-language: Haskell2010
88 build-depends: HUnit
88 build-depends: HUnit
89 , aeson >= 1
89 , aeson >= 1
90− , base >=4.9 && <4.11
90+ , base >=4.11 && <4.12
91 , bytestring
91 , bytestring
92 , containers
92 , containers
93 , hjsonschema
93 , hjsonschema
@@ -104,9 +104,9 @@ test-suite spec
104 , tagged
104 , tagged
105 , text
105 , text
106 , unordered-containers
106 , unordered-containers
107− , validationt >= 0.1.0.1
107+ , validationt >= 0.2.1.0
108 , vinyl
108 , vinyl
109 other-modules: SchemaSpec
109 other-modules: SchemaSpec
110 , HelpersSpec
110 , HelpersSpec
111 , LensSpec
111 , LensSpec
112− , JsonSchemaSpec
112+ , JsonSchemaSpec
src/Data/Schematic/Migration.hs+3−3
@@ -42,8 +42,8 @@ type family SchemaByKey (fs :: [(Symbol, Schema)]) (s :: Symbol) :: Schema where
42 SchemaByKey ( '(a, s) ': tl) fn = SchemaByKey tl fn
42 SchemaByKey ( '(a, s) ': tl) fn = SchemaByKey tl fn
43
43
44type family DeleteKey (acc :: [(Symbol, Schema)]) (fn :: Symbol) (fs :: [(Symbol, Schema)]) :: [(Symbol, Schema)] where
44type family DeleteKey (acc :: [(Symbol, Schema)]) (fn :: Symbol) (fs :: [(Symbol, Schema)]) :: [(Symbol, Schema)] where
45− DeleteKey acc fn ('(fn, a) ': tl) = acc :++ tl
45+ DeleteKey acc fn ('(fn, a) ': tl) = acc ++ tl
46− DeleteKey acc fn (fna ': tl) = acc :++ (fna ': tl)
46+ DeleteKey acc fn (fna ': tl) = acc ++ (fna ': tl)
47
47
48type family UpdateKey
48type family UpdateKey
49 (fn :: Symbol)
49 (fn :: Symbol)
@@ -146,7 +146,7 @@ data instance Sing (v :: Versioned) where
146
146
147type DataMigration s m h = Tagged s (JsonRepr h -> m (JsonRepr s))
147type DataMigration s m h = Tagged s (JsonRepr h -> m (JsonRepr s))
148
148
149−data MList :: (* -> *) -> [Schema] -> Type where
149+data MList :: (Type -> Type) -> [Schema] -> Type where
150 MNil :: (Monad m, SingI s, TopLevel s) => MList m '[s]
150 MNil :: (Monad m, SingI s, TopLevel s) => MList m '[s]
151 (:&&)
151 (:&&)
152 :: (TopLevel s, SingI s)
152 :: (TopLevel s, SingI s)
src/Data/Schematic/Path.hs+4−6
@@ -1,8 +1,6 @@
1module Data.Schematic.Path where
1module Data.Schematic.Path where
2
2
3import Data.Foldable as F
3import Data.Foldable as F
4−import Data.Monoid
5−import Data.Singletons
6import Data.Singletons.Prelude
4import Data.Singletons.Prelude
7import Data.Singletons.TypeLits
5import Data.Singletons.TypeLits
8import Data.Text as T
6import Data.Text as T
@@ -26,10 +24,10 @@ demotePath = go []
26 where
24 where
27 go :: [DemotedPathSegment] -> Sing (ps :: [PathSegment]) -> [DemotedPathSegment]
25 go :: [DemotedPathSegment] -> Sing (ps :: [PathSegment]) -> [DemotedPathSegment]
28 go acc SNil = acc
26 go acc SNil = acc
29− go acc (SCons p ps) = go (acc ++ [demote p]) ps
27+ go acc (SCons p ps) = go (acc ++ [demotePathSeg p]) ps
30− demote :: Sing (ps :: PathSegment) -> DemotedPathSegment
28+ demotePathSeg :: Sing (ps :: PathSegment) -> DemotedPathSegment
31− demote (SKey s) = DKey $ T.pack $ withKnownSymbol s $ symbolVal s
29+ demotePathSeg (SKey s) = DKey $ T.pack $ withKnownSymbol s $ symbolVal s
32− demote (SIx n) = DIx $ withKnownNat n $ natVal n
30+ demotePathSeg (SIx n) = DIx $ withKnownNat n $ fromIntegral $ natVal n
33
31
34demotedPathToText :: [DemotedPathSegment] -> JSONPath
32demotedPathToText :: [DemotedPathSegment] -> JSONPath
35demotedPathToText = JSONPath . F.foldl' renderPathSegment ""
33demotedPathToText = JSONPath . F.foldl' renderPathSegment ""
src/Data/Schematic/Schema.hs+11−11
@@ -48,11 +48,11 @@ data TextConstraint
48instance SingKind TextConstraint where
48instance SingKind TextConstraint where
49 type Demote TextConstraint = DemotedTextConstraint
49 type Demote TextConstraint = DemotedTextConstraint
50 fromSing = \case
50 fromSing = \case
51− STEq n -> withKnownNat n (DTEq $ natVal n)
51+ STEq n -> withKnownNat n (DTEq . fromIntegral $ natVal n)
52− STLt n -> withKnownNat n (DTLt $ natVal n)
52+ STLt n -> withKnownNat n (DTLt . fromIntegral $ natVal n)
53− STLe n -> withKnownNat n (DTLe $ natVal n)
53+ STLe n -> withKnownNat n (DTLe . fromIntegral $ natVal n)
54− STGt n -> withKnownNat n (DTGt $ natVal n)
54+ STGt n -> withKnownNat n (DTGt . fromIntegral $ natVal n)
55− STGe n -> withKnownNat n (DTGe $ natVal n)
55+ STGe n -> withKnownNat n (DTGe . fromIntegral $ natVal n)
56 STRegex s -> withKnownSymbol s (DTRegex $ T.pack $ symbolVal s)
56 STRegex s -> withKnownSymbol s (DTRegex $ T.pack $ symbolVal s)
57 STEnum s -> let
57 STEnum s -> let
58 d :: Sing (s :: [Symbol]) -> [Text]
58 d :: Sing (s :: [Symbol]) -> [Text]
@@ -153,11 +153,11 @@ instance Eq (Sing ('NGe n)) where _ == _ = True
153instance SingKind NumberConstraint where
153instance SingKind NumberConstraint where
154 type Demote NumberConstraint = DemotedNumberConstraint
154 type Demote NumberConstraint = DemotedNumberConstraint
155 fromSing = \case
155 fromSing = \case
156− SNEq n -> withKnownNat n (DNEq $ natVal n)
156+ SNEq n -> withKnownNat n (DNEq . fromIntegral $ natVal n)
157− SNGt n -> withKnownNat n (DNGt $ natVal n)
157+ SNGt n -> withKnownNat n (DNGt . fromIntegral $ natVal n)
158− SNGe n -> withKnownNat n (DNGe $ natVal n)
158+ SNGe n -> withKnownNat n (DNGe . fromIntegral $ natVal n)
159− SNLt n -> withKnownNat n (DNLt $ natVal n)
159+ SNLt n -> withKnownNat n (DNLt . fromIntegral $ natVal n)
160− SNLe n -> withKnownNat n (DNLe $ natVal n)
160+ SNLe n -> withKnownNat n (DNLe . fromIntegral $ natVal n)
161 toSing = \case
161 toSing = \case
162 DNEq n -> case someNatVal n of
162 DNEq n -> case someNatVal n of
163 Just (SomeNat (_ :: Proxy n)) -> SomeSing (SNEq (SNat :: Sing n))
163 Just (SomeNat (_ :: Proxy n)) -> SomeSing (SNEq (SNat :: Sing n))
@@ -193,7 +193,7 @@ instance Eq (Sing ('AEq n)) where _ == _ = True
193instance SingKind ArrayConstraint where
193instance SingKind ArrayConstraint where
194 type Demote ArrayConstraint = DemotedArrayConstraint
194 type Demote ArrayConstraint = DemotedArrayConstraint
195 fromSing = \case
195 fromSing = \case
196− SAEq n -> withKnownNat n (DAEq $ natVal n)
196+ SAEq n -> withKnownNat n (DAEq . fromIntegral $ natVal n)
197 toSing = \case
197 toSing = \case
198 DAEq n -> case someNatVal n of
198 DAEq n -> case someNatVal n of
199 Just (SomeNat (_ :: Proxy n)) -> SomeSing (SAEq (SNat :: Sing n))
199 Just (SomeNat (_ :: Proxy n)) -> SomeSing (SAEq (SNat :: Sing n))
stack.yaml+5−1
@@ -1 +1,5 @@
1−resolver: lts-10.0
1+resolver: lts-12.0
2+extra-deps:
3+ - hjsonpointer-1.4.0@rev:0
4+ - hjsonschema-1.9.0@rev:0
5+ - validationt-0.2.1.0