DataVersion-0.1.0.0: Type safe data migrations

Safe HaskellNone
LanguageHaskell2010

Data.Migration.Internal

Synopsis

Documentation

type family RepToTree (a :: Type -> Type) :: [(Symbol, Type)] where ... Source #

Equations

RepToTree (f :*: g) = RepToTree f ++ RepToTree g 
RepToTree (M1 S (MetaSel (Just name) _1 _2 _3) (K1 _4 t)) = '['(name, t)] 
RepToTree (M1 _1 _2 f) = RepToTree f 

type family (xs :: [k]) ++ (ys :: [k]) :: [k] where ... Source #

Equations

'[] ++ ys = ys 
(x ': xs) ++ ys = x ': (xs ++ ys) 

type family Sort (xs :: [(Symbol, k)]) where ... Source #

Equations

Sort '[] = '[] 
Sort (x ': xs) = Insert x (Sort xs) 

type family Insert (x :: (Symbol, k)) (xs :: [(Symbol, k)]) where ... Source #

Equations

Insert x '[] = x ': '[] 
Insert '(x, t) ('(y, t') ': ys) = Insert' (CmpSymbol x y) '(x, t) '(y, t') ys 

type family Insert' (b :: Ordering) (x :: (Symbol, k)) (y :: (Symbol, k)) (ys :: [(Symbol, k)]) where ... Source #

Equations

Insert' LT x y ys = x ': (y ': ys) 
Insert' _ x y ys = y ': Insert x ys 

data DiffResult Source #

Instances
(Generic dst, GUndefinedFields (Rep dst)) => GTransform ([] :: [DiffResult]) src dst Source # 
Instance details

Defined in Data.Migration.Internal

Associated Types

type Function [] src dst :: Type Source #

Methods

gTransform :: dst -> src -> Function [] src dst Source #

(GTransform ts src dst, HasField' name src t, HasField' name dst t) => GTransform (NoChange name t ': ts) src dst Source # 
Instance details

Defined in Data.Migration.Internal

Associated Types

type Function (NoChange name t ': ts) src dst :: Type Source #

Methods

gTransform :: dst -> src -> Function (NoChange name t ': ts) src dst Source #

(GTransform ts src dst, HasField' name dst t) => GTransform (Addition name t ': ts) src dst Source # 
Instance details

Defined in Data.Migration.Internal

Associated Types

type Function (Addition name t ': ts) src dst :: Type Source #

Methods

gTransform :: dst -> src -> Function (Addition name t ': ts) src dst Source #

(GTransform ts src dst, HasField' name src ti, HasField' name dst to) => GTransform (Change name ti to ': ts) src dst Source # 
Instance details

Defined in Data.Migration.Internal

Associated Types

type Function (Change name ti to ': ts) src dst :: Type Source #

Methods

gTransform :: dst -> src -> Function (Change name ti to ': ts) src dst Source #

type Function ([] :: [DiffResult]) src dst Source # 
Instance details

Defined in Data.Migration.Internal

type Function ([] :: [DiffResult]) src dst = dst
type Function (NoChange name t ': ts) src dst Source # 
Instance details

Defined in Data.Migration.Internal

type Function (NoChange name t ': ts) src dst = Function ts src dst
type Function (Addition name t ': ts) src dst Source # 
Instance details

Defined in Data.Migration.Internal

type Function (Addition name t ': ts) src dst = (src -> t) -> Function ts src dst
type Function (Change name ti to ': ts) src dst Source # 
Instance details

Defined in Data.Migration.Internal

type Function (Change name ti to ': ts) src dst = (src -> ti -> to) -> Function ts src dst

type family FieldDiff (a :: [(Symbol, Type)]) (b :: [(Symbol, Type)]) :: [DiffResult] where ... Source #

Equations

FieldDiff xs '[] = '[] 
FieldDiff '[] ('(y, v) ': ys) = Addition y v ': FieldDiff '[] ys 
FieldDiff ('(x, t) ': xs) ('(x, t) ': ys) = NoChange x t ': FieldDiff xs ys 
FieldDiff ('(x, u) ': xs) ('(x, v) ': ys) = Change x u v ': FieldDiff xs ys 
FieldDiff ('(x, u) ': xs) ('(y, v) ': ys) = FieldDiffImpl (CmpSymbol x y) '(x, u) '(y, v) xs ys 

type family FieldDiffImpl (b :: Ordering) (x :: (Symbol, Type)) (y :: (Symbol, Type)) (xs :: [(Symbol, Type)]) (ys :: [(Symbol, Type)]) :: [DiffResult] where ... Source #

Equations

FieldDiffImpl LT _ y xs ys = FieldDiff xs (y ': ys) 
FieldDiffImpl GT x '(y, v) xs ys = Addition y v ': FieldDiff (x ': xs) ys 

copyField :: forall name t from to. (HasField' name to t, HasField' name from t) => from -> to -> to Source #

class GTransform (ts :: [DiffResult]) (src :: Type) (dst :: Type) where Source #

Associated Types

type Function ts src dst :: Type Source #

Methods

gTransform :: dst -> src -> Function ts src dst Source #

Instances
(Generic dst, GUndefinedFields (Rep dst)) => GTransform ([] :: [DiffResult]) src dst Source # 
Instance details

Defined in Data.Migration.Internal

Associated Types

type Function [] src dst :: Type Source #

Methods

gTransform :: dst -> src -> Function [] src dst Source #

(GTransform ts src dst, HasField' name src t, HasField' name dst t) => GTransform (NoChange name t ': ts) src dst Source # 
Instance details

Defined in Data.Migration.Internal

Associated Types

type Function (NoChange name t ': ts) src dst :: Type Source #

Methods

gTransform :: dst -> src -> Function (NoChange name t ': ts) src dst Source #

(GTransform ts src dst, HasField' name dst t) => GTransform (Addition name t ': ts) src dst Source # 
Instance details

Defined in Data.Migration.Internal

Associated Types

type Function (Addition name t ': ts) src dst :: Type Source #

Methods

gTransform :: dst -> src -> Function (Addition name t ': ts) src dst Source #

(GTransform ts src dst, HasField' name src ti, HasField' name dst to) => GTransform (Change name ti to ': ts) src dst Source # 
Instance details

Defined in Data.Migration.Internal

Associated Types

type Function (Change name ti to ': ts) src dst :: Type Source #

Methods

gTransform :: dst -> src -> Function (Change name ti to ': ts) src dst Source #

class GUndefinedFields (o :: * -> *) where Source #

Methods

gUndefinedFields :: o x Source #

Instances
GUndefinedFields (K1 _1 t :: Type -> Type) Source # 
Instance details

Defined in Data.Migration.Internal

Methods

gUndefinedFields :: K1 _1 t x Source #

(GUndefinedFields o1, GUndefinedFields o2) => GUndefinedFields (o1 :*: o2) Source # 
Instance details

Defined in Data.Migration.Internal

Methods

gUndefinedFields :: (o1 :*: o2) x Source #

GUndefinedFields o => GUndefinedFields (M1 _3 _4 o) Source # 
Instance details

Defined in Data.Migration.Internal

Methods

gUndefinedFields :: M1 _3 _4 o x Source #

undefinedFields :: (Generic t, GUndefinedFields (Rep t)) => t Source #

Don't use this, it's not meant to be useful