| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Drasil.Build.Artifacts
Synopsis
- localPath :: OsPath
- data FileLayout doc
- file :: PathSegment -> doc -> FileLayout doc
- directory :: Foldable f => PathSegment -> f (FileLayout doc) -> FileLayout doc
- writeFiles :: Renderable doc => OsPath -> FileLayout doc -> IO ()
- data PathSegment
- ps :: QuasiQuoter
- (</>) :: OsPath -> PathSegment -> OsPath
- toPath :: PathSegment -> OsPath
Documentation
File Layout
data FileLayout doc Source #
Container for laying out files in a single container for writing to disk. Notes:
- Polymorphic over the representation of the file contents. For
rendering, writeFiles requires the file content representation
satisfy
Renderable. - Only permits writing files/directories relative to a base path
provided. Does not permit `..`,
., nor~as directory names. - System-local path separator is forbidden from use in directory names.
- Assumes host file system is case-sensitive (i.e., recognizes
txtand `a.txt` as different paths).
Instances
| Functor FileLayout Source # | |
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.
Instances
| Eq PathSegment Source # | |
Defined in Drasil.Build.Artifacts.FilePath | |
| Ord PathSegment Source # | |
Defined in Drasil.Build.Artifacts.FilePath Methods compare :: PathSegment -> PathSegment -> Ordering # (<) :: PathSegment -> PathSegment -> Bool # (<=) :: PathSegment -> PathSegment -> Bool # (>) :: PathSegment -> PathSegment -> Bool # (>=) :: PathSegment -> PathSegment -> Bool # max :: PathSegment -> PathSegment -> PathSegment # min :: PathSegment -> PathSegment -> PathSegment # | |
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.