kit 0.7.1 → 0.7.2
raw patch · 5 files changed
+16/−6 lines, 5 files
Files
- Kit/Commands.hs +9/−2
- Kit/Dependency.hs +1/−0
- Kit/Main.hs +4/−2
- Kit/Spec.hs +1/−1
- kit.cabal +1/−1
Kit/Commands.hs view
@@ -19,16 +19,23 @@ import Control.Monad.Error import Control.Monad.Reader -newtype Command a = Command (ReaderT (WorkingCopy, KitRepository) (ErrorT String IO) a) deriving (Monad, Functor, Applicative)+newtype Command a = Command { unCommand :: (ReaderT (WorkingCopy, KitRepository) (ErrorT String IO) a) } deriving Monad instance MonadIO Command where liftIO a = Command $ liftIO a +instance Functor Command where+ fmap f v = Command $ fmap f (unCommand v)++instance Applicative Command where+ pure = Command . pure+ f <*> v = Command $ (unCommand f) <*> (unCommand v)+ liftKit :: KitIO a -> Command a liftKit = Command . ReaderT . const mySpec :: Command KitSpec-mySpec = fmap workingKitSpec myWorkingCopy+mySpec = Command $ fmap workingKitSpec (unCommand myWorkingCopy) myWorkingCopy :: Command WorkingCopy myWorkingCopy = Command $ fmap fst ask
Kit/Dependency.hs view
@@ -17,6 +17,7 @@ data Dependency = Dep KitSpec | Dev KitSpec FilePath deriving (Eq, Show) +depSpec :: Dependency -> KitSpec depSpec (Dep k) = k depSpec (Dev k _) = k
Kit/Main.hs view
@@ -16,12 +16,14 @@ import Data.List (partition) import Kit.Repository (unpackKit, packagesDirectory, publishLocally) + f2 :: KitSpec -> Command KitContents f2 spec = do base <- liftIO $ canonicalizePath devKitDir readKitContents' base packageName spec - f1 packagesDirectory spec = do- base <- liftIO $ canonicalizePath packagesDirectory+ f1 :: FilePath -> KitSpec -> Command KitContents + f1 pkgDir spec = do+ base <- liftIO $ canonicalizePath pkgDir readKitContents' base packageFileName spec doUpdate :: Command ()
Kit/Spec.hs view
@@ -23,7 +23,6 @@ import qualified Data.ByteString as BS import qualified Data.Object.Yaml as Y import Data.Maybe (maybeToList)- import Control.Arrow ((&&&)) data KitSpec = KitSpec { specKit :: Kit,@@ -82,6 +81,7 @@ instance ReadObject Kit where readObject x = fromMapping x >>= \obj -> (Kit <$> obj #> "name" <*> obj #> "version") <|> case obj of [(key, Scalar value)] -> Just $ Kit key value+ _ -> Nothing -- TODO this + ReadObject should be identity -- TODO don't write out default values instance ShowObject KitSpec where
kit.cabal view
@@ -1,5 +1,5 @@ name: kit-version: 0.7.1+version: 0.7.2 cabal-version: >=1.2 build-type: Simple license: BSD3