[Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-21 Thread Colin Paul Adams
I've been hoogling like bad to try to determine if a function like this exists. getDirectoryContents returns sub-directories as well as file names. I want only the latter, so I'm looking for a suitable filter. -- Colin Adams Preston Lancashire ___ Haske

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-21 Thread Judah Jacobson
On Sun, Jun 21, 2009 at 11:12 PM, Colin Paul Adams wrote: > I've been hoogling like bad to try to determine if a function like > this exists. > > getDirectoryContents returns sub-directories as well as file names. I > want only the latter, so I'm looking for a suitable filter. Use System.Directory

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-21 Thread Erik de Castro Lopo
Colin Paul Adams wrote: > I've been hoogling like bad to try to determine if a function like > this exists. > > getDirectoryContents returns sub-directories as well as file names. I > want only the latter, so I'm looking for a suitable filter. The first example in this chapter of Real World Hask

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-21 Thread Bulat Ziganshin
Hello Colin, Monday, June 22, 2009, 10:12:57 AM, you wrote: > I've been hoogling like bad to try to determine if a function like > this exists. > getDirectoryContents returns sub-directories as well as file names. I > want only the latter, so I'm looking for a suitable filter. isdir <- withFile

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-21 Thread Colin Paul Adams
> "Judah" == Judah Jacobson writes: Judah> On Sun, Jun 21, 2009 at 11:12 PM, Colin Paul Judah> Adams wrote: >> I've been hoogling like bad to try to determine if a function >> like this exists. >> >> getDirectoryContents returns sub-directories as well as file >>

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-21 Thread Deniz Dogan
2009/6/22 Colin Paul Adams : >> "Judah" == Judah Jacobson writes: > >    Judah> On Sun, Jun 21, 2009 at 11:12 PM, Colin Paul >    Judah> Adams wrote: >    >> I've been hoogling like bad to try to determine if a function >    >> like this exists. >    >> >    >> getDirectoryContents returns sub

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-22 Thread Duncan Coutts
On Mon, 2009-06-22 at 08:53 +0200, Deniz Dogan wrote: > 2009/6/22 Colin Paul Adams : > >> "Judah" == Judah Jacobson writes: > > > >Judah> On Sun, Jun 21, 2009 at 11:12 PM, Colin Paul > >Judah> Adams wrote: > >>> I've been hoogling like bad to try to determine if a function > >>

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-22 Thread Deniz Dogan
2009/6/22 Duncan Coutts : > On Mon, 2009-06-22 at 08:53 +0200, Deniz Dogan wrote: >> 2009/6/22 Colin Paul Adams : >> >> "Judah" == Judah Jacobson writes: >> > >> >    Judah> On Sun, Jun 21, 2009 at 11:12 PM, Colin Paul >> >    Judah> Adams wrote: >> >    >> I've been hoogling like bad to try t

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-22 Thread Max Rabkin
On Mon, Jun 22, 2009 at 2:09 PM, Deniz Dogan wrote: > I think see what you mean, but I find the argument more of an excuse > to the poor naming than a solid argument for it. Following the > convention and intuition that most users have should be more important > than making the (sometimes unnecessa

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-22 Thread Deniz Dogan
2009/6/22 Max Rabkin : > On Mon, Jun 22, 2009 at 2:09 PM, Deniz Dogan wrote: >> I think see what you mean, but I find the argument more of an excuse >> to the poor naming than a solid argument for it. Following the >> convention and intuition that most users have should be more important >> than ma

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-22 Thread Ketil Malde
Deniz Dogan writes: >> One explanation is that isBlah asks "is this thing a blah", but we're >> not asking that because there is an indirection via the filepath. We're >> asking "does this filepath refer to a directory" not "is this filename a >> directory". > I think see what you mean, but I fi

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-22 Thread Max Rabkin
On Mon, Jun 22, 2009 at 2:54 PM, Deniz Dogan wrote: > Are you saying that when a function is named "isDirectory" you expect > it to only check for a trailing forward slash character? No. I'm saying that *if* isDirectory existed, then (isDirectory "/no/such/directory/") should equal true on Unix. I

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-23 Thread Brandon S. Allbery KF8NH
On Jun 22, 2009, at 07:37 , Duncan Coutts wrote: One explanation is that isBlah asks "is this thing a blah", but we're not asking that because there is an indirection via the filepath. We're asking "does this filepath refer to a directory" not "is this filename a directory". The latter could

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-23 Thread Duncan Coutts
On Tue, 2009-06-23 at 09:31 -0400, Brandon S. Allbery KF8NH wrote: > On Jun 22, 2009, at 07:37 , Duncan Coutts wrote: > > One explanation is that isBlah asks "is this thing a blah", but we're > > not asking that because there is an indirection via the filepath. > > We're > > asking "does this fil

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-23 Thread Brandon S. Allbery KF8NH
On Jun 23, 2009, at 10:34 , Duncan Coutts wrote: On Tue, 2009-06-23 at 09:31 -0400, Brandon S. Allbery KF8NH wrote: Hypothetical? import System.Posix.Files (getFileStatus, isDirectory) Yeah, if we could make a standard portable variant of this, that'd be great. I've wanted to do that ever

Re[2]: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-23 Thread Bulat Ziganshin
Hello Duncan, Tuesday, June 23, 2009, 6:34:17 PM, you wrote: >> > import System.Posix.Files (getFileStatus, isDirectory) > Yeah, if we could make a standard portable variant of this, that'd be > great. isdir <- withFileStatus "isdir?" filename isDirectory module System.Directory withFileSt