{-# LANGUAGE UndecidableInstances #-} module Database.Beam.Migrate.Generics.Types where import Database.Beam.Migrate.Types import Data.Proxy import qualified Data.Text as T import GHC.Generics class GAutoMigratableDb be x where defaultMigratableDbSettings' :: Proxy be -> x () instance GAutoMigratableDb be x => GAutoMigratableDb be (D1 f x) where defaultMigratableDbSettings' :: Proxy be -> D1 f x () defaultMigratableDbSettings' Proxy be be = x () -> D1 f x () forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p M1 (x () -> D1 f x ()) -> x () -> D1 f x () forall a b. (a -> b) -> a -> b $ Proxy be -> x () forall be (x :: * -> *). GAutoMigratableDb be x => Proxy be -> x () defaultMigratableDbSettings' Proxy be be instance GAutoMigratableDb be x => GAutoMigratableDb be (C1 f x) where defaultMigratableDbSettings' :: Proxy be -> C1 f x () defaultMigratableDbSettings' Proxy be be = x () -> C1 f x () forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p M1 (x () -> C1 f x ()) -> x () -> C1 f x () forall a b. (a -> b) -> a -> b $ Proxy be -> x () forall be (x :: * -> *). GAutoMigratableDb be x => Proxy be -> x () defaultMigratableDbSettings' Proxy be be instance (GAutoMigratableDb be x, GAutoMigratableDb be y) => GAutoMigratableDb be (x :*: y) where defaultMigratableDbSettings' :: Proxy be -> (:*:) x y () defaultMigratableDbSettings' Proxy be be = Proxy be -> x () forall be (x :: * -> *). GAutoMigratableDb be x => Proxy be -> x () defaultMigratableDbSettings' Proxy be be x () -> y () -> (:*:) x y () forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> g p -> (:*:) f g p :*: Proxy be -> y () forall be (x :: * -> *). GAutoMigratableDb be x => Proxy be -> x () defaultMigratableDbSettings' Proxy be be instance ( Selector f, IsCheckedDatabaseEntity be x , CheckedDatabaseEntityDefaultRequirements be x ) => GAutoMigratableDb be (S1 f (Rec0 (CheckedDatabaseEntity be db x))) where defaultMigratableDbSettings' :: Proxy be -> S1 f (Rec0 (CheckedDatabaseEntity be db x)) () defaultMigratableDbSettings' Proxy be _ = K1 R (CheckedDatabaseEntity be db x) () -> S1 f (Rec0 (CheckedDatabaseEntity be db x)) () forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p M1 (CheckedDatabaseEntity be db x -> K1 R (CheckedDatabaseEntity be db x) () forall k i c (p :: k). c -> K1 i c p K1 (CheckedDatabaseEntityDescriptor be x -> [SomeDatabasePredicate] -> CheckedDatabaseEntity be db x forall be entityType (db :: (* -> *) -> *). IsCheckedDatabaseEntity be entityType => CheckedDatabaseEntityDescriptor be entityType -> [SomeDatabasePredicate] -> CheckedDatabaseEntity be db entityType CheckedDatabaseEntity (Text -> CheckedDatabaseEntityDescriptor be x forall be entity. (IsCheckedDatabaseEntity be entity, CheckedDatabaseEntityDefaultRequirements be entity) => Text -> CheckedDatabaseEntityDescriptor be entity checkedDbEntityAuto Text name) [])) where name :: Text name = String -> Text T.pack (S1 f (Rec0 (CheckedDatabaseEntity be db x)) () -> String forall {k} (s :: k) k1 (t :: k -> (k1 -> *) -> k1 -> *) (f :: k1 -> *) (a :: k1). Selector s => t s f a -> String selName (S1 f (Rec0 (CheckedDatabaseEntity be db x)) () forall a. HasCallStack => a undefined :: S1 f (Rec0 (CheckedDatabaseEntity be db x)) ()))