Safe Haskell | None |
---|
- newtype Database = Database {}
- class HasDatabase t where
- withDatabaseFile :: (MonadIO m, MonadState s m, HasDatabase s) => FilePath -> m a -> m a
- type RM m a b = a -> EitherT String m b
- liftIOE :: MonadIO m => IO (Either a b) -> EitherT a m b
- resolveBibtex :: MonadIO m => String -> RM m String Reference
- resolveEither :: forall m s. (MonadIO m, MonadState s m, HasDatabase s) => String -> EitherT String m Reference
- resolveDOI :: MonadIO m => RM m String String
- resolveArXiv :: MonadIO m => RM m String String
- resolveBibcode :: MonadIO m => RM m String String
- resolveISBN :: MonadIO m => RM m String String
- getDataFileName :: String -> IO String
- stringReplace :: String -> String -> String -> String
Documentation
The data structure that carries the resolved references. Since
the mapping Reference -> BibTeX
is not the inverse of
BibTeX -> Reference
for the version citeproc-hs-0.3.8
and loses some
information, we choose to store the original BibTeX string in the Database,
rather than Reference
.
class HasDatabase t whereSource
The lens for accessing the map within the Database.
withDatabaseFile :: (MonadIO m, MonadState s m, HasDatabase s) => FilePath -> m a -> m aSource
Excecute the program using the given database file. The file will be created if it didn't exist.
type RM m a b = a -> EitherT String m bSource
Resolver Monad is a function that converts a key of type a
to some
other type b
, which may fail with an error message.
liftIOE :: MonadIO m => IO (Either a b) -> EitherT a m bSource
Perform possibly failing IO within a monad
resolveBibtex :: MonadIO m => String -> RM m String ReferenceSource
parse a Bibtex entry that contains single reference.
resolveEither :: forall m s. (MonadIO m, MonadState s m, HasDatabase s) => String -> EitherT String m ReferenceSource
resolve a document url to a Reference
, or emits a error
message with reason why it fails.
getDataFileName :: String -> IO StringSource
a safer way to get data file name.