conduit-vfs-0.1.0.3: Virtual file system for Conduit; disk, pure, and in-memory impls.

Safe HaskellNone
LanguageHaskell2010

Data.Conduit.VFS.Types

Description

 
Synopsis

Documentation

type FilePath = String #

File and directory names are values of type String, whose precise meaning is operating system dependent. Files can be opened, yielding a handle which can then be used to operate on the contents of that file.

data ConduitT i o (m :: Type -> Type) r #

Core datatype of the conduit package. This type represents a general component which can consume a stream of input values i, produce a stream of output values o, perform actions in the m monad, and produce a final result r. The type synonyms provided here are simply wrappers around this type.

Since 1.3.0

Instances
MonadRWS r w s m => MonadRWS r w s (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

MonadReader r m => MonadReader r (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

ask :: ConduitT i o m r #

local :: (r -> r) -> ConduitT i o m a -> ConduitT i o m a #

reader :: (r -> a) -> ConduitT i o m a #

MonadState s m => MonadState s (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

get :: ConduitT i o m s #

put :: s -> ConduitT i o m () #

state :: (s -> (a, s)) -> ConduitT i o m a #

MonadWriter w m => MonadWriter w (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

writer :: (a, w) -> ConduitT i o m a #

tell :: w -> ConduitT i o m () #

listen :: ConduitT i o m a -> ConduitT i o m (a, w) #

pass :: ConduitT i o m (a, w -> w) -> ConduitT i o m a #

MonadError e m => MonadError e (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

throwError :: e -> ConduitT i o m a #

catchError :: ConduitT i o m a -> (e -> ConduitT i o m a) -> ConduitT i o m a #

MonadTrans (ConduitT i o) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

lift :: Monad m => m a -> ConduitT i o m a #

Monad (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

(>>=) :: ConduitT i o m a -> (a -> ConduitT i o m b) -> ConduitT i o m b #

(>>) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m b #

return :: a -> ConduitT i o m a #

fail :: String -> ConduitT i o m a #

Functor (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

fmap :: (a -> b) -> ConduitT i o m a -> ConduitT i o m b #

(<$) :: a -> ConduitT i o m b -> ConduitT i o m a #

MonadFail m => MonadFail (ConduitT i o m)

Since: conduit-1.3.1

Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

fail :: String -> ConduitT i o m a #

Applicative (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

pure :: a -> ConduitT i o m a #

(<*>) :: ConduitT i o m (a -> b) -> ConduitT i o m a -> ConduitT i o m b #

liftA2 :: (a -> b -> c) -> ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m c #

(*>) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m b #

(<*) :: ConduitT i o m a -> ConduitT i o m b -> ConduitT i o m a #

MonadIO m => MonadIO (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

liftIO :: IO a -> ConduitT i o m a #

PrimMonad m => PrimMonad (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Associated Types

type PrimState (ConduitT i o m) :: Type #

Methods

primitive :: (State# (PrimState (ConduitT i o m)) -> (#State# (PrimState (ConduitT i o m)), a#)) -> ConduitT i o m a #

MonadResource m => MonadResource (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

liftResourceT :: ResourceT IO a -> ConduitT i o m a #

MonadThrow m => MonadThrow (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

throwM :: Exception e => e -> ConduitT i o m a #

Monad m => Semigroup (ConduitT i o m ()) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

(<>) :: ConduitT i o m () -> ConduitT i o m () -> ConduitT i o m () #

sconcat :: NonEmpty (ConduitT i o m ()) -> ConduitT i o m () #

stimes :: Integral b => b -> ConduitT i o m () -> ConduitT i o m () #

Monad m => Monoid (ConduitT i o m ()) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

mempty :: ConduitT i o m () #

mappend :: ConduitT i o m () -> ConduitT i o m () -> ConduitT i o m () #

mconcat :: [ConduitT i o m ()] -> ConduitT i o m () #

type PrimState (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

type PrimState (ConduitT i o m) = PrimState m

type VFSSource m = ConduitT Void FilePath m () Source #

The type of conduits that generate file paths.

type VFSPipe m = ConduitT FilePath FilePath m () Source #

The type of conduits that consume file paths and generate file paths.

type VFSSink m r = ConduitT FilePath Void m r Source #

The type of conduits that consume file paths.

data VFileType Source #

The types that our virtual file system supports.

Constructors

VFile

A node containing bytes

VDirectory

A node containing zero or more other nodes

Instances
Bounded VFileType Source # 
Instance details

Defined in Data.Conduit.VFS.Types

Enum VFileType Source # 
Instance details

Defined in Data.Conduit.VFS.Types

Eq VFileType Source # 
Instance details

Defined in Data.Conduit.VFS.Types

Ord VFileType Source # 
Instance details

Defined in Data.Conduit.VFS.Types

Show VFileType Source # 
Instance details

Defined in Data.Conduit.VFS.Types

Generic VFileType Source # 
Instance details

Defined in Data.Conduit.VFS.Types

Associated Types

type Rep VFileType :: Type -> Type #

type Rep VFileType Source # 
Instance details

Defined in Data.Conduit.VFS.Types

type Rep VFileType = D1 (MetaData "VFileType" "Data.Conduit.VFS.Types" "conduit-vfs-0.1.0.3-4D1JE2vzeQAIf1Sv7V4DzL" False) (C1 (MetaCons "VFile" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "VDirectory" PrefixI False) (U1 :: Type -> Type))

class Monad m => ReadVFSC m where Source #

A class denoting that the type is usable as VFS conduits for reading.

Methods

vfsTypeC :: ConduitT FilePath (FilePath, Maybe VFileType) m () Source #

Given an input path, generates a tuple of the input path itself and the input path's VFileType (or Nothing if the node does not exist). Note that a directory containing no elements may be reported by the VFS as not existing.

vfsContentsC :: ConduitT FilePath (FilePath, ByteString) m () Source #

Given an input of FilePath files, generates a tuple containing the input and the bytestring for the contents of the file. Note that the entire contents of the file are pulled into memory. If the input FilePath does not denote a VFile, it should be dropped.

vfsContentsEitherC :: ConduitT FilePath (Either FilePath ByteString) m () Source #

Given an input of FilePath files, generates a Left of the input, followed by zero or more Right values holding a bytestring. The concatenation of the Right values after a given Left and before the next Left (or EOS) are the bytes of the input value. If the input FilePath does not denote a VFile, it should be dropped.

vfsChildrenC :: VFSPipe m Source #

Given an input of FilePath directories, generates the non-special direct children, each path-prepended (using </>) with the parent directory. If an input FilePath is not a VDirectory, it should be passed through directly.

vfsChildFilesC :: VFSPipe m Source #

Given an input of FilePath directories, generates the non-special direct children that are files, each path-prepended (using </>) with the parent directory. If an input FilePath is not a VDirectory, it should be passed through directly.

vfsChildDirsC :: VFSPipe m Source #

Given an input of FilePath directories, generates the non-special direct children that are files, each path-prepended (using </>) with the parent directory. If an input FilePath is not a VDirectory, it should be dropped.

vfsDescendentsC :: VFSPipe m Source #

Given an input of FilePath directories, generates all the paths in the VFS that have the input as a prefix, with the outputs being each path-prepended (using </>) with the corresponding input directory. If an input FilePath is not a VDirectory, it should be passed through directly.

vfsDescFilesC :: VFSPipe m Source #

Given an input FilePath directories, generates all the paths in the VFS that are files and have the input as a prefix, with the outputs being each path-prepended (using </>) with the corresponding input directory. If an input FilePath is not a VDirectory, it should be passed through directly.

vfsDescDirsC :: VFSPipe m Source #

Given an input of FilePath directories, generates all the paths in the VFS that are directories and have the input as a prefix, with the outputs being each path-prepended (using </>) with the corresponding input directory. If an input FilePath is not a VDirectory, it should be dropped.

Instances
Monad m => ReadVFSC (PureVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.Pure

MonadUnliftIO m => ReadVFSC (InMemoryVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

MonadUnliftIO m => ReadVFSC (DiskVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.Disk

class Monad m => WriteVFSC m where Source #

A class denoting that the type is usable as VFS conduits for writing.

Minimal complete definition

(vfsWriteSink | vfsWriteEitherSink), vfsRemoveSink

Methods

vfsWriteSink :: ConduitT (FilePath, ByteString) Void m () Source #

Given an input tuple of FilePath files and their bytestring contents, writes the contents to the filepath. This write should be atomic if possible, and if it is not an atomic operation, the implementation's documentation should make this clear. This write should also create any necessary directories that may not have previously existed.

vfsWriteEitherSink :: ConduitT (Either FilePath ByteString) Void m () Source #

Given an input of either FilePath files or bytestring contents, writes the contents to the filepath. The write is marked as complete when the next FilePath input or end-of-stream is reached. This write should be atomic at completion if possible, and if it is not an atomic operation, the implementation's documentation should make this clear. This write should also create any necessary directories that may not have previously existed.

vfsRemoveSink :: VFSSink m () Source #

Given FilePath inputs, remove those nodes from the VFS. If the path denotes a directory, the directory is removed along with all of its descendents. If the path denotes a file, the file itself is removed. After a removal, any newly-empty directories may also be removed.

Instances
Monad m => WriteVFSC (PureVFS m) Source #

A class denoting that the type is usable as VFS conduits for writing.

Instance details

Defined in Data.Conduit.VFS.Pure

MonadUnliftIO m => WriteVFSC (InMemoryVFS m) Source #

A class denoting that the type is usable as VFS conduits for writing.

Instance details

Defined in Data.Conduit.VFS.InMemory

MonadUnliftIO m => WriteVFSC (DiskVFS m) Source #

A class denoting that the type is usable as VFS conduits for writing.

Instance details

Defined in Data.Conduit.VFS.Disk

class (ReadVFSC m, WriteVFSC m) => VFSC m where Source #

A class denoting that the type is usable as VFS conduits for both reading and writing.

Minimal complete definition

Nothing

Methods

vfsTouchSink :: ConduitT (VFileType, FilePath) Void m () Source #

Given an input tuple of a filetype and a filepath, ensure that a node exists at the filepath. If it does not exist, it should be created as either a directory or a zero-length file, as denoted by the filetype, with any missing parent directories created. Note that a directory which does not contain a node may be reported as not present by the VFS, and therefore an acceptable implementation for VDirectory inputs is simply 'return ()'

Instances
Monad m => VFSC (PureVFS m) Source #

A class denoting that the type is usable as VFS conduits for reading and writing.

Instance details

Defined in Data.Conduit.VFS.Pure

MonadUnliftIO m => VFSC (InMemoryVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

MonadUnliftIO m => VFSC (DiskVFS m) Source #

A class denoting that the type is usable as VFS conduits for reading and writing.

Instance details

Defined in Data.Conduit.VFS.Disk