drasil-build-artifacts-0.1.1.0: A framework for code and document generation for scientific software - build-artifacts SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Drasil.Build.Artifacts.FileLayout

Synopsis

File Layout

data FileLayout doc Source #

Container for laying out files in a single container for writing to disk. Notes:

  1. Polymorphic over the representation of the file contents. For rendering, writeFiles requires the file content representation satisfy Renderable.
  2. Only permits writing files/directories relative to a base path provided. Does not permit `..`, ., nor ~ as directory names.
  3. System-local path separator is forbidden from use in directory names.
  4. Assumes host file system is case-sensitive (i.e., recognizes txt and `a.txt` as different paths).

Instances

Instances details
Functor FileLayout Source # 
Instance details

Defined in Drasil.Build.Artifacts.FileLayout

Methods

fmap :: (a -> b) -> FileLayout a -> FileLayout b #

(<$) :: a -> FileLayout b -> FileLayout a #

Constructors

file :: PathSegment -> doc -> FileLayout doc Source #

Create a file FileLayout.

directory :: Foldable f => PathSegment -> f (FileLayout doc) -> FileLayout doc Source #

Create a directory FileLayout, optionally containing any number of nested files.

Writing

writeFiles :: Renderable doc => OsPath -> FileLayout doc -> IO () Source #

Write a FileLayout to disk about a base path.

Disclaimer: Fails if files/directories already exist. This is problematic for case-insensitive file systems where different paths reference the same.