Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
c8d0773c
Commit
c8d0773c
authored
Mar 07, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[conduit] some more work on conduit in file parser (still doesn't compile)
parent
df392b7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
Parsers.hs
src/Gargantext/Core/Text/Corpus/Parsers.hs
+5
-4
No files found.
src/Gargantext/Core/Text/Corpus/Parsers.hs
View file @
c8d0773c
...
...
@@ -26,6 +26,7 @@ module Gargantext.Core.Text.Corpus.Parsers (FileFormat(..), clean, parseFile, cl
import
"zip"
Codec.Archive.Zip
(
withArchive
,
getEntry
,
getEntries
)
import
Conduit
import
Control.Concurrent.Async
as
CCA
(
mapConcurrently
)
import
Control.Monad.Identity
(
runIdentity
)
import
Data.Attoparsec.ByteString
(
parseOnly
,
Parser
)
import
Control.Monad
(
join
)
import
Data.Either
(
Either
(
..
))
...
...
@@ -80,20 +81,20 @@ data FileFormat = WOS | RIS | RisPresse
-- | XML -- Not Implemented / see :
parseFormatC
::
FileFormat
->
DB
.
ByteString
->
IO
(
Either
Prelude
.
String
(
ConduitT
()
HyperdataDocument
IO
()
))
parseFormatC
CsvGargV3
bs
=
pure
$
transPipe
(
\
d
->
d
)
<$>
parseCsvC
$
DBL
.
fromStrict
bs
parseFormatC
CsvHal
bs
=
pure
$
transPipe
pure
<$>
parseCsvC
$
DBL
.
fromStrict
bs
parseFormatC
CsvGargV3
bs
=
pure
$
transPipe
(
pure
.
runIdentity
)
<$>
(
parseCsvC
$
DBL
.
fromStrict
bs
)
parseFormatC
CsvHal
bs
=
pure
$
transPipe
(
pure
.
runIdentity
)
<$>
(
parseCsvC
$
DBL
.
fromStrict
bs
)
parseFormatC
RisPresse
bs
=
do
docs
<-
snd
<$>
enrichWith
RisPresse
$
partitionEithers
$
[
runParser'
RisPresse
bs
]
pure
$
Right
$
docs
.|
mapMC
(
toDoc
RIS
)
pure
$
(
\
docs'
->
yieldMany
docs'
.|
mapMC
(
toDoc
RIS
))
<$>
docs
parseFormatC
WOS
bs
=
do
docs
<-
snd
<$>
enrichWith
WOS
$
partitionEithers
$
[
runParser'
WOS
bs
]
pure
$
Right
$
docs
.|
mapMC
(
toDoc
WOS
)
pure
$
(
\
docs'
->
yieldMany
docs'
.|
mapMC
(
toDoc
WOS
))
<$>
docs
parseFormatC
ZIP
bs
=
do
path
<-
emptySystemTempFile
"parsed-zip"
DB
.
writeFile
path
bs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment