Copyright | This file is part of the package vimeta. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at: https://github.com/pjones/vimeta No part of this package including this file may be copied modified propagated or distributed except according to the terms contained in the LICENSE file. |
---|---|
License | BSD-2-Clause |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- class Monad m => MonadIO (m :: Type -> Type)
- throwError :: MonadError e m => e -> m a
- type FormatTable = Map Char (Maybe Text)
- fromFormatString :: FormatTable -> String -> Text -> Either String Text
- formatFullDate :: Maybe Day -> Maybe Text
- formatYear :: Maybe Day -> Maybe Text
- data Tagger = AtomicParsley
- formatStringsForTagger :: Tagger -> (Text, Text)
- data Config = Config {}
- defaultConfig :: Tagger -> Config
- configFileName :: IO FilePath
- readConfig :: MonadIO m => ExceptT String m Config
- writeConfig :: MonadIO m => Config -> ExceptT String m FilePath
- data Vimeta m a
- data Context = Context {}
- runIO :: MonadIO m => IO a -> Vimeta m a
- runIOE :: MonadIO m => IO (Either String a) -> Vimeta m a
- tmdb :: MonadIO m => TheMovieDB a -> Vimeta m a
- verbose :: MonadIO m => Text -> Vimeta m ()
- execVimetaWithContext :: (MonadIO m, MonadMask m) => Context -> Vimeta m a -> m (Either String a)
- execVimeta :: (MonadIO m, MonadMask m) => (Config -> Config) -> Vimeta m a -> m (Either String a)
- runVimeta :: (MonadIO m, MonadMask m) => Vimeta m a -> m (Either String a)
- tagFile :: Text -> Vimeta IO ()
- parseMappingFile :: MonadIO m => FilePath -> Parser a -> Vimeta m [(FilePath, a)]
- withArtwork :: MonadIO m => [Text] -> (Maybe FilePath -> Vimeta IO a) -> Vimeta m a
- withDownload :: MonadIO m => Maybe Text -> (Maybe FilePath -> Vimeta IO a) -> Vimeta m a
Documentation
class Monad m => MonadIO (m :: Type -> Type) #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Instances
throwError :: MonadError e m => e -> m a #
Is used within a monadic computation to begin exception processing.
type FormatTable = Map Char (Maybe Text) Source #
Mapping of format characters to their possible replacement text.
:: FormatTable | Format character mapping. |
-> String | Name of format string. |
-> Text | Input text. |
-> Either String Text | Output text or error. |
Replace format characters prefixed with a %
with the
replacement text found in the given Map
.
Vimeta configuration.
Config | |
|
defaultConfig :: Tagger -> Config Source #
configFileName :: IO FilePath Source #
Get the name of the configuration file.
readConfig :: MonadIO m => ExceptT String m Config Source #
Read the configuration file and return a Config
value or an error.
Instances
MonadReader Context (Vimeta m) Source # | |
Monad m => MonadError String (Vimeta m) Source # | |
Defined in Vimeta.Core.Vimeta throwError :: String -> Vimeta m a # catchError :: Vimeta m a -> (String -> Vimeta m a) -> Vimeta m a # | |
Monad (Vimeta m) Source # | |
Functor (Vimeta m) Source # | |
Applicative (Vimeta m) Source # | |
MonadIO m => MonadIO (Vimeta m) Source # | |
Defined in Vimeta.Core.Vimeta | |
MonadByline (Vimeta m) Source # | |
Defined in Vimeta.Core.Vimeta liftByline :: F PrimF a -> Vimeta m a |
Context | |
|
execVimetaWithContext :: (MonadIO m, MonadMask m) => Context -> Vimeta m a -> m (Either String a) Source #
:: (MonadIO m, MonadMask m) | |
=> (Config -> Config) | Modify configuration before running. |
-> Vimeta m a | The Vimeta value to execute. |
-> m (Either String a) | The result. |
Run a Vimeta
operation after loading the configuration file
from disk.
runVimeta :: (MonadIO m, MonadMask m) => Vimeta m a -> m (Either String a) Source #
Simple wrapper around execVimeta
.
:: MonadIO m | |
=> FilePath | File name for the mapping file. |
-> Parser a | Parser for the second column. |
-> Vimeta m [(FilePath, a)] |
Parse a mapping file.
withArtwork :: MonadIO m => [Text] -> (Maybe FilePath -> Vimeta IO a) -> Vimeta m a Source #
Try to download artwork and run the given function. The
function will be passed a FilePath
if the artwork was downloaded.
See the withDownload
function for more details.
:: MonadIO m | |
=> Maybe Text | URL. |
-> (Maybe FilePath -> Vimeta IO a) | Function to call and pass the file name to. |
-> Vimeta m a | Result of above function. |
Download the given URL to a temporary file and pass the file name to the given function.
The reason a function needs to be passed to withDownload
is the
result of using withSystemTempFile
to store the downloaded file.
The file will be automatically removed after the given function
completes.