-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | JSON-biased spec and validation tool -- -- JSON-biased spec and validation tool @package schematic @version 0.4.2.0 module Data.Schematic.Instances instance forall u (m :: * -> *) (f :: u -> *). GHC.Base.Monad m => Test.SmallCheck.Series.Serial m (Data.Vinyl.Core.Rec f '[]) instance forall a1 (m :: * -> *) (f :: a1 -> *) (a2 :: a1) (as :: [a1]). (Test.SmallCheck.Series.Serial m (f a2), Test.SmallCheck.Series.Serial m (Data.Vinyl.Core.Rec f as), GHC.Base.Monad m) => Test.SmallCheck.Series.Serial m (Data.Vinyl.Core.Rec f (a2 : as)) instance Test.SmallCheck.Series.Serial m a => Test.SmallCheck.Series.Serial m (Data.Vector.Vector a) instance GHC.Base.Monad m => Test.SmallCheck.Series.Serial m Data.Scientific.Scientific module Data.Schematic.Path data PathSegment Key :: Symbol -> PathSegment Ix :: Nat -> PathSegment data DemotedPathSegment DKey :: Text -> DemotedPathSegment DIx :: Integer -> DemotedPathSegment -- | Textual representation of json path. newtype JSONPath JSONPath :: Text -> JSONPath demotePath :: Sing (ps :: [PathSegment]) -> [DemotedPathSegment] demotedPathToText :: [DemotedPathSegment] -> JSONPath pathToText :: Sing (ps :: [PathSegment]) -> JSONPath instance GHC.Show.Show Data.Schematic.Path.JSONPath instance GHC.Show.Show Data.Schematic.Path.DemotedPathSegment module Data.Schematic.Schema data TextConstraint TEq :: Nat -> TextConstraint TLt :: Nat -> TextConstraint TLe :: Nat -> TextConstraint TGt :: Nat -> TextConstraint TGe :: Nat -> TextConstraint TRegex :: Symbol -> TextConstraint TEnum :: [Symbol] -> TextConstraint data DemotedTextConstraint DTEq :: Integer -> DemotedTextConstraint DTLt :: Integer -> DemotedTextConstraint DTLe :: Integer -> DemotedTextConstraint DTGt :: Integer -> DemotedTextConstraint DTGe :: Integer -> DemotedTextConstraint DTRegex :: Text -> DemotedTextConstraint DTEnum :: [Text] -> DemotedTextConstraint data NumberConstraint NLe :: Nat -> NumberConstraint NLt :: Nat -> NumberConstraint NGt :: Nat -> NumberConstraint NGe :: Nat -> NumberConstraint NEq :: Nat -> NumberConstraint data DemotedNumberConstraint DNLe :: Integer -> DemotedNumberConstraint DNLt :: Integer -> DemotedNumberConstraint DNGt :: Integer -> DemotedNumberConstraint DNGe :: Integer -> DemotedNumberConstraint DNEq :: Integer -> DemotedNumberConstraint data ArrayConstraint AEq :: Nat -> ArrayConstraint data DemotedArrayConstraint DAEq :: Integer -> DemotedArrayConstraint data Schema SchemaText :: [TextConstraint] -> Schema SchemaBoolean :: Schema SchemaNumber :: [NumberConstraint] -> Schema SchemaObject :: [(Symbol, Schema)] -> Schema SchemaArray :: [ArrayConstraint] -> Schema -> Schema SchemaNull :: Schema SchemaOptional :: Schema -> Schema SchemaUnion :: [Schema] -> Schema data DemotedSchema DSchemaText :: [DemotedTextConstraint] -> DemotedSchema DSchemaNumber :: [DemotedNumberConstraint] -> DemotedSchema DSchemaBoolean :: DemotedSchema DSchemaObject :: [(Text, DemotedSchema)] -> DemotedSchema DSchemaArray :: [DemotedArrayConstraint] -> DemotedSchema -> DemotedSchema DSchemaNull :: DemotedSchema DSchemaOptional :: DemotedSchema -> DemotedSchema DSchemaUnion :: [DemotedSchema] -> DemotedSchema data FieldRepr :: (Symbol, Schema) -> Type [FieldRepr] :: (SingI schema, KnownSymbol name) => JsonRepr schema -> FieldRepr '(name, schema) -- | Forgetful Functor Ufr toJsonRepr :: FieldRepr '(fn, sch) -> JsonRepr sch knownFieldName :: forall proxy (fieldName :: Symbol) schema. KnownSymbol fieldName => proxy '(fieldName, schema) -> Text knownFieldSchema :: forall proxy fieldName schema. SingI schema => proxy '(fieldName, schema) -> Sing schema data JsonRepr :: Schema -> Type [ReprText] :: Text -> JsonRepr ( 'SchemaText cs) [ReprNumber] :: Scientific -> JsonRepr ( 'SchemaNumber cs) [ReprBoolean] :: Bool -> JsonRepr 'SchemaBoolean [ReprNull] :: JsonRepr 'SchemaNull [ReprArray] :: Vector (JsonRepr s) -> JsonRepr ( 'SchemaArray cs s) [ReprObject] :: Rec FieldRepr fs -> JsonRepr ( 'SchemaObject fs) [ReprOptional] :: Maybe (JsonRepr s) -> JsonRepr ( 'SchemaOptional s) [ReprUnion] :: Union JsonRepr (h : tl) -> JsonRepr ( 'SchemaUnion (h : tl)) -- | Move to the union package fromOptional :: SingI s => Sing ( 'SchemaOptional s) -> Value -> Parser (Maybe (JsonRepr s)) parseUnion :: FromJSON (JsonRepr ( 'SchemaUnion ss)) => sing (ss :: [Schema]) -> Value -> Parser (JsonRepr ( 'SchemaUnion ss)) class FalseConstraint a instance GHC.Generics.Generic Data.Schematic.Schema.DemotedSchema instance GHC.Generics.Generic Data.Schematic.Schema.Schema instance GHC.Generics.Generic Data.Schematic.Schema.DemotedArrayConstraint instance GHC.Generics.Generic Data.Schematic.Schema.ArrayConstraint instance GHC.Generics.Generic Data.Schematic.Schema.DemotedNumberConstraint instance GHC.Generics.Generic Data.Schematic.Schema.NumberConstraint instance GHC.Generics.Generic Data.Schematic.Schema.DemotedTextConstraint instance GHC.Generics.Generic Data.Schematic.Schema.TextConstraint instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr schema) => GHC.Show.Show (Data.Schematic.Schema.FieldRepr '(name, schema)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr schema) => GHC.Classes.Eq (Data.Schematic.Schema.FieldRepr '(name, schema)) instance (GHC.TypeLits.KnownSymbol name, Data.Singletons.SingI schema, Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr schema)) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.FieldRepr '(name, schema)) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaText cs)) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaNumber cs)) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr 'Data.Schematic.Schema.SchemaNull) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr s) => GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaArray acs s)) instance Data.Vinyl.TypeLevel.RecAll Data.Schematic.Schema.FieldRepr fs GHC.Show.Show => GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaObject fs)) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr s) => GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaOptional s)) instance (GHC.Base.Monad m, Test.SmallCheck.Series.Serial m Data.Text.Internal.Text) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaText cs)) instance (GHC.Base.Monad m, Test.SmallCheck.Series.Serial m Data.Scientific.Scientific) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaNumber cs)) instance GHC.Base.Monad m => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr 'Data.Schematic.Schema.SchemaNull) instance Test.SmallCheck.Series.Serial m (Data.Vector.Vector (Data.Schematic.Schema.JsonRepr s)) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaArray cs s)) instance Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr s) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaOptional s)) instance (GHC.Base.Monad m, Test.SmallCheck.Series.Serial m (Data.Vinyl.Core.Rec Data.Schematic.Schema.FieldRepr fs)) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaObject fs)) instance GHC.Classes.Eq (Data.Vinyl.Core.Rec Data.Schematic.Schema.FieldRepr fs) => GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaObject fs)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaText cs)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaNumber cs)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr 'Data.Schematic.Schema.SchemaNull) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr s) => GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaArray as s)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr s) => GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaOptional s)) instance GHC.Exts.IsList (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaArray cs s)) instance GHC.Num.Num (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaNumber cs)) instance Data.String.IsString (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaText cs)) instance Data.Aeson.Types.FromJSON.FromJSON (Data.Union.Union Data.Schematic.Schema.JsonRepr '[]) instance (Data.Singletons.SingI a, Data.Aeson.Types.FromJSON.FromJSON (Data.Union.Union Data.Schematic.Schema.JsonRepr as)) => Data.Aeson.Types.FromJSON.FromJSON (Data.Union.Union Data.Schematic.Schema.JsonRepr (a : as)) instance Data.Aeson.Types.ToJSON.ToJSON (Data.Union.Union Data.Schematic.Schema.JsonRepr as) instance Data.Singletons.SingI schema => Data.Aeson.Types.FromJSON.FromJSON (Data.Schematic.Schema.JsonRepr schema) instance Data.Aeson.Types.ToJSON.ToJSON (Data.Schematic.Schema.JsonRepr a) instance Data.Singletons.SingKind Data.Schematic.Schema.Schema instance Data.Singletons.SingI sl => Data.Singletons.SingI ('Data.Schematic.Schema.SchemaText sl) instance Data.Singletons.SingI sl => Data.Singletons.SingI ('Data.Schematic.Schema.SchemaNumber sl) instance Data.Singletons.SingI 'Data.Schematic.Schema.SchemaNull instance Data.Singletons.SingI 'Data.Schematic.Schema.SchemaBoolean instance (Data.Singletons.SingI ac, Data.Singletons.SingI s) => Data.Singletons.SingI ('Data.Schematic.Schema.SchemaArray ac s) instance Data.Singletons.SingI stl => Data.Singletons.SingI ('Data.Schematic.Schema.SchemaObject stl) instance Data.Singletons.SingI s => Data.Singletons.SingI ('Data.Schematic.Schema.SchemaOptional s) instance Data.Singletons.SingI s => Data.Singletons.SingI ('Data.Schematic.Schema.SchemaUnion s) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaText cs)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaNumber cs)) instance GHC.Classes.Eq (Data.Singletons.Sing 'Data.Schematic.Schema.SchemaNull) instance GHC.Classes.Eq (Data.Singletons.Sing 'Data.Schematic.Schema.SchemaBoolean) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaArray as s)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaObject cs)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaOptional s)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaUnion s)) instance Data.Singletons.SingKind Data.Schematic.Schema.ArrayConstraint instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.AEq n) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.AEq n)) instance Data.Singletons.SingKind Data.Schematic.Schema.NumberConstraint instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.NEq n) instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.NGt n) instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.NGe n) instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.NLt n) instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.NLe n) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.NEq n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.NLt n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.NLe n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.NGt n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.NGe n)) instance Data.Singletons.SingKind Data.Schematic.Schema.TextConstraint instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.TEq n) instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.TGt n) instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.TGe n) instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.TLt n) instance GHC.TypeNats.KnownNat n => Data.Singletons.SingI ('Data.Schematic.Schema.TLe n) instance (GHC.TypeLits.KnownSymbol s, Data.Singletons.SingI s) => Data.Singletons.SingI ('Data.Schematic.Schema.TRegex s) instance Data.Singletons.SingI ss => Data.Singletons.SingI ('Data.Schematic.Schema.TEnum ss) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TEq n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TLt n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TLe n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TGt n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TGe n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TRegex t)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TEnum ss)) module Data.Schematic.Lens -- | A partial relation that gives the index of a value in a list. class i ~ FIndex fn rs => FElem (fn :: Symbol) (rs :: [(Symbol, Schema)]) (i :: Nat) where { type family ByField fn rs i :: Schema; } flens :: FElem fn rs i => Flens fn f g rs i -- | For Vinyl users who are not using the lens package, we -- provide a getter. fget :: FElem fn rs i => FGetter fn f rs i -- | For Vinyl users who are not using the lens package, we also -- provide a setter. In general, it will be unambiguous what field is -- being written to, and so we do not take a proxy argument here. fput :: FElem fn rs i => f '(fn, ByField fn rs i) -> Rec f rs -> Rec f rs -- | A partial relation that gives the indices of a sublist in a larger -- list. class is ~ FImage rs ss => FSubset (rs :: [(Symbol, Schema)]) (ss :: [(Symbol, Schema)]) is -- | This is a lens into a slice of the larger record. Morally, we have: -- --
--   fsubset :: Lens' (Rec FieldRepr ss) (Rec FieldRepr rs)
--   
fsubset :: (FSubset rs ss is, Functor g) => (Rec f rs -> g (Rec f rs)) -> Rec f ss -> g (Rec f ss) -- | The getter of the fsubset lens is fcast, which takes a -- larger record to a smaller one by forgetting fields. fcast :: FSubset rs ss is => Rec f ss -> Rec f rs -- | The setter of the fsubset lens is freplace, which allows -- a slice of a record to be replaced with different values. freplace :: FSubset rs ss is => Rec f rs -> Rec f ss -> Rec f ss obj :: SingI fields => Iso' (JsonRepr ( 'SchemaObject fields)) (Rec FieldRepr fields) arr :: (SingI schema) => Iso' (JsonRepr ( 'SchemaArray cs schema)) (Vector (JsonRepr schema)) uni :: SingI (h : tl) => Iso' (JsonRepr ( 'SchemaUnion (h : tl))) (Union JsonRepr (h : tl)) txt :: SingI cs => Iso' (JsonRepr ( 'SchemaText cs)) Text num :: SingI cs => Iso' (JsonRepr ( 'SchemaNumber cs)) Scientific opt :: SingI schema => Iso' (JsonRepr ( 'SchemaOptional schema)) (Maybe (JsonRepr schema)) bln :: Iso' (JsonRepr 'SchemaBoolean) Bool textRepr :: (KnownSymbol fn, SingI fn, SingI cs) => Iso' (FieldRepr '(fn, ( 'SchemaText cs))) Text numberRepr :: (KnownSymbol fn, SingI fn, SingI cs) => Iso' (FieldRepr '(fn, ( 'SchemaNumber cs))) Scientific boolRepr :: (KnownSymbol fn, SingI fn, SingI cs) => Iso' (FieldRepr '(fn, 'SchemaBoolean)) Bool arrayRepr :: (KnownSymbol fn, SingI fn, SingI cs, SingI schema) => Iso' (FieldRepr '(fn, ( 'SchemaArray cs schema))) (Vector (JsonRepr schema)) objectRepr :: (KnownSymbol fn, SingI fn, SingI fields) => Iso' (FieldRepr '(fn, ( 'SchemaObject fields))) (Rec FieldRepr fields) optionalRepr :: (KnownSymbol fn, SingI fn, SingI schema) => Iso' (FieldRepr '(fn, ( 'SchemaOptional schema))) (Maybe (JsonRepr schema)) instance Data.Schematic.Lens.FSubset '[] ss '[] instance (Data.Schematic.Lens.ByField fn ss i ~ s, Data.Schematic.Lens.FElem fn ss i, Data.Schematic.Lens.FSubset rs ss is) => Data.Schematic.Lens.FSubset ('(fn, s) : rs) ss (i : is) instance Data.Schematic.Lens.FElem fn ('(fn, r) : rs) 'Data.Vinyl.TypeLevel.Z instance (Data.Schematic.Lens.FIndex r (s : rs) ~ 'Data.Vinyl.TypeLevel.S i, Data.Schematic.Lens.FElem r rs i) => Data.Schematic.Lens.FElem r (s : rs) ('Data.Vinyl.TypeLevel.S i) module Data.Schematic.JsonSchema toJsonSchema :: forall proxy schema. SingI schema => proxy (schema :: Schema) -> Maybe Schema toJsonSchema' :: DemotedSchema -> Maybe Schema module Data.Schematic.Helpers type UUIDRegex = 'TRegex "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" type IsUUID = '[UUIDRegex] type ISO8601Date = "[1-9][0-9]{3}-(0[1-9]|1[0-2])-([0-2][0-9]|3[0-1])" type ISO8601Time = "([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]" type ISO8601DateTime = AppendSymbol ISO8601Date (AppendSymbol "(T" (AppendSymbol ISO8601Time ")?")) type ISO8601UTC = "(Z|\\+00:00)" type ISO8601DateTimeUTC = AppendSymbol ISO8601Date (AppendSymbol "T" (AppendSymbol ISO8601Time ISO8601UTC)) type ISO8601TZ = "\\+[0-1][0-9]:[0-6][0-9]" type ISO8601DateTimeZoned = AppendSymbol ISO8601Date (AppendSymbol "T" (AppendSymbol ISO8601Time ISO8601TZ)) type ISO8601DateRegex = 'TRegex ISO8601Date type ISO8601TimeRegex = 'TRegex ISO8601Time type ISO8601DateTimeRegex = 'TRegex ISO8601DateTime type ISO8601DateTimeRegexUTC = 'TRegex ISO8601DateTimeUTC type ISO8601DateTimeRegexZoned = 'TRegex ISO8601DateTimeZoned type IsDate = '[ISO8601DateRegex] type IsTime = '[ISO8601TimeRegex] type IsDateTime = '[ISO8601DateTimeRegex] type IsZonedDateTime = '[ISO8601DateTimeRegexZoned] type IsUTCDateTime = '[ISO8601DateTimeRegexUTC] module Data.Schematic.DSL type Constructor a = forall b. FSubset (FieldsOf a) b (FImage (FieldsOf a) b) => Rec (Tagged (FieldsOf a) :. FieldRepr) b -> JsonRepr ( 'SchemaObject (FieldsOf a)) withRepr :: Constructor a class Representable s constructField :: Representable s => Sing fn -> Proxy s -> Repr s -> FieldRepr '(fn, s) construct :: Sing s -> Repr s -> JsonRepr s type FieldConstructor fn = forall fs. (Representable (ByField fn fs (FIndex fn fs))) => Repr (ByField fn fs (FIndex fn fs)) -> (Tagged fs :. FieldRepr) '(fn, (ByField fn fs (FIndex fn fs))) field :: forall fn. KnownSymbol fn => FieldConstructor fn instance Data.Singletons.SingI so => Data.Schematic.DSL.Representable ('Data.Schematic.Schema.SchemaObject so) instance (Data.Singletons.SingI cs, Data.Singletons.SingI sa) => Data.Schematic.DSL.Representable ('Data.Schematic.Schema.SchemaArray cs sa) instance Data.Singletons.SingI cs => Data.Schematic.DSL.Representable ('Data.Schematic.Schema.SchemaText cs) instance Data.Singletons.SingI cs => Data.Schematic.DSL.Representable ('Data.Schematic.Schema.SchemaNumber cs) instance Data.Schematic.DSL.Representable 'Data.Schematic.Schema.SchemaBoolean instance Data.Singletons.SingI so => Data.Schematic.DSL.Representable ('Data.Schematic.Schema.SchemaOptional so) instance Data.Singletons.SingI (h : tl) => Data.Schematic.DSL.Representable ('Data.Schematic.Schema.SchemaUnion (h : tl)) module Data.Schematic.Migration data Path PKey :: Symbol -> Path PTraverse :: Path data Builder BKey :: Schema -> Symbol -> Builder -> Builder BTraverse :: Schema -> Builder -> Builder BScalar :: Schema -> Builder -- | Extracts revision/schema pairs from Versioned in reverse -- order. data Action AddKey :: Symbol -> Schema -> Action Update :: Schema -> Action DeleteKey :: Symbol -> Action -- | User-supplied atomic difference between schemas. Migrations can -- consists of many differences. data Diff Diff :: [Path] -> Action -> Diff -- | User-provided name of the revision. type Revision = Symbol data Migration Migration :: Revision -> [Diff] -> Migration data Versioned Versioned :: Schema -> [Migration] -> Versioned type DataMigration s m h = Tagged s (JsonRepr h -> m (JsonRepr s)) data MList :: (* -> *) -> [Schema] -> Type [MNil] :: (Monad m, SingI s, TopLevel s) => MList m '[s] [:&&] :: (TopLevel s, SingI s) => DataMigration s m h -> MList m (h : tl) -> MList m (s : (h : tl)) migrateObject :: forall m fs fh. (FSubset fs fs (FImage fs fs), Monad m) => (Rec (Tagged fs :. FieldRepr) fh -> m (Rec (Tagged fs :. FieldRepr) fs)) -> Tagged ( 'SchemaObject fs) (JsonRepr ( 'SchemaObject fh) -> m (JsonRepr ( 'SchemaObject fs))) shrinkObject :: forall rs ss m. (Monad m, FSubset rs ss (FImage rs ss)) => Tagged ( 'SchemaObject rs) (JsonRepr ( 'SchemaObject ss) -> m (JsonRepr ( 'SchemaObject rs))) type MigrationList m vs = MList m (MapSnd (AllVersions vs)) instance GHC.TypeLits.KnownSymbol s => Data.Singletons.SingI ('Data.Schematic.Migration.PKey s) instance Data.Singletons.SingI 'Data.Schematic.Migration.PTraverse module Data.Schematic.Validation type Validation a = ValidationT ErrorMap Identity a type ErrorMap = MonoidMap Text [Text] data ParseResult a Valid :: a -> ParseResult a DecodingError :: Text -> ParseResult a ValidationError :: ErrorMap -> ParseResult a isValid :: ParseResult a -> Bool isDecodingError :: ParseResult a -> Bool isValidationError :: ParseResult a -> Bool validateTextConstraint :: JSONPath -> Text -> Sing (tcs :: TextConstraint) -> Validation () validateNumberConstraint :: JSONPath -> Scientific -> Sing (tcs :: NumberConstraint) -> Validation () validateArrayConstraint :: JSONPath -> Vector a -> Sing (tcs :: ArrayConstraint) -> Validation () validateJsonRepr :: Sing schema -> [DemotedPathSegment] -> JsonRepr schema -> Validation () toUnion :: USubset s' (s : ss) (RImage s' (s : ss)) => Sing (s : ss) -> Union JsonRepr s' -> JsonRepr ( 'SchemaUnion (s : ss)) umatch' :: UElem a as i => Sing a -> Union f as -> Maybe (f a) instance Data.Traversable.Traversable Data.Schematic.Validation.ParseResult instance Data.Foldable.Foldable Data.Schematic.Validation.ParseResult instance GHC.Base.Functor Data.Schematic.Validation.ParseResult instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Schematic.Validation.ParseResult a) instance GHC.Show.Show a => GHC.Show.Show (Data.Schematic.Validation.ParseResult a) module Data.Schematic decodeAndValidateJson :: forall schema. (FromJSON (JsonRepr schema), TopLevel schema, SingI schema) => ByteString -> ParseResult (JsonRepr schema) parseAndValidateJson :: forall schema. (FromJSON (JsonRepr schema), TopLevel schema, SingI schema) => Value -> ParseResult (JsonRepr schema) parseAndValidateJsonBy :: (FromJSON (JsonRepr schema), TopLevel schema, SingI schema) => proxy schema -> Value -> ParseResult (JsonRepr schema) parseAndValidateTopVersionJson :: forall proxy (v :: Versioned). (SingI (TopVersion (AllVersions v))) => proxy v -> Value -> ParseResult (JsonRepr (TopVersion (AllVersions v))) parseAndValidateWithMList :: Monad m => MList m revisions -> Value -> m (ParseResult (JsonRepr (Head revisions))) decodeAndValidateVersionedWithMList :: Monad m => proxy versioned -> MList m (MapSnd (AllVersions versioned)) -> ByteString -> m (ParseResult (JsonRepr (Head (MapSnd (AllVersions versioned))))) decodeAndValidateVersionedWithPureMList :: proxy versioned -> MList Identity (MapSnd (AllVersions versioned)) -> ByteString -> ParseResult (JsonRepr (Head (MapSnd (AllVersions versioned)))) isValid :: ParseResult a -> Bool isDecodingError :: ParseResult a -> Bool isValidationError :: ParseResult a -> Bool data ParseResult a Valid :: a -> ParseResult a DecodingError :: Text -> ParseResult a ValidationError :: ErrorMap -> ParseResult a withRepr :: Constructor a field :: forall fn. KnownSymbol fn => FieldConstructor fn