packages feed

DataVersion 0.1.0.0 → 0.1.0.1

raw patch · 3 files changed

+83/−13 lines, 3 filesdep ~generic-lensdep ~microlensPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: generic-lens, microlens

API changes (from Hackage documentation)

+ Data.Migration.Internal: type Function ts src dst :: Type;
- Data.Migration.Internal: class GUndefinedFields (o :: * -> *)
+ Data.Migration.Internal: class GUndefinedFields (o :: Type -> Type)
- Data.Migration.Internal: type family Function ts src dst :: Type;
+ Data.Migration.Internal: type family FieldDiffImpl (b :: Ordering) (x :: (Symbol, Type)) (y :: (Symbol, Type)) (xs :: [(Symbol, Type)]) (ys :: [(Symbol, Type)]) :: [DiffResult]

Files

DataVersion.cabal view
@@ -1,18 +1,16 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.2.+-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack------ hash: 21c291662b767b5c5923f5b8dd4a621d30578be2dae431d97c7dd06383954ec5  name:           DataVersion-version:        0.1.0.0+version:        0.1.0.1 synopsis:       Type safe data migrations-description:    Please see the README on GitHub at <https://github.com/agentultra/DataMigration#readme>+description:    Please see the README on GitHub at <https://github.com/agentultra/DataVersion#readme> category:       Data-homepage:       https://github.com/agentultra/DataMigration#readme-bug-reports:    https://github.com/agentultra/DataMigration/issues+homepage:       https://github.com/agentultra/DataVersion#readme+bug-reports:    https://github.com/agentultra/DataVersion/issues author:         Sandy Maguire, James King maintainer:     james@agentultra.com copyright:      2019 Sandy Maguire, James King@@ -25,7 +23,7 @@  source-repository head   type: git-  location: https://github.com/agentultra/DataMigration+  location: https://github.com/agentultra/DataVersion  library   exposed-modules:@@ -35,11 +33,27 @@       Paths_DataVersion   hs-source-dirs:       src-  default-extensions: DataKinds TypeFamilies QuantifiedConstraints DeriveGeneric MultiParamTypeClasses FlexibleContexts FlexibleInstances PolyKinds AllowAmbiguousTypes DuplicateRecordFields FunctionalDependencies GeneralizedNewtypeDeriving ScopedTypeVariables TypeApplications TypeOperators UndecidableInstances+  default-extensions:+      DataKinds+      TypeFamilies+      QuantifiedConstraints+      DeriveGeneric+      MultiParamTypeClasses+      FlexibleContexts+      FlexibleInstances+      PolyKinds+      AllowAmbiguousTypes+      DuplicateRecordFields+      FunctionalDependencies+      GeneralizedNewtypeDeriving+      ScopedTypeVariables+      TypeApplications+      TypeOperators+      UndecidableInstances   build-depends:       base >=4.7 && <5-    , generic-lens >=1.1.0.0 && <2-    , microlens >=0.4.10 && <2+    , generic-lens+    , microlens   default-language: Haskell2010  test-suite DataVersion-test@@ -49,7 +63,23 @@       Paths_DataVersion   hs-source-dirs:       test-  default-extensions: DataKinds TypeFamilies QuantifiedConstraints DeriveGeneric MultiParamTypeClasses FlexibleContexts FlexibleInstances PolyKinds AllowAmbiguousTypes DuplicateRecordFields FunctionalDependencies GeneralizedNewtypeDeriving ScopedTypeVariables TypeApplications TypeOperators UndecidableInstances+  default-extensions:+      DataKinds+      TypeFamilies+      QuantifiedConstraints+      DeriveGeneric+      MultiParamTypeClasses+      FlexibleContexts+      FlexibleInstances+      PolyKinds+      AllowAmbiguousTypes+      DuplicateRecordFields+      FunctionalDependencies+      GeneralizedNewtypeDeriving+      ScopedTypeVariables+      TypeApplications+      TypeOperators+      UndecidableInstances   ghc-options: -threaded -rtsopts -with-rtsopts=-N   build-depends:       DataVersion
README.md view
@@ -1,5 +1,7 @@ # DataMigration +[![Hackage](https://img.shields.io/hackage/v/DataVersion.svg?logo=haskell&label=DataVersion)](https://hackage.haskell.org/package/DataVersion)+ Type safe data migrations.  All you need to do is create a type family to index your record and@@ -8,6 +10,44 @@  Migrations are type-safe and the library uses generics to remove as much boiler-plate as possible.++## Examples++```haskell+data family Foo (version :: Nat)++newtype MyString = MyString { unMyString :: String }+   deriving (IsString, Show, Eq)++data instance Foo 0+  = FooV0+    { _fooId :: Int+    , _fooName :: String+    }+  deriving (Generic, Show, Eq)++data instance Foo 1+  = FooV1+  { _fooId        :: Int+  , _fooName      :: MyString+  , _fooHonorific :: String+  }+  deriving (Generic, Show, Eq)++instance Transform Foo 0 where+  up   v = genericUp   v (const "esquire") (const MyString)+  down v = genericDown v (const unMyString)+++spjV0 :: Foo 0+spjV0 = FooV0 1 "Simon PJ"+++spjV1 :: Foo 1+spjV1 = up spjV0++-- spjV1 = FooV1 1 (MyString "Simon PJ") "esquire"+```  ## Future Considerations 
src/Data/Migration/Internal.hs view
@@ -88,7 +88,7 @@   type Function ('Change name ti to ': ts) src dst  = (src -> ti -> to) -> Function ts src dst   gTransform dst src mk_to = gTransform @ts (dst & field' @name .~ mk_to src (src ^. field' @name)) src -class GUndefinedFields (o :: * -> *) where+class GUndefinedFields (o :: Type -> Type) where   gUndefinedFields :: o x  instance GUndefinedFields o => GUndefinedFields (M1 _3 _4 o) where