Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- data Migration = Migration {
- runMigration :: forall a b. (Data a, Data b) => a -> b -> Maybe a
- runSafeMigration :: (Data a, Data b) => Migration -> a -> b -> a
- castMigration :: Migration
- newtypeMigration :: Migration
- userMigration :: (Typeable c, Typeable d) => (c -> d) -> Migration
- migrationTo2 :: Typeable t => (forall a b c. (Typeable a, Typeable b, Typeable c) => t b c -> a -> Maybe (t b c)) -> Migration
- constMigrationFrom2 :: Typeable t => (forall a b c. (Typeable a, Typeable b, Typeable c) => t b c -> Maybe a) -> Migration
- migrationTo1 :: Typeable t => (forall a b. (Typeable a, Typeable b) => t b -> a -> Maybe (t b)) -> Migration
Documentation
Migration | |
|
runSafeMigration :: (Data a, Data b) => Migration -> a -> b -> a Source #
Run a migration and insert the new initial state in case of failure.
castMigration :: Migration Source #
Try to migrate by casting the first type into the second
newtypeMigration :: Migration Source #
Migrate a value into a newtype wrapping
userMigration :: (Typeable c, Typeable d) => (c -> d) -> Migration Source #
If you have a specific type that you would like to be migrated to a specific other type,
you can create a migration for this.
For example: userMigration (toInteger :: Int -> Integer)
migrationTo2 :: Typeable t => (forall a b c. (Typeable a, Typeable b, Typeable c) => t b c -> a -> Maybe (t b c)) -> Migration Source #