[Haskell-cafe] Abstracted File Library?

Marc Weber marco-oweber at gmx.de
Mon Apr 26 23:15:00 EDT 2010


Excerpts from Kazu Yamamoto (山本和彦)'s message of Tue Apr 27 04:59:46 +0200 2010:
> Hello,
> 
> I'm implementing a command which manipulates files both on Unix/Mac
> and Windows. I was very surprised because there is not
> "getStatusChangeTime" function. So, I wrote it with CPP.
> 
>     http://github.com/kazu-yamamoto/Mew/blob/master/bin/hs/Stat.hs
> 
> Another problem is that since '\\' is used as the file separator of
> Windows, I cannot use regular expression naturally for file path. In

Clarify this, please. Used by who?
The user may enter \\ which is valid on Windows.

Both Cabal and filepath libraries do have functions operating on
filepath strings. Eg filepath can split them.

I agree that / is valid on Windows.

So before working on user input you have to sanitize paths
by replacing \\ by /

> Are there any abstracted file library to solve these problems?
> Or should I start to write such a library?

Which functions should this library have?

I'm pretty sure that filepath already has most functions you need.
You may want to patch it so that it's using / on Windows when assembling
paths form lists of directory names.

Marc Weber


More information about the Haskell-Cafe mailing list