Start working on the (versioned) OPDS catalog

This commit is contained in:
2018-08-14 00:03:52 +03:00
parent 1a8646df46
commit 0333345aa3
7 changed files with 206 additions and 4 deletions

24
src/Data/Versioned.hs Normal file
View File

@ -0,0 +1,24 @@
{-# Language KindSignatures #-}
{-# Language DataKinds #-}
{-# Language DefaultSignatures #-}
{-# Language MultiParamTypeClasses #-}
{-# Language FunctionalDependencies #-}
module Data.Versioned where
import GHC.TypeLits
import ClassyPrelude
import Data.Generics.Product
newtype Versioned (v :: Nat) a = Versioned a deriving (Show)
instance Functor (Versioned v) where
fmap f (Versioned a) = Versioned (f a)
instance Applicative (Versioned v) where
pure = Versioned
(Versioned f) <*> (Versioned a) = Versioned (f a)
class Migrate a b | b -> a where
migrate :: a -> b
default migrate :: (Subtype b a) => a -> b
migrate = upcast