Safe Haskell | None |
---|---|
Language | Haskell2010 |
B9 produces not only VM-Images but also text documents such as configuration files required by virtual machines. This module is about creating and merging files containing parsable syntactic structures, such as most configuration files do.
Imagine you would want to create a cloud-init 'user-data' file from a set
of 'user-data' snippets which each are valid 'user-data' files in yaml syntax
and e.g. a writefiles
section. Now the goal is, for b9 to be able to merge
these snippets into one, such that all writefiles sections are combined into
a single writefile section. Another example is OTP/Erlang sys.config files.
This type class is the greatest commonon denominator of types describing a
syntax that can be parsed, concatenated e.g. like in the above example and
rendered. The actual concatenation operation is the append from Monoid,
i.e. like monoid but without the need for an empty element.
- class Semigroup a => ConcatableSyntax a where
- decodeSyntax :: FilePath -> ByteString -> Either String a
- encodeSyntax :: a -> ByteString
- class ConcatableSyntax a => ASTish a where
- fromAST :: (CanRender c, Applicative m, Monad m, MonadIO m, MonadReader Environment m) => AST c a -> m a
- data AST c a
- class CanRender c where
- render :: (Functor m, Applicative m, MonadIO m, MonadReader Environment m) => c -> m ByteString
Documentation
class Semigroup a => ConcatableSyntax a where Source
decodeSyntax :: FilePath -> ByteString -> Either String a Source
encodeSyntax :: a -> ByteString Source
class ConcatableSyntax a => ASTish a where Source
Structure data into an abstract syntax tree
fromAST :: (CanRender c, Applicative m, Monad m, MonadIO m, MonadReader Environment m) => AST c a -> m a Source
A simple AST wrapper for merging embeded ASTs
class CanRender c where Source
Things that produce byte strings.
render :: (Functor m, Applicative m, MonadIO m, MonadReader Environment m) => c -> m ByteString Source