
21 May
2020
21 May
'20
7:03 a.m.
Do you mean it's ugly because of the nested withHdf4PathP? If so, have you considered ResourceT?
This is more about the complex signature of the function.
But I saw something else that seems more noteworthy. Why is withUhvPathP being used to repeatedly open and close the same files using the filenames contained in dif? (I suppose withHdf5PathP opens and closes HDF5 files.) Why don't you open the > files once in the beginning of your loop and close them at the end? You can do this by wrapping everything in a ResourceT and use allocate.
withHdf5Path already us the MonadSafe from pipes, so the resources are opened only once during the process. (once per thread, because I process chunk of the data, one per thread).