on master help sign in
Add: lts-13.7 (base-4.12)
commitae27c6026a0d722bf854f905feb90c6af1cc466a authorDmitry Olshansky <olshanskydr@gmail.com> dateThu 21 Feb 2019, 00:36 (8 years ago) parent0d5061b
5 files changed+40−9
schematic.cabal+2−2 src/Data/Schematic/DSL.hs+11−2 src/Data/Schematic/Migration.hs+10−2 src/Data/Schematic/Schema.hs+12−3 stack-13.7.yaml+5
schematic.cabal+2−2
@@ -65,7 +65,7 @@ library
6565 , TypeOperators
6666 , TypeSynonymInstances
6767 , UndecidableInstances
68− build-depends: base >=4.11 && <4.12
68+ build-depends: base >=4.11 && <4.13
6969 , bytestring
7070 , aeson >= 1
7171 , containers
@@ -95,7 +95,7 @@ test-suite spec
9595 default-language: Haskell2010
9696 build-depends: HUnit
9797 , aeson >= 1
98− , base >=4.11 && <4.12
98+ , base >=4.11 && <4.13
9999 , bytestring
100100 , containers
101101 , hjsonschema
src/Data/Schematic/DSL.hs+11−2
@@ -1,4 +1,5 @@
11{-# LANGUAGE AllowAmbiguousTypes #-}
2+{-# LANGUAGE CPP #-}
23
34module Data.Schematic.DSL where
45
@@ -17,11 +18,19 @@ import Data.Vinyl
1718import Data.Vinyl.Functor
1819
1920
21+#if MIN_VERSION_base(4,12,0)
2022type Constructor a
21− = forall fields b. (fields ~ FieldsOf a, FSubset fields b (FImage fields b))
23+ = forall fields b
24+ . (fields ~ FieldsOf a, FSubset fields b (FImage fields b), RMap fields)
2225 => Rec (Tagged fields :. FieldRepr) b
2326 -> JsonRepr ('SchemaObject fields)
24−
27+#else
28+type Constructor a
29+ = forall fields b
30+ . (fields ~ FieldsOf a, FSubset fields b (FImage fields b))
31+ => Rec (Tagged fields :. FieldRepr) b
32+ -> JsonRepr ('SchemaObject fields)
33+#endif
2534withRepr :: Constructor a
2635withRepr = ReprObject . rmap (unTagged . getCompose) . fcast
2736
src/Data/Schematic/Migration.hs+10−2
@@ -1,5 +1,6 @@
11{-# LANGUAGE AllowAmbiguousTypes #-}
2−{-# LANGUAGE TemplateHaskell #-}
2+{-# LANGUAGE CPP #-}
3+{-# LANGUAGE TemplateHaskell #-}
34
45module Data.Schematic.Migration where
56
@@ -8,7 +9,7 @@ import Data.Schematic.DSL
89import Data.Schematic.Lens
910import Data.Schematic.Path
1011import Data.Schematic.Schema
11−import Data.Singletons.Prelude hiding (All, (:.))
12+import Data.Singletons.Prelude hiding ((:.), All)
1213import Data.Singletons.TypeLits
1314import Data.Tagged
1415import Data.Vinyl
@@ -156,10 +157,17 @@ data MList :: (Type -> Type) -> [Schema] -> Type where
156157
157158infixr 7 :&&
158159
160+#if MIN_VERSION_base(4,12,0)
161+migrateObject
162+ :: forall m fs fh. (FSubset fs fs (FImage fs fs), Monad m, RMap fh, RMap fs)
163+ => (Rec (Tagged fs :. FieldRepr) fh -> m (Rec (Tagged fs :. FieldRepr) fs))
164+ -> Tagged ('SchemaObject fs) (JsonRepr ('SchemaObject fh) -> m (JsonRepr ('SchemaObject fs)))
165+#else
159166migrateObject
160167 :: forall m fs fh. (FSubset fs fs (FImage fs fs), Monad m)
161168 => (Rec (Tagged fs :. FieldRepr) fh -> m (Rec (Tagged fs :. FieldRepr) fs))
162169 -> Tagged ('SchemaObject fs) (JsonRepr ('SchemaObject fh) -> m (JsonRepr ('SchemaObject fs)))
170+#endif
163171migrateObject f = Tagged $ \(ReprObject r) -> do
164172 res <- f $ rmap (Compose . Tagged) r
165173 pure $ withRepr @('SchemaObject fs) res
src/Data/Schematic/Schema.hs+12−3
@@ -1,6 +1,7 @@
11{-# LANGUAGE AllowAmbiguousTypes #-}
2−{-# LANGUAGE OverloadedLists #-}
3−{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE CPP #-}
3+{-# LANGUAGE OverloadedLists #-}
4+{-# LANGUAGE OverloadedStrings #-}
45{-# OPTIONS_GHC -fprint-explicit-kinds #-}
56
67module Data.Schematic.Schema where
@@ -12,8 +13,8 @@ import Data.Aeson.Types as J
1213import Data.HashMap.Strict as H
1314import Data.Kind
1415import Data.Maybe
15−import Data.Schematic.Instances ()
1616import Data.Schematic.Generator
17+import Data.Schematic.Instances ()
1718import Data.Scientific
1819import Data.Singletons.Prelude.List hiding (All, Union)
1920import Data.Singletons.TH
@@ -373,8 +374,16 @@ instance Show (JsonRepr 'SchemaNull) where show _ = "ReprNull"
373374instance Show (JsonRepr s) => Show (JsonRepr ('SchemaArray acs s)) where
374375 show (ReprArray v) = "ReprArray " P.++ show v
375376
377+#if MIN_VERSION_base(4,12,0)
378+instance
379+ ( V.RecAll FieldRepr fs Show, RMap fs, ReifyConstraint Show FieldRepr fs
380+ , RecordToList fs )
381+ => Show (JsonRepr ('SchemaObject fs)) where
382+ show (ReprObject fs) = "ReprObject " P.++ show fs
383+#else
376384instance V.RecAll FieldRepr fs Show => Show (JsonRepr ('SchemaObject fs)) where
377385 show (ReprObject fs) = "ReprObject " P.++ show fs
386+#endif
378387
379388instance Show (JsonRepr s) => Show (JsonRepr ('SchemaOptional s)) where
380389 show (ReprOptional s) = "ReprOptional " P.++ show s
stack-13.7.yamlnew file+5
@@ -0,0 +1,5 @@
1+resolver: lts-13.7
2+extra-deps:
3+ - hjsonpointer-1.4.0@rev:0
4+ - hjsonschema-1.9.0@rev:0
5+ - validationt-0.2.1.0