Fuse two input-files with haskell conduit library

5 views
Skip to first unread message

kuj...@gmail.com

unread,
Mar 5, 2018, 7:20:29 AM3/5/18
to streaming-haskell
I asked that question on stackoverflow: https://stackoverflow.com/questions/48921393/fuse-two-input-files-with-haskell-conduit-library

Maybe someone could give me hint, how to get started: 


I'm trying to fuse two input files with conduit.

file1.dat:

META 1
META 2
META 3
TS 1
1
2
3
TS 2
3
4
5

file2.dat:

META 1
META 2
META 3
TS 1
0.1
0.0
0.3
TS 2
0.1
0.2
0.1

what I need is a function to source and fuse the input files, discard meta-data and merge on values in between TS-lines

sourceFiles :: FilePath -> FilePath -> ConduitM i (Double, Double) m ()
sourceFiles f1 f2 = undefined

Combination (e.g. +,-,*) would then look like

combine :: (Double -> Double-> Double) -> (Double, Double) -> Double
combine f (x,y) = f x y

I would be very grateful, if someone could give me a hint how to start with sourceFiles.

EDIT

As an output file of 'addition-combination' I would expect:

output.dat:

META 1 
META 2
META 3
TS 1
1.1
2.0
3.3
TS 2
3.1
4.2
5.1
Reply all
Reply to author
Forward
0 new messages