Support for multiproject builds with nix

- Closes #28
This commit is contained in:
2018-08-29 22:43:44 +03:00
parent d792cb2a81
commit 6865af361d
30 changed files with 199 additions and 15 deletions

View File

@ -0,0 +1,23 @@
{-# Language NoImplicitPrelude #-}
{-# Language DeriveGeneric #-}
{-# Language DuplicateRecordFields #-}
module Configuration where
import ClassyPrelude
import Dhall (Interpret)
data Pg = Pg { username :: Text
, password :: Text
, host :: Text
, database :: Text }
deriving (Show, Generic)
newtype Store = Store { path :: Text } deriving (Show, Generic)
data Config = Config { database :: Pg
, store :: Store }
deriving (Show, Generic)
instance Interpret Pg
instance Interpret Store
instance Interpret Config

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