In general I have problems figuring out how to write tailrecursive functions when working 'inside' monads. Here is a quick example:
I have a very large text file (around 20 GB and 300 million lines), which contains three columns separated by tabs:
I was trying this and a few other things but it truncates the file each time:Changing this to open $file, :a also seems to truncate the file. This is 2018.04 on macOS.