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

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Jun 23 10:34:17 EDT 2009


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 filepath refer to a directory" not "is this  
> > filename a
> > directory". The latter could be a function:
> >
> > isDirectory :: FileInfo -> Bool
> >
> > along with a hypothetical
> >
> > getFileInfo :: FilePath -> IO FileInfo
> 
> Hypothetical?
> 
>  > import System.Posix.Files (getFileStatus, isDirectory)

Yeah, if we could make a standard portable variant of this, that'd be
great.

Duncan



More information about the Haskell-Cafe mailing list