-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Stream directory entries in constant memory in vanilla IO
--   
--   Reading of directory contents in constant memory, i.e. in an iterative
--   fashion without storing all directory elements in memory. From another
--   perspective, this reading interface allows stopping at any point
--   without loading every directory element.
--   
--   Also defines general-purpose recursive directory traversals.
--   
--   Both Windows and Unix systems are supported.
@package directory-ospath-streaming
@version 0.2.2

module System.Directory.OsPath.Types
data SymlinkType
Regular :: SymlinkType
Symlink :: SymlinkType
data FileType
File :: {-# UNPACK #-} !SymlinkType -> FileType
Directory :: {-# UNPACK #-} !SymlinkType -> FileType
Other :: {-# UNPACK #-} !SymlinkType -> FileType

-- | Basename part of filename, without directory separators.
newtype Basename a
Basename :: a -> Basename a
[unBasename] :: Basename a -> a

-- | Filename relative to some other path.
newtype Relative a
Relative :: a -> Relative a
[unRelative] :: Relative a -> a
instance GHC.Classes.Eq a => GHC.Classes.Eq (System.Directory.OsPath.Types.Basename a)
instance GHC.Classes.Eq System.Directory.OsPath.Types.FileType
instance GHC.Classes.Eq a => GHC.Classes.Eq (System.Directory.OsPath.Types.Relative a)
instance GHC.Classes.Eq System.Directory.OsPath.Types.SymlinkType
instance GHC.Internal.Data.Foldable.Foldable System.Directory.OsPath.Types.Basename
instance GHC.Internal.Data.Foldable.Foldable System.Directory.OsPath.Types.Relative
instance GHC.Internal.Base.Functor System.Directory.OsPath.Types.Basename
instance GHC.Internal.Base.Functor System.Directory.OsPath.Types.Relative
instance GHC.Internal.Generics.Generic1 System.Directory.OsPath.Types.Basename
instance GHC.Internal.Generics.Generic1 System.Directory.OsPath.Types.Relative
instance GHC.Internal.Generics.Generic (System.Directory.OsPath.Types.Basename a)
instance GHC.Internal.Generics.Generic System.Directory.OsPath.Types.FileType
instance GHC.Internal.Generics.Generic (System.Directory.OsPath.Types.Relative a)
instance GHC.Internal.Generics.Generic System.Directory.OsPath.Types.SymlinkType
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (System.Directory.OsPath.Types.Basename a)
instance Control.DeepSeq.NFData System.Directory.OsPath.Types.FileType
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (System.Directory.OsPath.Types.Relative a)
instance Control.DeepSeq.NFData System.Directory.OsPath.Types.SymlinkType
instance GHC.Classes.Ord a => GHC.Classes.Ord (System.Directory.OsPath.Types.Basename a)
instance GHC.Classes.Ord System.Directory.OsPath.Types.FileType
instance GHC.Classes.Ord a => GHC.Classes.Ord (System.Directory.OsPath.Types.Relative a)
instance GHC.Classes.Ord System.Directory.OsPath.Types.SymlinkType
instance GHC.Internal.Read.Read System.Directory.OsPath.Types.FileType
instance GHC.Internal.Read.Read System.Directory.OsPath.Types.SymlinkType
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (System.Directory.OsPath.Types.Basename a)
instance GHC.Internal.Show.Show System.Directory.OsPath.Types.FileType
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (System.Directory.OsPath.Types.Relative a)
instance GHC.Internal.Show.Show System.Directory.OsPath.Types.SymlinkType
instance GHC.Internal.Data.Traversable.Traversable System.Directory.OsPath.Types.Basename
instance GHC.Internal.Data.Traversable.Traversable System.Directory.OsPath.Types.Relative

-- | Streaming functions for interacting with the filesystem.
--   
--   These do the basic job of reading directory entries but care must be
--   taken to not close these streams more than once.
module System.Directory.OsPath.Streaming.Internal.Raw

-- | Abstract handle to directory contents.
--   
--   Not thread safe and shouldn't be closed more than once.
data RawDirStream
RawDirStream :: !DirStream -> !OsPath -> RawDirStream
openRawDirStream :: OsPath -> IO RawDirStream
readRawDirStream :: RawDirStream -> IO (Maybe (OsPath, FileType))

-- | Deallocate directory handle. It’s not safe to call multiple times on
--   the same handle.
closeRawDirStream :: RawDirStream -> IO ()
data DirReadCache
DirReadCache :: MutableByteArray# RealWorld -> DirReadCache
allocateDirReadCache :: IO DirReadCache
releaseDirReadCache :: DirReadCache -> IO ()
readRawDirStreamWithCache :: DirReadCache -> RawDirStream -> IO (Maybe (OsPath, Basename OsPath, FileType))

module System.Directory.OsPath.Streaming.Internal

-- | Abstract handle to directory contents.
--   
--   May be closed multiple times and will be automatically closed by GC
--   when it goes out of scope.
data DirStream
DirStream :: !RawDirStream -> {-# UNPACK #-} !Counter -> {-# UNPACK #-} !Weak DirStream -> DirStream
[dsHandle] :: DirStream -> !RawDirStream
[dsIsClosed] :: DirStream -> {-# UNPACK #-} !Counter
[dsFin] :: DirStream -> {-# UNPACK #-} !Weak DirStream
openDirStream :: OsPath -> IO DirStream
readDirStream :: DirStream -> IO (Maybe (OsPath, FileType))

-- | Deallocate directory handle. It’s safe to close DirStream
--   multiple times, unlike the underlying OS-specific directory stream
--   handle.
closeDirStream :: DirStream -> IO ()
readDirStreamWithCache :: DirReadCache -> DirStream -> IO (Maybe (OsPath, Basename OsPath, FileType))

-- | You’ll most likely be interested in either
--   
--   
--   
- getDirectoryContentsRecursive to search directory hierarchy
--   recursively
--   
- DirStream, openDirStream, readDirStream, and
--   closeDirStream to traverse single directory efficiently
--   
module System.Directory.OsPath.Streaming

-- | Abstract handle to directory contents.
--   
--   May be closed multiple times and will be automatically closed by GC
--   when it goes out of scope.
data DirStream
openDirStream :: OsPath -> IO DirStream
readDirStream :: DirStream -> IO (Maybe (OsPath, FileType))

-- | Deallocate directory handle. It’s safe to close DirStream
--   multiple times, unlike the underlying OS-specific directory stream
--   handle.
closeDirStream :: DirStream -> IO ()
data SymlinkType
Regular :: SymlinkType
Symlink :: SymlinkType
data FileType
File :: {-# UNPACK #-} !SymlinkType -> FileType
Directory :: {-# UNPACK #-} !SymlinkType -> FileType
Other :: {-# UNPACK #-} !SymlinkType -> FileType

-- | Basename part of filename, without directory separators.
newtype Basename a
Basename :: a -> Basename a
[unBasename] :: Basename a -> a
getFileType :: OsPath -> IO FileType

-- | Recursively list all the files and directories in a directory and all
--   subdirectories.
--   
--   The directory structure is traversed depth-first.
--   
--   The result is generated lazily so is not well defined if the source
--   directory structure changes before the list is fully consumed.
--   
--   Symlinks within directory structure may cause result to be infinitely
--   long.
getDirectoryContentsRecursive :: OsPath -> IO [(OsPath, FileType)]

-- | Recursively list all the files and directories that satisfy given
--   predicate in a directory and all subdirectories. Descending into some
--   subdirectories may be avoided by filtering them out with a visiting
--   predicate.
--   
--   Not visited directory entry may still be reported depending on the
--   collection predicate.
--   
--   The directory structure is traversed depth-first.
--   
--   The result is generated lazily so is not well defined if the source
--   directory structure changes before the list is fully consumed.
--   
--   Symlinks within directory structure may cause result to be infinitely
--   long, but they can be filtered out with a suitable directory visiting
--   predicate.
getDirectoryContentsWithFilterRecursive :: (Basename OsPath -> SymlinkType -> Bool) -> (Basename OsPath -> Bool) -> OsPath -> IO [(OsPath, FileType)]

-- | The most general form of gathering directory contents.
--   
--   Treats symlinks the same as regular files and directories. Folding
--   functions can decide how to handle symlinks.
--   
--   Both directory and file actions can throw exceptions and this function
--   will try to close finished directory streams promptly (they’ll be
--   closed by GC in the worst case).
listContentsRecFold :: forall f a b. (Foldable f, Coercible b OsPath) => Maybe Int -> (forall c. () => OsPath -> b -> Relative OsPath -> Basename OsPath -> SymlinkType -> (a -> IO c -> IO c) -> (IO c -> IO c) -> IO c -> IO c) -> (OsPath -> b -> Relative OsPath -> Basename OsPath -> FileType -> IO (Maybe a)) -> f b -> IO [a]

-- | Auxiliary constants to refer to different file types without
--   allocations.
regularFile :: FileType

-- | Auxiliary constants to refer to different file types without
--   allocations.
regularDirectory :: FileType

-- | Auxiliary constants to refer to different file types without
--   allocations.
regularOther :: FileType

-- | Auxiliary constants to refer to different file types without
--   allocations.
symlinkFile :: FileType

-- | Auxiliary constants to refer to different file types without
--   allocations.
symlinkDirectory :: FileType

-- | Auxiliary constants to refer to different file types without
--   allocations.
symlinkOther :: FileType
