Hi, thanks for your comments.
Am Montag, den 30.06.2008, 16:54 -0700 schrieb Ryan Ingram: > 1) unsafeInterleaveIO seems like a big hammer to use for this problem, > and there are a lot of gotchas involved that you may not have fully > thought out. But you do meet the main criteria (file being read is > assumed to be constant for a single run of the program). Any other gotcha? Anyways, is this really worse than the similary lazy readFile? Using that would not safe the call to open, but at least the reading and processing, in the same situations. > If you have the ability to store metadata about the computation along > with the computation results, maybe that would be a better solution? Not sure what you mean here, sorry. Can you elaborate? > 2) I agree with Luke that this "smells" more like an applicative > functor. But getting to monad syntax is quite nice if you can do so. > As an applicative functor you would have "writeFileOD :: Filename -> > ODIO ByteString -> ODIO ()"; then writeFile can handle all the > necessary figuring out of timestamps itself, and you get the bonus > guarantee that the contents of the files read by the "ODIO ByteString" > argument won't affect the filename you are going to output to. I thought about this (without having the applicative abstraction in mind). This would then look like: main = do f1 <- readFileOD "infile1" f2 <- readFileOD "infile2" writeFileOD "outfile1" $ someFunc <$> f1 <*> f2 writeFileOD "outfile2" $ someOtherFunc <$> f1 right? Will it still work so that if both outfiles need to be generated, f1 is read only once? > 3) Instead of (Read,Show), look into Data.Binary instead, if you > actually care about efficiency. Parsing text at read time will almost > never be faster than just performing the computation on the source > data again. I assume it’s still faster than, e.g., running an external program to read the exif tags, but you are right, Data.Binary is nicer for this. Thanks, Joachim -- Joachim "nomeata" Breitner mail: [EMAIL PROTECTED] | ICQ# 74513189 | GPG-Key: 4743206C JID: [EMAIL PROTECTED] | http://www.joachim-breitner.de/ Debian Developer: [EMAIL PROTECTED]
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe