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

Synopsis

Documentation

localPath :: OsPath Source #

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.

File Path Segments

data PathSegment Source #

Represents a single valid segment of a path (e.g., a file or directory name, usually the terminal basename of a path). Does not allow path segments to be any of: `..`, ., nor ~. Assumes case-sensitive equality.

Construction

ps :: QuasiQuoter Source #

QuasiQuoter for building PathSegments.

Syntax: ps ::= comp+ comp ::= '{' hsVar '}' | <any string excl. ., '..', ~, not including the system-local path sep.> hsVar ::= string

(</>) :: OsPath -> PathSegment -> OsPath Source #

Append a terminal PathSegment onto a OsPath to form a new OsPath.

Unpacking

toPath :: PathSegment -> OsPath Source #

Retrieve OsPath representation of a PathSegment.