Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Path
- data Builder
- type family SchemaByKey (fs :: [(Symbol, Schema)]) (s :: Symbol) :: Schema where ...
- type family DeleteKey (acc :: [(Symbol, Schema)]) (fn :: Symbol) (fs :: [(Symbol, Schema)]) :: [(Symbol, Schema)] where ...
- type family UpdateKey (fn :: Symbol) (fs :: [(Symbol, Schema)]) (s :: Schema) = (r :: [(Symbol, Schema)]) where ...
- type family Build (b :: Builder) :: Schema where ...
- type family MakeBuilder (s :: Schema) (d :: Diff) :: Builder where ...
- type family ApplyAction (a :: Action) (s :: Schema) :: Schema where ...
- type family ApplyMigration (m :: Migration) (s :: Schema) :: (Revision, Schema) where ...
- type family SchemaByRevision (r :: Revision) (vd :: Versioned) :: Schema where ...
- type family InitialSchema (v :: Versioned) = (s :: Schema) where ...
- type family ElemOf (e :: k) (l :: [(a, k)]) :: Constraint where ...
- type family AllVersions (vd :: Versioned) :: [(Revision, Schema)] where ...
- type family AllVersions' (acc :: [(Revision, Schema)]) (ms :: [Migration]) = (r :: [(Revision, Schema)]) where ...
- type family TopVersion (rs :: [(Revision, Schema)]) :: Schema where ...
- data Action
- data Diff = Diff [Path] Action
- type Revision = Symbol
- data Migration = Migration Revision [Diff]
- data Versioned = Versioned Schema [Migration]
- type DataMigration s m h = Tagged s (JsonRepr h -> m (JsonRepr s))
- data MList :: (Type -> Type) -> [Schema] -> Type where
- 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 family MapSnd (l :: [(a, k)]) = (r :: [k]) where ...
- type MigrationList m vs = MList m (MapSnd (AllVersions vs))
Documentation
Instances
SingI PTraverse Source # | |
Defined in Data.Schematic.Migration | |
KnownSymbol s => SingI (PKey s :: Path) Source # | |
Defined in Data.Schematic.Migration | |
data Sing (p :: Path) Source # | |
Defined in Data.Schematic.Migration |
type family SchemaByKey (fs :: [(Symbol, Schema)]) (s :: Symbol) :: Schema where ... Source #
SchemaByKey ('(fn, s) ': tl) fn = s | |
SchemaByKey ('(a, s) ': tl) fn = SchemaByKey tl fn |
type family DeleteKey (acc :: [(Symbol, Schema)]) (fn :: Symbol) (fs :: [(Symbol, Schema)]) :: [(Symbol, Schema)] where ... Source #
type family UpdateKey (fn :: Symbol) (fs :: [(Symbol, Schema)]) (s :: Schema) = (r :: [(Symbol, Schema)]) where ... Source #
type family Build (b :: Builder) :: Schema where ... Source #
Build (BKey (SchemaObject fs) fn z) = SchemaObject (UpdateKey fn fs (Build z)) | |
Build (BTraverse (SchemaArray acs s) z) = SchemaArray acs (Build z) | |
Build (BScalar s) = s |
type family MakeBuilder (s :: Schema) (d :: Diff) :: Builder where ... Source #
MakeBuilder s (Diff '[] a) = BScalar (ApplyAction a s) | |
MakeBuilder (SchemaObject fs) (Diff (PKey fn ': tl) a) = BKey (SchemaObject fs) fn (MakeBuilder (SchemaByKey fs fn) (Diff tl a)) | |
MakeBuilder (SchemaArray acs s) (Diff (PTraverse ': tl) a) = BTraverse (SchemaArray acs s) (MakeBuilder s (Diff tl a)) |
type family ApplyAction (a :: Action) (s :: Schema) :: Schema where ... Source #
ApplyAction (AddKey fn s) (SchemaObject fs) = SchemaObject ('(fn, s) ': fs) | |
ApplyAction (DeleteKey fn) (SchemaObject fs) = SchemaObject (DeleteKey '[] fn fs) | |
ApplyAction (Update s) t = s |
type family ApplyMigration (m :: Migration) (s :: Schema) :: (Revision, Schema) where ... Source #
ApplyMigration (Migration r '[]) s = '(r, s) | |
ApplyMigration (Migration r (d ': ds)) s = '(r, Snd (ApplyMigration (Migration r ds) (Build (MakeBuilder s d)))) |
type family SchemaByRevision (r :: Revision) (vd :: Versioned) :: Schema where ... Source #
SchemaByRevision r (Versioned s (Migration r ds ': ms)) = Snd (ApplyMigration (Migration r ds) s) | |
SchemaByRevision r (Versioned s (m ': ms)) = SchemaByRevision r (Versioned (Snd (ApplyMigration m s)) ms) |
type family InitialSchema (v :: Versioned) = (s :: Schema) where ... Source #
InitialSchema (Versioned s ms) = s |
type family ElemOf (e :: k) (l :: [(a, k)]) :: Constraint where ... Source #
type family AllVersions (vd :: Versioned) :: [(Revision, Schema)] where ... Source #
Extracts revision/schema pairs from Versioned
in reverse order.
AllVersions (Versioned s ms) = Reverse (AllVersions' '['("initial", s)] ms) |
type family AllVersions' (acc :: [(Revision, Schema)]) (ms :: [Migration]) = (r :: [(Revision, Schema)]) where ... Source #
AllVersions' acc '[] = acc | |
AllVersions' ('(rh, sh) ': tl) (m ': ms) = AllVersions' ('(rh, sh) ': (ApplyMigration m sh ': tl)) ms |
type family TopVersion (rs :: [(Revision, Schema)]) :: Schema where ... Source #
TopVersion ('(rh, sh) ': tl) = sh |
User-supplied atomic difference between schemas. Migrations can consists of many differences.
Instances
data Sing (m :: Migration) Source # | |
Defined in Data.Schematic.Migration |
Instances
data Sing (v :: Versioned) Source # | |
Defined in Data.Schematic.Migration |
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))) Source #
shrinkObject :: forall rs ss m. (Monad m, FSubset rs ss (FImage rs ss)) => Tagged (SchemaObject rs) (JsonRepr (SchemaObject ss) -> m (JsonRepr (SchemaObject rs))) Source #
type MigrationList m vs = MList m (MapSnd (AllVersions vs)) Source #