citation-resolve- convert document IDs such as DOI, ISBN, arXiv ID to bibliographic reference.

Safe HaskellNone



This modules provides a way to convert document identifiers, such as DOIs, ISBNs, arXiv IDs to bibliographic references.

Each type of identifiers will be converted via internet services to a bibliographic record of type Reference , which in turn can be rendered in various format using citeproc-hs package .

Moreover, the server responses are cached in a local database, making the server load as little as possible.



resolveEither :: forall m. (MonadIO m, MonadState DB m) => String -> EitherT String m ReferenceSource

resolve a document url to a Reference, or emits a error message with reason why it fails.

resolve :: (MonadIO m, MonadState DB m) => String -> m ReferenceSource

Resolve a document url to a Reference. returns an empty reference when someting fails. prefix the document ID with one of arXiv:, doi:, bibcode: or isbn: .

>>> do { ref <- resolveDef "arXiv:1204.4779" ; putStrLn $ title ref }
Paraiso: an automated tuning framework for explicit solvers of partial differential equations
>>> do { ref <- resolveDef "doi:10.1088/1749-4699/5/1/015003" ; print $ author ref }
[Takayuki Muranushi]
>>> do { ref <- resolveDef "bibcode:2012CS&D....5a5003M" ; putStrLn $ containerTitle ref }
Computational Science and Discovery
>>> do { ref <- resolveDef "isbn:9784274068850" ; putStrLn $ title ref }
Sugoi hasukeru tanoshiku manabō

withDBFile :: (MonadIO m, MonadState DB m) => FilePath -> m a -> m aSource

newtype DB Source

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 DB, rather than Reference.




unDB :: Map String String


db :: Simple Iso DB (Map String String)Source

The lens for accessing the map within the DB.