Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- migrate :: (Data a, Data b) => a -> b -> a
- migrateWith :: (Data a, Data b) => Migration -> a -> b -> a
- standardMigration :: Migration
- treeMigration :: Migration -> Migration
- matchingAlgebraicDataTypes :: (Data a, Data b) => a -> b -> Bool
- sameConstructorMigration :: Migration -> Migration
- constructorMigration :: Migration -> Migration
- tryOneField :: Data a => StateT [GenericR' Maybe] Maybe a
- getChildrenSetters :: Data a => Migration -> a -> [GenericT']
- newtype GenericR' m = GR {}
- getChildrenMaybe :: Data a => a -> [GenericR' Maybe]
- setChildren :: Data a => [GenericT'] -> a -> a

# Documentation

migrate :: (Data a, Data b) => a -> b -> a Source #

The standard migration solution, recursing into the data structure and applying `standardMigration`

.

migrateWith :: (Data a, Data b) => Migration -> a -> b -> a Source #

Still recurse into the data structure, but apply your own given migration.
Often you will want to call `migrateWith (standardMigration <> yourMigration)`

.

standardMigration :: Migration Source #

Covers standard cases such as matching types, to and from debuggers, to newtypes.

treeMigration :: Migration -> Migration Source #

The standard migration working horse. Tries to apply the given migration, and if this fails, tries to recurse into the data structure.

sameConstructorMigration :: Migration -> Migration Source #

Assuming that both are algebraic data types, possibly the constructor names match. In that case, we will try and recursively migrate as much data as possible onto the new constructor.

constructorMigration :: Migration -> Migration Source #

Still assuming that both are algebraic data types, but the constructor names don't match. In that case, we will try and recursively fill all the fields new constructor. If this doesn't work, fail.

setChildren :: Data a => [GenericT'] -> a -> a Source #