Commit 01a6bf1e authored by Alexandre Delanoë's avatar Alexandre Delanoë

[API] change function name.

parent b9b75032
......@@ -2,8 +2,8 @@
module Main where
import PUBMED (crawler)
import PUBMED (getMetadataWith)
main :: IO ()
main = crawler "bisphenol" (Just 1000000) >>= print
main = getMetadataWith "bisphenol" (Just 1000000) >>= print
-- This file has been generated from package.yaml by hpack version 0.28.2.
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.31.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: 580738bee1b100e9a792dbb063ed94632428cf9c69f8ea4889aba5e65415e2fe
-- hash: 4bb73f43a66d509480c9a672fe457ad8be7cb2d27c8b0892e234b8ac088a2a44
name: crawlerPubMed
version: 0.1.0.0
......@@ -15,10 +17,9 @@ copyright: 2019 CNRS/IMT
license: BSD3
license-file: LICENSE
build-type: Simple
cabal-version: >= 1.10
extra-source-files:
ChangeLog.md
README.md
ChangeLog.md
source-repository head
type: git
......
......@@ -25,6 +25,10 @@ import qualified Data.ByteString.Lazy as LBS
import qualified Data.ByteString as DB
import qualified Data.Text as T
-- | API main function
getMetadataWith :: Text -> Maybe Limit -> IO (Either Text [PubMed])
getMetadataWith = runSimpleFindPubmedAbstractRequest
runParser :: Show res => (Cursor -> res) -> LBS.ByteString -> res
runParser parser = parser . fromDocument . parseLBS_ def
......@@ -78,9 +82,6 @@ runSimpleFetchPubmedAbstractRequest ids = do
pure []) :: XmlException -> IO [PubMed])
Right <$> pure parsed
crawler :: Text -> Maybe Limit -> IO (Either Text [PubMed])
crawler = runSimpleFindPubmedAbstractRequest
runSimpleFindPubmedAbstractRequest :: Text -> Maybe Limit -> IO (Either Text [PubMed])
runSimpleFindPubmedAbstractRequest query limit = do
manager' <- newManager tlsManagerSettings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment