Ketil Malde wrote: > Bertram Felgenhauer wrote: > >>> type Subject = String > >>> data Email = Email {from :: From, subject :: Subject} deriving Show > >data Email = Email {from :: !From, subject :: !Subject} deriving Show > ...except that From and Subject are Strings, and thus the strictness > annotation only forces WHNF. I.e., you also need to modify parseEmail > to force these. > > -k
You're right. Actually, the program will be strict enough if the From header always precedes the Subject header (which was the case in my tests), but that's not immediately obvious. Modifying getHeader to force its result is the clean solution, say: getHeader = forceString . fromMaybe "N/A" . flip lookup headers forceString s = length s `seq` s Having to rely on GC to close the fds quickly enough is another problem; can this be solved on the library side, maybe by performing GCs when running out of FDs? Bertram _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe