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