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

Safe HaskellNone
LanguageHaskell2010

Data.Conduit.VFS.InMemory

Description

This is intended to demonstrate how a VFS can be defined, but is also entirely usable in code if you find its functionality useful.

This VFS implementation stores its values in a lazy in-memory map, which is itself persisted into an MVar and captured in the monadic state. This requires the monad to be in the class MonadUnliftIO, but that allows the state to be shared throughout the application, maintaining value consistency across threads and even across invocations.

Individual read and write operations are atomic.

The FilePath values used in this VFS are split using splitPath and joined using </>, but are otherwise used directly: there is no concept of paths being "relative" or "absolute" for this VFS. It is also possible for a file and a directory to have the same name, since directories names are appended with /, as per splitPath. (This implementation detail is up for debate and may be changed in a future major release: please file an issue if you want to have a discussion around it.)

Synopsis

Documentation

data InMemoryVFS m a Source #

The basic implementation of the VFS.

Instances
MonadTrans InMemoryVFS Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

Methods

lift :: Monad m => m a -> InMemoryVFS m a #

Monad m => MonadReader InMemoryVFSRoot (InMemoryVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

Monad m => Monad (InMemoryVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

Methods

(>>=) :: InMemoryVFS m a -> (a -> InMemoryVFS m b) -> InMemoryVFS m b #

(>>) :: InMemoryVFS m a -> InMemoryVFS m b -> InMemoryVFS m b #

return :: a -> InMemoryVFS m a #

fail :: String -> InMemoryVFS m a #

Functor m => Functor (InMemoryVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

Methods

fmap :: (a -> b) -> InMemoryVFS m a -> InMemoryVFS m b #

(<$) :: a -> InMemoryVFS m b -> InMemoryVFS m a #

MonadFail m => MonadFail (InMemoryVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

Methods

fail :: String -> InMemoryVFS m a #

Applicative m => Applicative (InMemoryVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

Methods

pure :: a -> InMemoryVFS m a #

(<*>) :: InMemoryVFS m (a -> b) -> InMemoryVFS m a -> InMemoryVFS m b #

liftA2 :: (a -> b -> c) -> InMemoryVFS m a -> InMemoryVFS m b -> InMemoryVFS m c #

(*>) :: InMemoryVFS m a -> InMemoryVFS m b -> InMemoryVFS m b #

(<*) :: InMemoryVFS m a -> InMemoryVFS m b -> InMemoryVFS m a #

MonadIO m => MonadIO (InMemoryVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

Methods

liftIO :: IO a -> InMemoryVFS m a #

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

Defined in Data.Conduit.VFS.InMemory

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 => ReadVFSC (InMemoryVFS m) Source # 
Instance details

Defined in Data.Conduit.VFS.InMemory

runInMemoryVFS :: MonadUnliftIO m => InMemoryVFS m a -> m a Source #

Given an InMemoryVFS, run it in the local monad.

mkInMemoryVFSRoot :: MonadIO m => m InMemoryVFSRoot Source #

Creates an InMemoryVFSRoot that can be shared among many InMemoryVFS invocations.