Commit a9d8e08a authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] bug in number of returned document (Right a <> Right b = Right a insead of Right (a <> b))

parent 4cf5fa03
......@@ -24,6 +24,7 @@ import Data.Attoparsec.ByteString.Char8 (anyChar)
import qualified Data.ByteString.Lazy as LBS
import qualified Data.ByteString as DB
import qualified Data.Text as T
import qualified Data.List as List
-- | API main function
getMetadataWith :: Text -> Maybe Limit -> IO (Either Text [PubMed])
......@@ -56,11 +57,16 @@ type Limit = Integer
runMultipleFPAR :: [Integer]
-> IO (Either Text [PubMed])
runMultipleFPAR ids
| length ids < 300 = runSimpleFetchPubmedAbstractRequest ids
| otherwise = do
runSimpleFetchPubmedAbstractRequest (Prelude.take 300 ids)
<> runMultipleFPAR (drop 300 ids)
runMultipleFPAR ids = List.foldl1' concat'
<$> mapM runSimpleFetchPubmedAbstractRequest (by 300 ids)
where
by _ [] = []
by n ns = head' : ( by n tail')
where
(head',tail') = List.splitAt n ns
concat' (Right n) (Right m) = Right $ n <> m
concat' n m = n <> m
runSimpleFetchPubmedAbstractRequest ::
[Integer]
......
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