vimeta 0.2.4.0 → 0.2.5.0
raw patch · 5 files changed
+31/−25 lines, 5 filesdep ~aesondep ~containersdep ~temporary
Dependency ranges changed: aeson, containers, temporary, yaml
Files
- CHANGES.md +6/−0
- src/Vimeta/Core/Config.hs +9/−9
- src/Vimeta/Core/Vimeta.hs +8/−8
- src/Vimeta/UI/CommandLine/Config.hs +3/−3
- vimeta.cabal +5/−5
CHANGES.md view
@@ -1,5 +1,11 @@ # Version History +## 0.2.5.0 (October 09, 2018)++ - Update dependency versions++ - Replace `EitherT` with `ExceptT`+ ## 0.2.4.0 (March 20, 2018) - Update dependency versions
src/Vimeta/Core/Config.hs view
@@ -25,9 +25,9 @@ -- Library imports: import Control.Applicative import Control.Monad-import Control.Monad.IO.Class-import Control.Monad.Trans.Either-import Data.Aeson+import Control.Monad.Except+import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Aeson hiding (encodeFile) import Data.Aeson.Types (typeMismatch) import Data.Text (Text) import Data.Yaml (decodeFileEither, encodeFile)@@ -92,20 +92,20 @@ -------------------------------------------------------------------------------- -- | Read the configuration file and return a 'Config' value or an error.-readConfig :: (MonadIO m) => EitherT String m Config+readConfig :: (MonadIO m) => ExceptT String m Config readConfig = do filename <- liftIO configFileName exists <- liftIO (doesFileExist filename) if exists then decodeConfig filename- else left $ missingFile filename+ else throwError $ missingFile filename where- decodeConfig :: (MonadIO m) => FilePath -> EitherT String m Config+ decodeConfig :: (MonadIO m) => FilePath -> ExceptT String m Config decodeConfig fn = do result <- liftIO $ decodeFileEither fn case result of- Left e -> left (show e)+ Left e -> throwError (show e) Right a -> return a missingFile :: FilePath -> String@@ -113,14 +113,14 @@ "to create " ++ fn ---------------------------------------------------------------------------------writeConfig :: (MonadIO m) => Config -> EitherT String m FilePath+writeConfig :: (MonadIO m) => Config -> ExceptT String m FilePath writeConfig c = do (filename, exists) <- liftIO $ do fn <- configFileName ex <- doesFileExist fn return (fn, ex) - when exists $ left (existError filename)+ when exists $ throwError (existError filename) liftIO (createDirectoryIfMissing True (takeDirectory filename)) liftIO (encodeFile filename c)
src/Vimeta/Core/Vimeta.hs view
@@ -33,8 +33,8 @@ -- Library imports: import Control.Applicative import Control.Exception+import Control.Monad.Except import Control.Monad.Reader-import Control.Monad.Trans.Either import Data.Text (Text) import qualified Data.Text.IO as Text import Network.API.TheMovieDB (TheMovieDB, Key, runTheMovieDBWithManager)@@ -64,13 +64,13 @@ -------------------------------------------------------------------------------- newtype Vimeta m a =- Vimeta {unV :: ReaderT Context (EitherT String m) a}+ Vimeta {unV :: ReaderT Context (ExceptT String m) a} deriving (Functor, Applicative, Monad, MonadIO, MonadReader Context) -------------------------------------------------------------------------------- -- | Terminate a 'Vimeta' session with an error message. die :: (Monad m) => String -> Vimeta m a-die message = Vimeta $ lift (left message)+die message = Vimeta $ lift (throwError message) -------------------------------------------------------------------------------- runIO :: (MonadIO m) => IO a -> Vimeta m a@@ -109,12 +109,12 @@ when okay $ liftIO $ Text.hPutStrLn (ctxVerboseH context) msg ---------------------------------------------------------------------------------loadTMDBConfig :: (MonadIO m) => Manager -> Key -> EitherT String m TheMovieDB.Configuration+loadTMDBConfig :: (MonadIO m) => Manager -> Key -> ExceptT String m TheMovieDB.Configuration loadTMDBConfig manager key = do result <- cacheTMDBConfig (liftIO $ runTheMovieDBWithManager manager key TheMovieDB.config) case result of- Left e -> left (show e)+ Left e -> throwError (show e) Right c -> return c --------------------------------------------------------------------------------@@ -125,7 +125,7 @@ -> Vimeta m a -> m (Either String a) execVimetaWithContext context vimeta =- runEitherT $ runReaderT (unV vimeta) context+ runExceptT $ runReaderT (unV vimeta) context -------------------------------------------------------------------------------- -- | Run a 'Vimeta' operation after loading the configuration file@@ -134,11 +134,11 @@ => (Config -> Config) -- ^ Modify configuration before running. -> Vimeta m a -- ^ The Vimeta value to execute. -> m (Either String a) -- ^ The result.-execVimeta cf vimeta = runEitherT $ do+execVimeta cf vimeta = runExceptT $ do config <- cf <$> readConfig manager <- liftIO $ newManager tlsManagerSettings tc <- loadTMDBConfig manager (configTMDBKey config)- EitherT $ execVimetaWithContext (Context manager config tc stdout) vimeta+ ExceptT $ execVimetaWithContext (Context manager config tc stdout) vimeta -------------------------------------------------------------------------------- -- | Simple wrapper around 'execVimeta'.
src/Vimeta/UI/CommandLine/Config.hs view
@@ -20,7 +20,7 @@ -------------------------------------------------------------------------------- import Control.Monad-import Control.Monad.Trans.Either+import Control.Monad.Except import Data.Monoid import Data.Text (Text) import qualified Data.Text as Text@@ -62,7 +62,7 @@ Nothing -> def Just k -> def {configTMDBKey = k} - result <- runEitherT (app opts config)+ result <- runExceptT (app opts config) case result of Left e -> byline Error e >> exitFailure@@ -74,7 +74,7 @@ byline rt = void . runByline . reportLn rt . text . Text.pack ---------------------------------------------------------------------------------app :: Options -> Config -> EitherT String IO (Maybe String)+app :: Options -> Config -> ExceptT String IO (Maybe String) app opts config = do filename <- writeConfig config
vimeta.cabal view
@@ -1,6 +1,6 @@ -------------------------------------------------------------------------------- name: vimeta-version: 0.2.4.0+version: 0.2.5.0 synopsis: Frontend for video metadata tagging tools homepage: http://github.com/pjones/vimeta bug-reports: http://github.com/pjones/vimeta/issues@@ -70,10 +70,10 @@ ghc-options: -Werror build-depends: base >= 4.6 && < 5.0- , aeson >= 0.8 && < 1.4+ , aeson >= 0.8 && < 1.5 , byline >= 0.1 && < 1.0 , bytestring >= 0.10 && < 0.11- , containers >= 0.5 && < 0.6+ , containers >= 0.5 && < 0.7 , directory >= 1.2 && < 1.4 , either >= 4.3 && < 6 , filepath >= 1.3 && < 1.5@@ -85,14 +85,14 @@ , optparse-applicative >= 0.11 && < 0.15 , parsec >= 3.1 && < 3.2 , process >= 1.1 && < 1.7- , temporary >= 1.1 && < 1.3+ , temporary >= 1.1 && < 1.4 , text >= 0.11 && < 1.3 , themoviedb >= 1.1 && < 1.2 , time >= 1.2 && < 1.10 , time-locale-compat >= 0.1 && < 0.2 , transformers >= 0.3 && < 0.6 , xdg-basedir >= 0.2 && < 0.3- , yaml >= 0.8 && < 0.9+ , yaml >= 0.8 && < 0.10 -------------------------------------------------------------------------------- executable vimeta