[Haskell-cafe] How to move files?

YueCompl compl.yue at icloud.com
Thu Apr 15 07:46:51 UTC 2021

> Catch that error, and copy-and-delete.

I suggest this is typical EAFP (Easier to ask for forgiveness than permission) coding style from Zen of Python
http://docs.python.org//glossary.html#term-eafp <http://docs.python.org//glossary.html#term-eafp>

I'm very curious to know how Haskellers think and do about it?

Is there something close to Zen of Haskell?

> On 2021-04-15, at 13:08, Donn Cave <donn at avvanta.com> wrote:
>>> I don't know how to detect whether two filepaths are in the same 
>>> filesystem.
> Yes you do!
>>> If I use System.Directory.renameFile and the final location is in 
>>> another filesystem, I'll get an error "renameFile:renamePath:rename: 
>>> unsupported operation (Invalid cross-device link)".
> And it follows that if you get no error, the two filepaths are in the
> same filesystem
>>> What's the best way to move the file if possible but copy-and-delete 
>>> if necessary?
> Catch that error, and copy-and-delete.
> 	Donn
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210415/e92f627d/attachment.html>

More information about the Haskell-Cafe mailing list