-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Define Backwards Compatibility Schemes for Arbitrary Data
--
-- Define Backwards Compatibility Schemes for Arbitrary Data
@package data-compat
@version 0.1.0.2
-- | See http://programmable.computer/compatible.html for a full
-- exposition and worked examples.
module Data.Compat
-- | A class for backwards-compatible data.
class Compat a where {
-- | The predecessor for this type, i.e. the type for the data schema
-- directly preceeding a.
type family Pred a :: *;
-- | Any additional constraints required to yield data values. Typically
-- this will be a class that provides a parser.
type family CompatConstraint a :: * -> Constraint;
-- | A type for wrapping migration results. It is most useful if this type
-- has Alternative and Monad instances, enabling the use of
-- getCompatible. Maybe is a good first choice.
type family CompatF a :: * -> *;
}
-- | How to migrate from a value of the preceeding schema to the current
-- schema.
migrate :: Compat a => Pred a -> CompatF a a
continue :: Compat a => Proxy a -> Maybe (Dict (Compat (Pred a), CompatConstraint a (Pred a), CompatConstraint a ~ CompatConstraint (Pred a), CompatF a ~ CompatF (Pred a)))
-- | Recursively migrate a data value to the most recent schema, if
-- possible.
getCompatible :: forall a. (Compat a, CompatConstraint a a, Alternative (CompatF a), Monad (CompatF a)) => (forall c. (Compat c, CompatConstraint a c) => CompatF a c) -> CompatF a a