[Haskell-cafe] Strange behaviour with writeFile

Udo Stenzel u.stenzel at web.de
Sun Feb 4 14:29:14 EST 2007


C.M.Brown wrote:
> I've found that:
> 
> let (answer2, remainder) = parseAnswer (force answer)
> 
> where
> 
> force  :: Eq a => a -> a
> force x = if x==x then x else x
> 
> Seems to do the trick.

...but I'd advise against using it.  If the power fails at the right
time, you're left with no file at all.  It's probably better to simply
write a new file and rename it over the old one at the end.  That is
safer and doesn't require you to jump through hoops.  If you can't
afford the disk space to do that, you want a full-blown database anyway.


-Udo
-- 
echo '[dO%O+38%O+PO/d0<0]Fi22os0CC4BA64E418CE7l0xAP'|dc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070204/c1280a04/attachment.bin


More information about the Haskell-Cafe mailing list