-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Tools to parse and evaluate the Puppet DSL.
--   
--   This is a set of tools that is supposed to fill all your Puppet needs
--   : syntax checks, catalog compilation, PuppetDB queries, simulationg of
--   complex interactions between nodes, Puppet master replacement, and
--   more !
@package language-puppet
@version 1.3.19


-- | General specific prelude for language-puppet. Customization of the
--   <a>Protolude</a> with extra specific utilities.
module XPrelude
type Container = HashMap Text
text2Scientific :: Text -> Maybe Scientific
scientific2text :: Scientific -> Text
strictifyEither :: Either a b -> Either a b

-- | Helper for hashmap, in case we want another kind of map.
ifromList :: (Monoid m, At m, Foldable f) => f (Index m, IxValue m) -> m
ikeys :: (Eq k, Hashable k) => HashMap k v -> HashSet k
isingleton :: (Monoid b, At b) => Index b -> IxValue b -> b
ifromListWith :: (Monoid m, At m, Foldable f) => (IxValue m -> IxValue m -> IxValue m) -> f (Index m, IxValue m) -> m
iinsertWith :: At m => (IxValue m -> IxValue m -> IxValue m) -> Index m -> IxValue m -> m -> m
iunionWith :: (Hashable k, Eq k) => (v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v
isEmpty :: (Eq x, Monoid x) => x -> Bool

-- | Remove the '::' token from a text if any.
dropInitialColons :: Text -> Text
loggerName :: String
logDebug :: Text -> IO ()
logInfo :: Text -> IO ()
logInfoStr :: String -> IO ()
logWarning :: Text -> IO ()
logWarningStr :: String -> IO ()
logError :: Text -> IO ()
logCritical :: Text -> IO ()
logCriticalStr :: String -> IO ()
logDebugStr :: String -> IO ()

-- | In case of a Left error, print and exit immediately.
unwrapError :: Doc -> Either PrettyError a -> IO a

-- | An associative operation.
(<>) :: Semigroup a => a -> a -> a
infixr 6 <>

-- | <tt>(hPutDoc handle doc)</tt> pretty prints document <tt>doc</tt> to
--   the file handle <tt>handle</tt> with a page width of 80 characters and
--   a ribbon width of 32 characters.
--   
--   <pre>
--   main = do{ handle &lt;- openFile "MyFile" WriteMode
--            ; hPutDoc handle (vcat (map text
--                              ["vertical","text"]))
--            ; hClose handle
--            }
--   </pre>
--   
--   Any ANSI colorisation in <tt>doc</tt> will be output.
hPutDoc :: Handle -> Doc -> IO ()

-- | The action <tt>(putDoc doc)</tt> pretty prints document <tt>doc</tt>
--   to the standard output, with a page width of 80 characters and a
--   ribbon width of 32 characters.
--   
--   <pre>
--   main :: IO ()
--   main = do{ putDoc (text "hello" &lt;+&gt; text "world") }
--   </pre>
--   
--   Which would output
--   
--   <pre>
--   hello world
--   </pre>
--   
--   Any ANSI colorisation in <tt>doc</tt> will be output.
putDoc :: Doc -> IO ()

-- | <tt>(displayIO handle simpleDoc)</tt> writes <tt>simpleDoc</tt> to the
--   file handle <tt>handle</tt>. This function is used for example by
--   <a>hPutDoc</a>:
--   
--   <pre>
--   hPutDoc handle doc  = displayIO handle (renderPretty 0.4 80 doc)
--   </pre>
--   
--   Any ANSI colorisation in <tt>simpleDoc</tt> will be output.
displayIO :: Handle -> SimpleDoc -> IO ()

-- | <tt>(displayS simpleDoc)</tt> takes the output <tt>simpleDoc</tt> from
--   a rendering function and transforms it to a <a>ShowS</a> type (for use
--   in the <a>Show</a> class).
--   
--   <pre>
--   showWidth :: Int -&gt; Doc -&gt; String
--   showWidth w x   = displayS (renderPretty 0.4 w x) ""
--   </pre>
--   
--   ANSI color information will be discarded by this function unless you
--   are running on a Unix-like operating system. This is due to a
--   technical limitation in Windows ANSI support.
displayS :: SimpleDoc -> ShowS

-- | <tt>(renderCompact x)</tt> renders document <tt>x</tt> without adding
--   any indentation. Since no 'pretty' printing is involved, this renderer
--   is very fast. The resulting output contains fewer characters than a
--   pretty printed version and can be used for output that is read by
--   other programs.
--   
--   This rendering function does not add any colorisation information.
renderCompact :: Doc -> SimpleDoc

-- | A slightly smarter rendering algorithm with more lookahead. It
--   provides provide earlier breaking on deeply nested structures For
--   example, consider this python-ish pseudocode:
--   <tt>fun(fun(fun(fun(fun([abcdefg, abcdefg])))))</tt> If we put a
--   softbreak (+ nesting 2) after each open parenthesis, and align the
--   elements of the list to match the opening brackets, this will render
--   with <tt>renderPretty</tt> and a page width of 20 as: <tt>
--   fun(fun(fun(fun(fun([ | abcdef, | abcdef, ] ))))) | </tt> Where the
--   20c. boundary has been marked with |. Because <tt>renderPretty</tt>
--   only uses one-line lookahead, it sees that the first line fits, and is
--   stuck putting the second and third lines after the 20-c mark. In
--   contrast, <tt>renderSmart</tt> will continue to check that the
--   potential document up to the end of the indentation level. Thus, it
--   will format the document as:
--   
--   <pre>
--   fun(                |
--     fun(              |
--       fun(            |
--         fun(          |
--           fun([       |
--                 abcdef,
--                 abcdef,
--               ]       |
--     )))))             |
--   </pre>
--   
--   Which fits within the 20c. boundary.
renderSmart :: Float -> Int -> Doc -> SimpleDoc

-- | This is the default pretty printer which is used by <a>show</a>,
--   <a>putDoc</a> and <a>hPutDoc</a>. <tt>(renderPretty ribbonfrac width
--   x)</tt> renders document <tt>x</tt> with a page width of
--   <tt>width</tt> and a ribbon width of <tt>(ribbonfrac * width)</tt>
--   characters. The ribbon width is the maximal amount of non-indentation
--   characters on a line. The parameter <tt>ribbonfrac</tt> should be
--   between <tt>0.0</tt> and <tt>1.0</tt>. If it is lower or higher, the
--   ribbon width will be 0 or <tt>width</tt> respectively.
renderPretty :: Float -> Int -> Doc -> SimpleDoc

-- | Removes all colorisation, emboldening and underlining from a document
plain :: Doc -> Doc

-- | Displays a document with no underlining
deunderline :: Doc -> Doc

-- | Displays a document with underlining
underline :: Doc -> Doc

-- | Displays a document in the normal font weight
debold :: Doc -> Doc

-- | Displays a document in a heavier font weight
bold :: Doc -> Doc

-- | Displays a document with the dull white backcolor
ondullwhite :: Doc -> Doc

-- | Displays a document with the white backcolor
onwhite :: Doc -> Doc

-- | Displays a document with the dull cyan backcolor
ondullcyan :: Doc -> Doc

-- | Displays a document with the cyan backcolor
oncyan :: Doc -> Doc

-- | Displays a document with the dull magenta backcolor
ondullmagenta :: Doc -> Doc

-- | Displays a document with the magenta backcolor
onmagenta :: Doc -> Doc

-- | Displays a document with the dull blue backcolor
ondullblue :: Doc -> Doc

-- | Displays a document with the blue backcolor
onblue :: Doc -> Doc

-- | Displays a document with the dull yellow backcolor
ondullyellow :: Doc -> Doc

-- | Displays a document with the yellow backcolor
onyellow :: Doc -> Doc

-- | Displays a document with the dull green backcolor
ondullgreen :: Doc -> Doc

-- | Displays a document with the green backcolor
ongreen :: Doc -> Doc

-- | Displays a document with the dull red backcolor
ondullred :: Doc -> Doc

-- | Displays a document with the red backcolor
onred :: Doc -> Doc

-- | Displays a document with the dull black backcolor
ondullblack :: Doc -> Doc

-- | Displays a document with the black backcolor
onblack :: Doc -> Doc

-- | Displays a document with the dull white forecolor
dullwhite :: Doc -> Doc

-- | Displays a document with the white forecolor
white :: Doc -> Doc

-- | Displays a document with the dull cyan forecolor
dullcyan :: Doc -> Doc

-- | Displays a document with the cyan forecolor
cyan :: Doc -> Doc

-- | Displays a document with the dull magenta forecolor
dullmagenta :: Doc -> Doc

-- | Displays a document with the magenta forecolor
magenta :: Doc -> Doc

-- | Displays a document with the dull blue forecolor
dullblue :: Doc -> Doc

-- | Displays a document with the blue forecolor
blue :: Doc -> Doc

-- | Displays a document with the dull yellow forecolor
dullyellow :: Doc -> Doc

-- | Displays a document with the yellow forecolor
yellow :: Doc -> Doc

-- | Displays a document with the dull green forecolor
dullgreen :: Doc -> Doc

-- | Displays a document with the green forecolor
green :: Doc -> Doc

-- | Displays a document with the dull red forecolor
dullred :: Doc -> Doc

-- | Displays a document with the red forecolor
red :: Doc -> Doc

-- | Displays a document with the dull black forecolor
dullblack :: Doc -> Doc

-- | Displays a document with the black forecolor
black :: Doc -> Doc

-- | A document that is normally rendered as the first argument, but when
--   flattened, is rendered as the second document.
flatAlt :: Doc -> Doc -> Doc
columns :: Maybe Int -> Doc -> Doc
nesting :: Int -> Doc -> Doc
column :: Int -> Doc -> Doc

-- | The document <tt>(nest i x)</tt> renders document <tt>x</tt> with the
--   current indentation level increased by i (See also <a>hang</a>,
--   <a>align</a> and <a>indent</a>).
--   
--   <pre>
--   nest 2 (text "hello" &lt;$&gt; text "world") &lt;$&gt; text "!"
--   </pre>
--   
--   outputs as:
--   
--   <pre>
--   hello
--     world
--   !
--   </pre>
nest :: Int -> Doc -> Doc

-- | A linebreak that will never be flattened; it is guaranteed to render
--   as a newline.
hardline :: Doc

-- | The <tt>linebreak</tt> document advances to the next line and indents
--   to the current nesting level. Document <tt>linebreak</tt> behaves like
--   <a>empty</a> if the line break is undone by <a>group</a>.
linebreak :: Doc

-- | The <tt>line</tt> document advances to the next line and indents to
--   the current nesting level. Document <tt>line</tt> behaves like
--   <tt>(text " ")</tt> if the line break is undone by <a>group</a>.
line :: Doc

-- | The document <tt>(align x)</tt> renders document <tt>x</tt> with the
--   nesting level set to the current column. It is used for example to
--   implement <a>hang</a>.
--   
--   As an example, we will put a document right above another one,
--   regardless of the current nesting level:
--   
--   <pre>
--   x $$ y  = align (x &lt;$&gt; y)
--   </pre>
--   
--   <pre>
--   test    = text "hi" &lt;+&gt; (text "nice" $$ text "world")
--   </pre>
--   
--   which will be layed out as:
--   
--   <pre>
--   hi nice
--      world
--   </pre>
align :: Doc -> Doc

-- | The hang combinator implements hanging indentation. The document
--   <tt>(hang i x)</tt> renders document <tt>x</tt> with a nesting level
--   set to the current column plus <tt>i</tt>. The following example uses
--   hanging indentation for some text:
--   
--   <pre>
--   test  = hang 4 (fillSep (map text
--           (words "the hang combinator indents these words !")))
--   </pre>
--   
--   Which lays out on a page with a width of 20 characters as:
--   
--   <pre>
--   the hang combinator
--       indents these
--       words !
--   </pre>
--   
--   The <tt>hang</tt> combinator is implemented as:
--   
--   <pre>
--   hang i x  = align (nest i x)
--   </pre>
hang :: Int -> Doc -> Doc

-- | The document <tt>(indent i x)</tt> indents document <tt>x</tt> with
--   <tt>i</tt> spaces.
--   
--   <pre>
--   test  = indent 4 (fillSep (map text
--           (words "the indent combinator indents these words !")))
--   </pre>
--   
--   Which lays out with a page width of 20 as:
--   
--   <pre>
--   the indent
--   combinator
--   indents these
--   words !
--   </pre>
indent :: Int -> Doc -> Doc

-- | The document <tt>(fill i x)</tt> renders document <tt>x</tt>. It than
--   appends <tt>space</tt>s until the width is equal to <tt>i</tt>. If the
--   width of <tt>x</tt> is already larger, nothing is appended. This
--   combinator is quite useful in practice to output a list of bindings.
--   The following example demonstrates this.
--   
--   <pre>
--   types  = [("empty","Doc")
--            ,("nest","Int -&gt; Doc -&gt; Doc")
--            ,("linebreak","Doc")]
--   
--   ptype (name,tp)
--          = fill 6 (text name) &lt;+&gt; text "::" &lt;+&gt; text tp
--   
--   test   = text "let" &lt;+&gt; align (vcat (map ptype types))
--   </pre>
--   
--   Which is layed out as:
--   
--   <pre>
--   let empty  :: Doc
--       nest   :: Int -&gt; Doc -&gt; Doc
--       linebreak :: Doc
--   </pre>
fill :: Int -> Doc -> Doc

-- | The document <tt>(fillBreak i x)</tt> first renders document
--   <tt>x</tt>. It than appends <tt>space</tt>s until the width is equal
--   to <tt>i</tt>. If the width of <tt>x</tt> is already larger than
--   <tt>i</tt>, the nesting level is increased by <tt>i</tt> and a
--   <tt>line</tt> is appended. When we redefine <tt>ptype</tt> in the
--   previous example to use <tt>fillBreak</tt>, we get a useful variation
--   of the previous output:
--   
--   <pre>
--   ptype (name,tp)
--          = fillBreak 6 (text name) &lt;+&gt; text "::" &lt;+&gt; text tp
--   </pre>
--   
--   The output will now be:
--   
--   <pre>
--   let empty  :: Doc
--       nest   :: Int -&gt; Doc -&gt; Doc
--       linebreak
--              :: Doc
--   </pre>
fillBreak :: Int -> Doc -> Doc

-- | The document <tt>equals</tt> contains an equal sign, "=".
equals :: Doc

-- | The document <tt>backslash</tt> contains a back slash, "\".
backslash :: Doc

-- | The document <tt>dot</tt> contains a single dot, ".".
dot :: Doc

-- | The document <tt>space</tt> contains a single space, " ".
--   
--   <pre>
--   x &lt;+&gt; y   = x &lt;&gt; space &lt;&gt; y
--   </pre>
space :: Doc

-- | The document <tt>comma</tt> contains a comma, ",".
comma :: Doc

-- | The document <tt>colon</tt> contains a colon, ":".
colon :: Doc

-- | The document <tt>semi</tt> contains a semicolon, ";".
semi :: Doc

-- | The document <tt>dquote</tt> contains a double quote, '"'.
dquote :: Doc

-- | The document <tt>squote</tt> contains a single quote, "'".
squote :: Doc

-- | The document <tt>rbracket</tt> contains a right square bracket, "]".
rbracket :: Doc

-- | The document <tt>lbracket</tt> contains a left square bracket, "[".
lbracket :: Doc

-- | The document <tt>rbrace</tt> contains a right brace, "}".
rbrace :: Doc

-- | The document <tt>lbrace</tt> contains a left brace, "{".
lbrace :: Doc

-- | The document <tt>rangle</tt> contains a right angle, "&gt;".
rangle :: Doc

-- | The document <tt>langle</tt> contains a left angle, "&lt;".
langle :: Doc

-- | The document <tt>rparen</tt> contains a right parenthesis, ")".
rparen :: Doc

-- | The document <tt>lparen</tt> contains a left parenthesis, "(".
lparen :: Doc

-- | The document <tt>(enclose l r x)</tt> encloses document <tt>x</tt>
--   between documents <tt>l</tt> and <tt>r</tt> using <tt>(&lt;&gt;)</tt>.
--   
--   <pre>
--   enclose l r x   = l &lt;&gt; x &lt;&gt; r
--   </pre>
enclose :: Doc -> Doc -> Doc -> Doc

-- | Document <tt>(brackets x)</tt> encloses document <tt>x</tt> in square
--   brackets, "[" and "]".
brackets :: Doc -> Doc

-- | Document <tt>(angles x)</tt> encloses document <tt>x</tt> in angles,
--   "&lt;" and "&gt;".
angles :: Doc -> Doc

-- | Document <tt>(parens x)</tt> encloses document <tt>x</tt> in
--   parenthesis, "(" and ")".
parens :: Doc -> Doc

-- | Document <tt>(braces x)</tt> encloses document <tt>x</tt> in braces,
--   "{" and "}".
braces :: Doc -> Doc

-- | Document <tt>(dquotes x)</tt> encloses document <tt>x</tt> with double
--   quotes '"'.
dquotes :: Doc -> Doc

-- | Document <tt>(squotes x)</tt> encloses document <tt>x</tt> with single
--   quotes "'".
squotes :: Doc -> Doc

-- | The document <tt>softbreak</tt> behaves like <a>empty</a> if the
--   resulting output fits the page, otherwise it behaves like <a>line</a>.
--   
--   <pre>
--   softbreak  = group linebreak
--   </pre>
softbreak :: Doc

-- | The document <tt>softline</tt> behaves like <a>space</a> if the
--   resulting output fits the page, otherwise it behaves like <a>line</a>.
--   
--   <pre>
--   softline = group line
--   </pre>
softline :: Doc

-- | The document <tt>(x &lt;$$&gt; y)</tt> concatenates document
--   <tt>x</tt> and <tt>y</tt> with a <tt>linebreak</tt> in between.
--   (infixr 5)
(<$$>) :: Doc -> Doc -> Doc
infixr 5 <$$>

-- | The document <tt>(x &lt;//&gt; y)</tt> concatenates document
--   <tt>x</tt> and <tt>y</tt> with a <a>softbreak</a> in between. This
--   effectively puts <tt>x</tt> and <tt>y</tt> either right next to each
--   other or underneath each other. (infixr 5)
(<//>) :: Doc -> Doc -> Doc
infixr 5 <//>

-- | The document <tt>(x &lt;+&gt; y)</tt> concatenates document <tt>x</tt>
--   and <tt>y</tt> with a <tt>space</tt> in between. (infixr 6)
(<+>) :: Doc -> Doc -> Doc
infixr 6 <+>

-- | The document <tt>(vcat xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;$$&gt;)</tt>. If a <a>group</a> undoes the
--   line breaks inserted by <tt>vcat</tt>, all documents are directly
--   concatenated.
vcat :: [Doc] -> Doc

-- | The document <tt>(hcat xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt>.
hcat :: [Doc] -> Doc

-- | The document <tt>(fillCat xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt> as long as its fits the page,
--   than inserts a <tt>linebreak</tt> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillCat xs  = foldr (&lt;//&gt;) empty xs
--   </pre>
fillCat :: [Doc] -> Doc

-- | The document <tt>(vsep xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;$&gt;)</tt>. If a <a>group</a> undoes the
--   line breaks inserted by <tt>vsep</tt>, all documents are separated
--   with a space.
--   
--   <pre>
--   someText = map text (words ("text to lay out"))
--   
--   test     = text "some" &lt;+&gt; vsep someText
--   </pre>
--   
--   This is layed out as:
--   
--   <pre>
--   some text
--   to
--   lay
--   out
--   </pre>
--   
--   The <a>align</a> combinator can be used to align the documents under
--   their first element
--   
--   <pre>
--   test     = text "some" &lt;+&gt; align (vsep someText)
--   </pre>
--   
--   Which is printed as:
--   
--   <pre>
--   some text
--        to
--        lay
--        out
--   </pre>
vsep :: [Doc] -> Doc

-- | The document <tt>(hsep xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with <tt>(&lt;+&gt;)</tt>.
hsep :: [Doc] -> Doc

-- | The document <tt>(fillSep xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(&lt;+&gt;)</tt> as long as its fits the page,
--   than inserts a <tt>line</tt> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillSep xs  = foldr (&lt;/&gt;) empty xs
--   </pre>
fillSep :: [Doc] -> Doc

-- | The document <tt>(sep xs)</tt> concatenates all documents <tt>xs</tt>
--   either horizontally with <tt>(&lt;+&gt;)</tt>, if it fits the page, or
--   vertically with <tt>(&lt;$&gt;)</tt>.
--   
--   <pre>
--   sep xs  = group (vsep xs)
--   </pre>
sep :: [Doc] -> Doc

-- | <tt>(punctuate p xs)</tt> concatenates all documents in <tt>xs</tt>
--   with document <tt>p</tt> except for the last document.
--   
--   <pre>
--   someText = map text ["words","in","a","tuple"]
--   test     = parens (align (cat (punctuate comma someText)))
--   </pre>
--   
--   This is layed out on a page width of 20 as:
--   
--   <pre>
--   (words,in,a,tuple)
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   (words,
--    in,
--    a,
--    tuple)
--   </pre>
--   
--   (If you want put the commas in front of their elements instead of at
--   the end, you should use <a>tupled</a> or, in general,
--   <a>encloseSep</a>.)
punctuate :: Doc -> [Doc] -> [Doc]

-- | The document <tt>(encloseSep l r sep xs)</tt> concatenates the
--   documents <tt>xs</tt> separated by <tt>sep</tt> and encloses the
--   resulting document by <tt>l</tt> and <tt>r</tt>. The documents are
--   rendered horizontally if that fits the page. Otherwise they are
--   aligned vertically. All separators are put in front of the elements.
--   For example, the combinator <a>list</a> can be defined with
--   <tt>encloseSep</tt>:
--   
--   <pre>
--   list xs = encloseSep lbracket rbracket comma xs
--   test    = text "list" &lt;+&gt; (list (map int [10,200,3000]))
--   </pre>
--   
--   Which is layed out with a page width of 20 as:
--   
--   <pre>
--   list [10,200,3000]
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   list [10
--        ,200
--        ,3000]
--   </pre>
encloseSep :: Doc -> Doc -> Doc -> [Doc] -> Doc

-- | The document <tt>(semiBraces xs)</tt> separates the documents
--   <tt>xs</tt> with semicolons and encloses them in braces. The documents
--   are rendered horizontally if that fits the page. Otherwise they are
--   aligned vertically. All semicolons are put in front of the elements.
semiBraces :: [Doc] -> Doc

-- | The document <tt>(tupled xs)</tt> comma separates the documents
--   <tt>xs</tt> and encloses them in parenthesis. The documents are
--   rendered horizontally if that fits the page. Otherwise they are
--   aligned vertically. All comma separators are put in front of the
--   elements.
tupled :: [Doc] -> Doc

-- | The document <tt>(list xs)</tt> comma separates the documents
--   <tt>xs</tt> and encloses them in square brackets. The documents are
--   rendered horizontally if that fits the page. Otherwise they are
--   aligned vertically. All comma separators are put in front of the
--   elements.
list :: [Doc] -> Doc

-- | The member <tt>prettyList</tt> is only used to define the <tt>instance
--   Pretty a =&gt; Pretty [a]</tt>. In normal circumstances only the
--   <tt>pretty</tt> function is used.
class Pretty a
pretty :: Pretty a => a -> Doc
prettyList :: Pretty a => [a] -> Doc

-- | The abstract data type <tt>Doc</tt> represents pretty documents.
--   
--   More specifically, a value of type <tt>Doc</tt> represents a non-empty
--   set of possible renderings of a document. The rendering functions
--   select one of these possibilities.
--   
--   <tt>Doc</tt> is an instance of the <a>Show</a> class. <tt>(show
--   doc)</tt> pretty prints document <tt>doc</tt> with a page width of 80
--   characters and a ribbon width of 32 characters.
--   
--   <pre>
--   show (text "hello" &lt;$&gt; text "world")
--   </pre>
--   
--   Which would return the string "hello\nworld", i.e.
--   
--   <pre>
--   hello
--   world
--   </pre>
data Doc

-- | The data type <tt>SimpleDoc</tt> represents rendered documents and is
--   used by the display functions.
--   
--   Whereas values of the data type <a>Doc</a> represent non-empty sets of
--   possible renderings of a document, values of the data type
--   <tt>SimpleDoc</tt> represent single renderings of a document.
--   
--   The <tt>Int</tt> in <tt>SText</tt> contains the length of the string.
--   The <tt>Int</tt> in <tt>SLine</tt> contains the indentation for that
--   line. The library provides two default display functions
--   <a>displayS</a> and <a>displayIO</a>. You can provide your own display
--   function by writing a function from a <tt>SimpleDoc</tt> to your own
--   output format.
data SimpleDoc
SFail :: SimpleDoc
SEmpty :: SimpleDoc
SChar :: Char -> SimpleDoc -> SimpleDoc
SText :: !Int -> String -> SimpleDoc -> SimpleDoc
SLine :: !Int -> SimpleDoc -> SimpleDoc
SSGR :: [SGR] -> SimpleDoc -> SimpleDoc
newtype PrettyError
PrettyError :: Doc -> PrettyError
[getError] :: PrettyError -> Doc

-- | pretty print multiple lines of text.
pplines :: Text -> Doc

-- | pretty print a single line of text.
ppline :: Text -> Doc

-- | pretty print multiple lines of string.
ppstring :: String -> Doc

-- | pretty print one line of string
pptext :: String -> Doc
prettyToShow :: Doc -> String


-- | General puppet language specification.
--   
--   This module doesn't depend on any other project modules (except for
--   <a>XPrelude</a>). It serves as a common bridge that can be used in
--   <a>PuppetDB</a> or <a>Facter</a> as well as in
--   <a>Puppet.Interpreter</a> or <a>Puppet.Parser</a>.
module Puppet.Language
showPos :: Position -> Doc

-- | showing the first position of a position interval.
showPPos :: PPosition -> Doc

-- | showing the first position of a position interval as string.
showPPos' :: PPosition -> String

-- | Generates an initial position interval based on a filename.
initialPPos :: FilePath -> PPosition

-- | A pair containing the start and end of a given token.
type PPosition = Pair Position Position

-- | Position in a puppet file. Currently an alias to <a>SourcePos</a>.
type Position = SourcePos
type NodeName = Text
type Scope = Text
data CompRegex
CompRegex :: !Text -> !Regex -> CompRegex

-- | Extremely hacky escaping system for text values.
stringEscape :: Text -> Text

-- | Capitalize resource type and convert into a <a>Doc</a>.
capitalizeR :: Text -> Doc

-- | Properly capitalizes resource types.
capitalizeRT :: Text -> Text
containerComma'' :: Pretty a => [(Doc, a)] -> Doc
containerComma' :: Pretty a => [(Doc, a)] -> Doc
containerComma :: Pretty a => Container a -> Doc
_sourceName :: Lens' Position String
_sourceLine :: Lens' Position Pos
_sourceColumn :: Lens' Position Pos

-- | Generates a <a>PPosition</a> based on a filename and line number.
toPPos :: Text -> Int -> PPosition

-- | The map of native types.
baseNativeTypes :: Container NativeTypeMethods
defaulttype :: NativeTypeName -> (NativeTypeName, NativeTypeMethods)

-- | Attributes (and providers) of a puppet resource type bundled with
--   validation rules
data NativeTypeMethods
type NativeTypeName = Text
class HasNativeTypeMethods c_aZ77
nativeTypeMethods :: HasNativeTypeMethods c_aZ77 => Lens' c_aZ77 NativeTypeMethods
puppetFields :: HasNativeTypeMethods c_aZ77 => Lens' c_aZ77 (HashSet Text)
puppetValidate :: HasNativeTypeMethods c_aZ77 => Lens' c_aZ77 NativeTypeValidate
data PuppetDirPaths
PuppetDirPaths :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> PuppetDirPaths

-- | Puppet base working directory
[_baseDir] :: PuppetDirPaths -> FilePath

-- | The path to the manifests.
[_manifestPath] :: PuppetDirPaths -> FilePath

-- | The path to the modules.
[_modulesPath] :: PuppetDirPaths -> FilePath

-- | The path to the template.
[_templatesPath] :: PuppetDirPaths -> FilePath

-- | The path to a tests folders to hold tests files such as the pdbfiles.
[_testPath] :: PuppetDirPaths -> FilePath
class HasPuppetDirPaths c_avnk
puppetDirPaths :: HasPuppetDirPaths c_avnk => Lens' c_avnk PuppetDirPaths
baseDir :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath
manifestPath :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath
modulesPath :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath
templatesPath :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath
testPath :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath
puppetPaths :: FilePath -> PuppetDirPaths

-- | A fully resolved puppet resource that will be used in the
--   <a>FinalCatalog</a>.
data Resource
Resource :: !RIdentifier -> !(HashSet Text) -> !(Container PValue) -> !(HashMap RIdentifier (HashSet LinkType)) -> ![CurContainerDesc] -> !Virtuality -> !(HashSet Text) -> !PPosition -> !NodeName -> Resource

-- | Resource name.
[_rid] :: Resource -> !RIdentifier

-- | All the resource aliases
[_ralias] :: Resource -> !(HashSet Text)

-- | Resource parameters.
[_rattributes] :: Resource -> !(Container PValue)

-- | Resource relations.
[_rrelations] :: Resource -> !(HashMap RIdentifier (HashSet LinkType))

-- | Resource scope when it was defined, the real container will be the
--   first item
[_rscope] :: Resource -> ![CurContainerDesc]

-- | Virtuality.
[_rvirtuality] :: Resource -> !Virtuality

-- | Tags.
[_rtags] :: Resource -> !(HashSet Text)

-- | Source code position of the resource definition.
[_rpos] :: Resource -> !PPosition

-- | The node were this resource was created, if remote
[_rnode] :: Resource -> !NodeName
class HasResource c_aNvf
resource :: HasResource c_aNvf => Lens' c_aNvf Resource
ralias :: HasResource c_aNvf => Lens' c_aNvf (HashSet Text)
rattributes :: HasResource c_aNvf => Lens' c_aNvf (Container PValue)
rid :: HasResource c_aNvf => Lens' c_aNvf RIdentifier
rnode :: HasResource c_aNvf => Lens' c_aNvf NodeName
rpos :: HasResource c_aNvf => Lens' c_aNvf PPosition
rrelations :: HasResource c_aNvf => Lens' c_aNvf (HashMap RIdentifier (HashSet LinkType))
rscope :: HasResource c_aNvf => Lens' c_aNvf [CurContainerDesc]
rtags :: HasResource c_aNvf => Lens' c_aNvf (HashSet Text)
rvirtuality :: HasResource c_aNvf => Lens' c_aNvf Virtuality

-- | In Puppet, a resource is identified by a name and a type.
data RIdentifier
RIdentifier :: !Text -> !Text -> RIdentifier
[_itype] :: RIdentifier -> !Text
[_iname] :: RIdentifier -> !Text
class HasRIdentifier c_aNFy
rIdentifier :: HasRIdentifier c_aNFy => Lens' c_aNFy RIdentifier
iname :: HasRIdentifier c_aNFy => Lens' c_aNFy Text
itype :: HasRIdentifier c_aNFy => Lens' c_aNFy Text

-- | Relationship/ordering information between two resources (used in the
--   <a>EdgeMap</a>).
data LinkInformation
LinkInformation :: !RIdentifier -> !RIdentifier -> !LinkType -> !PPosition -> LinkInformation
[_linksrc] :: LinkInformation -> !RIdentifier
[_linkdst] :: LinkInformation -> !RIdentifier
[_linkType] :: LinkInformation -> !LinkType
[_linkPos] :: LinkInformation -> !PPosition
class HasLinkInformation c_aOlT
linkInformation :: HasLinkInformation c_aOlT => Lens' c_aOlT LinkInformation
linkPos :: HasLinkInformation c_aOlT => Lens' c_aOlT PPosition
linkType :: HasLinkInformation c_aOlT => Lens' c_aOlT LinkType
linkdst :: HasLinkInformation c_aOlT => Lens' c_aOlT RIdentifier
linksrc :: HasLinkInformation c_aOlT => Lens' c_aOlT RIdentifier

-- | Relationship/ordering between resources.
data LinkType

-- | Applies a resource after the target resource.
RRequire :: LinkType

-- | Applies a resource before the target resource.
RBefore :: LinkType

-- | Applies a resource before the target resource. The target resource
--   refreshes if the notifying resource changes.
RNotify :: LinkType

-- | Applies a resource after the target resource. The subscribing resource
--   refreshes if the target resource changes.
RSubscribe :: LinkType
data Virtuality

-- | Normal resource, that will be included in the catalog.
Normal :: Virtuality

-- | Type for virtual resources.
Virtual :: Virtuality

-- | Type for exported resources.
Exported :: Virtuality

-- | These are resources that are exported AND realized in the catalog.
ExportedRealized :: Virtuality
data CurContainerDesc

-- | Contained at node or root level.
ContRoot :: CurContainerDesc

-- | Contained in a class.
ContClass :: !Text -> CurContainerDesc

-- | Contained in a define, along with the position where this define was
--   ... defined
ContDefine :: !Text -> !Text -> !PPosition -> CurContainerDesc

-- | Dummy container for imported resources, so that we know we must update
--   the nodename
ContImported :: !CurContainerDesc -> CurContainerDesc

-- | This one is used when finalizing imported resources, and contains the
--   current node name
ContImport :: !NodeName -> !CurContainerDesc -> CurContainerDesc
type FinalCatalog = HashMap RIdentifier Resource
type EdgeMap = HashMap RIdentifier [LinkInformation]
data DataType
DTType :: DataType
DTString :: (Maybe Int) -> (Maybe Int) -> DataType
DTInteger :: (Maybe Int) -> (Maybe Int) -> DataType
DTFloat :: (Maybe Double) -> (Maybe Double) -> DataType
DTBoolean :: DataType
DTArray :: DataType -> Int -> (Maybe Int) -> DataType
DTHash :: DataType -> DataType -> Int -> (Maybe Int) -> DataType
DTUndef :: DataType
DTScalar :: DataType
DTData :: DataType
DTOptional :: DataType -> DataType
NotUndef :: DataType
DTVariant :: (NonEmpty DataType) -> DataType
DTPattern :: (NonEmpty CompRegex) -> DataType
DTEnum :: (NonEmpty Text) -> DataType
DTAny :: DataType
DTCollection :: DataType
DTRegexp :: (Maybe CompRegex) -> DataType

-- | A puppet value.
data PValue
PBoolean :: !Bool -> PValue
PUndef :: PValue
PString :: !Text -> PValue
PResourceReference :: !Text -> !Text -> PValue
PArray :: !(Vector PValue) -> PValue
PHash :: !(Container PValue) -> PValue
PNumber :: !Scientific -> PValue
PType :: !DataType -> PValue
PRegexp :: !CompRegex -> PValue
_PRegexp :: Prism' PValue CompRegex
_PType :: Prism' PValue DataType
_PNumber :: Prism' PValue Scientific
_PHash :: Prism' PValue (Container PValue)
_PArray :: Prism' PValue (Vector PValue)
_PResourceReference :: Prism' PValue (Text, Text)
_PString :: Prism' PValue Text
_PUndef :: Prism' PValue ()
_PBoolean :: Prism' PValue Bool

-- | Used to represent a relationship between two resources within the
--   wired format (json).
--   
--   See
--   <a>http://docs.puppetlabs.com/puppetdb/2.3/api/wire_format/catalog_format_v5.html#data-type-edge</a>
data PuppetEdge
PuppetEdge :: RIdentifier -> RIdentifier -> LinkType -> PuppetEdge

-- | See <a>puppet reference</a>.
data WireCatalog
WireCatalog :: !NodeName -> !Text -> !(Vector PuppetEdge) -> !(Vector Resource) -> !Text -> WireCatalog
[_wireCatalogNodename] :: WireCatalog -> !NodeName
[_wireCatalogVersion] :: WireCatalog -> !Text
[_wireCatalogEdges] :: WireCatalog -> !(Vector PuppetEdge)
[_wireCatalogResources] :: WireCatalog -> !(Vector Resource)
[_wireCatalogTransactionUUID] :: WireCatalog -> !Text
class HasWireCatalog c_aXbV
wireCatalog :: HasWireCatalog c_aXbV => Lens' c_aXbV WireCatalog
wireCatalogEdges :: HasWireCatalog c_aXbV => Lens' c_aXbV (Vector PuppetEdge)
wireCatalogNodename :: HasWireCatalog c_aXbV => Lens' c_aXbV NodeName
wireCatalogResources :: HasWireCatalog c_aXbV => Lens' c_aXbV (Vector Resource)
wireCatalogTransactionUUID :: HasWireCatalog c_aXbV => Lens' c_aXbV Text
wireCatalogVersion :: HasWireCatalog c_aXbV => Lens' c_aXbV Text

module Facter
type Facts = HashMap Text PValue
data FactInfo
FactInfo :: !NodeName -> !Text -> !PValue -> FactInfo
[_factInfoNodename] :: FactInfo -> !NodeName
[_factInfoName] :: FactInfo -> !Text
[_factInfoVal] :: FactInfo -> !PValue
class HasFactInfo c_a1Fho
factInfo :: HasFactInfo c_a1Fho => Lens' c_a1Fho FactInfo
factInfoName :: HasFactInfo c_a1Fho => Lens' c_a1Fho Text
factInfoNodename :: HasFactInfo c_a1Fho => Lens' c_a1Fho NodeName
factInfoVal :: HasFactInfo c_a1Fho => Lens' c_a1Fho PValue
storageunits :: [(String, Int)]
getPrefix :: Int -> String
getOrder :: String -> Int
normalizeUnit :: (Double, Int) -> Double -> (Double, Int)
storagedesc :: (String, String) -> String
factRAM :: IO [(String, String)]
factNET :: IO [(String, String)]
factOS :: IO [(String, String)]
factOSDebian :: IO [(String, String)]
factOSLSB :: IO [(String, String)]
factMountPoints :: IO [(String, String)]
fversion :: IO [(String, String)]
factUser :: IO [(String, String)]
factUName :: IO [(String, String)]
fenv :: IO [(String, String)]
factProcessor :: IO [(String, String)]
instance Facter.HasFactInfo Facter.FactInfo
instance Data.Aeson.Types.ToJSON.ToJSON Facter.FactInfo
instance Data.Aeson.Types.FromJSON.FromJSON Facter.FactInfo


-- | Common data types for PuppetDB.
module PuppetDB

-- | A dummy implementation of <a>PuppetDBAPI</a>, that will return empty
--   responses.
dummyPuppetDB :: Monad m => PuppetDBAPI m

-- | Given a <a>PDBType</a>, will try return a sane default implementation.
getDefaultDB :: PDBType -> IO (Either PrettyError (PuppetDBAPI IO))

-- | Given an URL (ie. <tt><a>http://localhost:8080</a></tt>), will return
--   an incomplete <a>PuppetDBAPI</a>.
pdbConnect :: Manager -> String -> IO (Either PrettyError (PuppetDBAPI IO))

-- | Initializes the test DB using a file to back its content
loadTestDB :: FilePath -> IO (Either PrettyError (PuppetDBAPI IO))

-- | Turns a <a>FinalCatalog</a> and <a>EdgeMap</a> into a document that
--   can be serialized and fed to <tt>puppet apply</tt>.
generateWireCatalog :: NodeName -> FinalCatalog -> EdgeMap -> WireCatalog
puppetDBFacts :: NodeName -> PuppetDBAPI IO -> IO (HashMap Text PValue)

-- | The supported PuppetDB implementations.
data PDBType

-- | Your standard PuppetDB, queried through the HTTP interface.
PDBRemote :: PDBType

-- | A stupid stub, this is the default choice.
PDBDummy :: PDBType

-- | A slow but handy PuppetDB implementation that is backed by a YAML
--   file.
PDBTest :: PDBType
data NodeInfo
NodeInfo :: !NodeName -> !Bool -> !(Maybe UTCTime) -> !(Maybe UTCTime) -> !(Maybe UTCTime) -> NodeInfo
[_nodeInfoName] :: NodeInfo -> !NodeName
[_nodeInfoDeactivated] :: NodeInfo -> !Bool
[_nodeInfoCatalogT] :: NodeInfo -> !(Maybe UTCTime)
[_nodeInfoFactsT] :: NodeInfo -> !(Maybe UTCTime)
[_nodeInfoReportT] :: NodeInfo -> !(Maybe UTCTime)
class HasNodeInfo c_a1Jy0
nodeInfo :: HasNodeInfo c_a1Jy0 => Lens' c_a1Jy0 NodeInfo
nodeInfoCatalogT :: HasNodeInfo c_a1Jy0 => Lens' c_a1Jy0 (Maybe UTCTime)
nodeInfoDeactivated :: HasNodeInfo c_a1Jy0 => Lens' c_a1Jy0 Bool
nodeInfoFactsT :: HasNodeInfo c_a1Jy0 => Lens' c_a1Jy0 (Maybe UTCTime)
nodeInfoName :: HasNodeInfo c_a1Jy0 => Lens' c_a1Jy0 NodeName
nodeInfoReportT :: HasNodeInfo c_a1Jy0 => Lens' c_a1Jy0 (Maybe UTCTime)

-- | Pretty straightforward way to define the various PuppetDB queries
data Query a
QEqual :: a -> Text -> Query a
QG :: a -> Integer -> Query a
QL :: a -> Integer -> Query a
QGE :: a -> Integer -> Query a
QLE :: a -> Integer -> Query a
QMatch :: Text -> Text -> Query a
QAnd :: [Query a] -> Query a
QOr :: [Query a] -> Query a
QNot :: (Query a) -> Query a
QEmpty :: Query a

-- | Fields for the fact endpoint
data FactField
FName :: FactField
FValue :: FactField
FCertname :: FactField

-- | Fields for the node endpoint
data NodeField
NName :: NodeField
NFact :: Text -> NodeField

-- | Fields for the resource endpoint
data ResourceField
RTag :: ResourceField
RCertname :: ResourceField
RParameter :: Text -> ResourceField
RType :: ResourceField
RTitle :: ResourceField
RExported :: ResourceField
RFile :: ResourceField
RLine :: ResourceField
data PuppetDBAPI m
PuppetDBAPI :: m Doc -> WireCatalog -> ExceptT PrettyError m () -> [(NodeName, Facts)] -> ExceptT PrettyError m () -> NodeName -> ExceptT PrettyError m () -> Query FactField -> ExceptT PrettyError m [FactInfo] -> Query ResourceField -> ExceptT PrettyError m [Resource] -> Query NodeField -> ExceptT PrettyError m [NodeInfo] -> ExceptT PrettyError m () -> NodeName -> Query ResourceField -> ExceptT PrettyError m [Resource] -> PuppetDBAPI m
[pdbInformation] :: PuppetDBAPI m -> m Doc

-- | 
--   <a>http://docs.puppetlabs.com/puppetdb/1.5/api/commands.html#replace-catalog-version-3</a>
[replaceCatalog] :: PuppetDBAPI m -> WireCatalog -> ExceptT PrettyError m ()

-- | 
--   <a>http://docs.puppetlabs.com/puppetdb/1.5/api/commands.html#replace-facts-version-1</a>
[replaceFacts] :: PuppetDBAPI m -> [(NodeName, Facts)] -> ExceptT PrettyError m ()

-- | 
--   <a>http://docs.puppetlabs.com/puppetdb/1.5/api/commands.html#deactivate-node-version-1</a>
[deactivateNode] :: PuppetDBAPI m -> NodeName -> ExceptT PrettyError m ()

-- | 
--   <a>http://docs.puppetlabs.com/puppetdb/1.5/api/query/v3/facts.html#get-v3facts</a>
[getFacts] :: PuppetDBAPI m -> Query FactField -> ExceptT PrettyError m [FactInfo]

-- | 
--   <a>http://docs.puppetlabs.com/puppetdb/1.5/api/query/v3/resources.html#get-v3resources</a>
[getResources] :: PuppetDBAPI m -> Query ResourceField -> ExceptT PrettyError m [Resource]
[getNodes] :: PuppetDBAPI m -> Query NodeField -> ExceptT PrettyError m [NodeInfo]

-- | This is only here to tell the test PuppetDB to save its content to
--   disk.
[commitDB] :: PuppetDBAPI m -> ExceptT PrettyError m ()
[getResourcesOfNode] :: PuppetDBAPI m -> NodeName -> Query ResourceField -> ExceptT PrettyError m [Resource]


-- | This module runs a Hiera server that caches Hiera data. There is a
--   huge caveat : only the data files are watched for changes, not the
--   main configuration file.
--   
--   A minor bug is that interpolation will not work for inputs containing
--   the % character when it isn't used for interpolation.
module Hiera.Server

-- | The only method you'll ever need. It runs a Hiera server and gives you
--   a querying function. | All IO exceptions are thrown directly including
--   ParsingException.
startHiera :: FilePath -> IO (HieraQueryFunc IO)

-- | A dummy hiera function that will be used when hiera is not detected.
dummyHiera :: Monad m => HieraQueryFunc m

-- | The different kind of hiera queries.
data HieraQueryType

-- | The first match in the hierarchy is returned.
QFirst :: HieraQueryType

-- | Combines array and scalar values to return a merged, flattened array
--   with all duplicate removed.
QUnique :: HieraQueryType

-- | Combines the keys and values of any number of hashes to return a
--   merged hash. | Use of an Hash to specify the merge behavior
QHash :: HieraQueryType
QDeep :: Maybe Text -> Bool -> Bool -> HieraQueryType
[_knockoutPrefix] :: HieraQueryType -> Maybe Text
[_sortMerged] :: HieraQueryType -> Bool
[_mergeHashArray] :: HieraQueryType -> Bool
readQueryType :: Text -> Maybe HieraQueryType

-- | The type of the Hiera API function associated to given hierarchy.
type HieraQueryFunc m = Container Text  Scope: all variables that Hiera can interpolate (the top level ones are prefixed with '::') -> Text  The query -> HieraQueryType -> m (Either PrettyError (Maybe PValue))
instance Data.Aeson.Types.FromJSON.FromJSON Hiera.Server.HieraConfigFile
instance GHC.Show.Show Hiera.Server.HieraConfigFile
instance GHC.Show.Show Hiera.Server.InterpolableHieraString
instance GHC.Show.Show Hiera.Server.HieraStringPart
instance GHC.Show.Show Hiera.Server.Backend
instance GHC.Show.Show Hiera.Server.HieraQueryType
instance Data.Aeson.Types.FromJSON.FromJSON Hiera.Server.InterpolableHieraString
instance Text.PrettyPrint.ANSI.Leijen.Internal.Pretty Hiera.Server.HieraStringPart


-- | Entry point to general Erb service This module share no dependency
--   with Puppet modules
module Erb
data Value
Literal :: !Text -> Value
Interpolable :: ![Expression] -> Value
Symbol :: !Text -> Value
Array :: ![Expression] -> Value
data Expression
LookupOperation :: !Expression -> !Expression -> Expression
PlusOperation :: !Expression -> !Expression -> Expression
MinusOperation :: !Expression -> !Expression -> Expression
DivOperation :: !Expression -> !Expression -> Expression
MultiplyOperation :: !Expression -> !Expression -> Expression
ShiftLeftOperation :: !Expression -> !Expression -> Expression
ShiftRightOperation :: !Expression -> !Expression -> Expression
AndOperation :: !Expression -> !Expression -> Expression
OrOperation :: !Expression -> !Expression -> Expression
EqualOperation :: !Expression -> !Expression -> Expression
DifferentOperation :: !Expression -> !Expression -> Expression
AboveOperation :: !Expression -> !Expression -> Expression
AboveEqualOperation :: !Expression -> !Expression -> Expression
UnderEqualOperation :: !Expression -> !Expression -> Expression
UnderOperation :: !Expression -> !Expression -> Expression
RegexpOperation :: !Expression -> !Expression -> Expression
NotRegexpOperation :: !Expression -> !Expression -> Expression
NotOperation :: !Expression -> Expression
NegOperation :: !Expression -> Expression
ConditionalValue :: !Expression -> !Expression -> Expression
Object :: !Expression -> Expression
ScopeObject :: !Expression -> Expression
MethodCall :: !Expression -> !Expression -> Expression
BlockOperation :: !Text -> Expression
Value :: !Value -> Expression
BTrue :: Expression
BFalse :: Expression
Error :: !String -> Expression
data RubyStatement
Puts :: !Expression -> RubyStatement
DropPrevSpace :: !RubyStatement -> RubyStatement
DropPrevSpace' :: RubyStatement
DropNextSpace :: !RubyStatement -> RubyStatement
def :: GenLanguageDef String u Identity
lexer :: GenTokenParser String u Identity
parens :: Parser a -> Parser a
braces :: Parser a -> Parser a
operator :: Parser String
symbol :: String -> Parser String
reservedOp :: String -> Parser ()
whiteSpace :: Parser ()
naturalOrFloat :: Parser (Either Integer Double)
identifier :: Parser String
rubyexpression :: Parser Expression
table :: [[Operator String () Identity Expression]]
term :: Parser Expression
scopeLookup :: Parser Expression
stringLiteral :: Parser Expression
doubleQuoted :: Parser Value
singleQuoted :: Parser Value
objectterm :: Parser Expression
variablereference :: Parser Expression
rubystatement :: Parser RubyStatement
textblockW :: Maybe Char -> Parser [RubyStatement]
textblock :: Parser [RubyStatement]
rubyblock :: Parser [RubyStatement]
erbparser :: Parser [RubyStatement]
parseErbFile :: FilePath -> IO (Either ParseError [RubyStatement])
parseErbString :: String -> Either ParseError [RubyStatement]


-- | Parse puppet source code from text.
module Puppet.Parser

-- | Run a puppet parser against some <a>Text</a> input.
runPuppetParser :: String -> Text -> Either PuppetParseError (Vector Statement)
type Parser = Parsec Void Text

-- | Parse a collection of puppet <a>Statement</a>.
puppetParser :: Parser (Vector Statement)
type PuppetParseError = ParseError Char Void

-- | Build a <a>PrettyError</a> from a <a>ParseError</a> given the text
--   source. The source is used to display the line on which the error
--   occurs.
prettyParseError :: Text -> ParseError Char Void -> PrettyError

-- | Parse an <a>Expression</a>.
expression :: Parser Expression
datatype :: Parser UDataType

-- | Pretty print a series of statements.
ppStatements :: Vector Statement -> Doc

-- | The <a>Expression</a>s
data Expression
Equal :: !Expression -> !Expression -> Expression
Different :: !Expression -> !Expression -> Expression
Not :: !Expression -> Expression
And :: !Expression -> !Expression -> Expression
Or :: !Expression -> !Expression -> Expression
LessThan :: !Expression -> !Expression -> Expression
MoreThan :: !Expression -> !Expression -> Expression
LessEqualThan :: !Expression -> !Expression -> Expression
MoreEqualThan :: !Expression -> !Expression -> Expression
RegexMatch :: !Expression -> !Expression -> Expression
NotRegexMatch :: !Expression -> !Expression -> Expression
Contains :: !Expression -> !Expression -> Expression
Addition :: !Expression -> !Expression -> Expression
Substraction :: !Expression -> !Expression -> Expression
Division :: !Expression -> !Expression -> Expression
Multiplication :: !Expression -> !Expression -> Expression
Modulo :: !Expression -> !Expression -> Expression
RightShift :: !Expression -> !Expression -> Expression
LeftShift :: !Expression -> !Expression -> Expression
Lookup :: !Expression -> !Expression -> Expression
Negate :: !Expression -> Expression

-- | All conditionals are stored in this format.
ConditionalValue :: !Expression -> !(Vector (Pair SelectorCase Expression)) -> Expression

-- | This is for <i>higher order functions</i>.
FunctionApplication :: !Expression -> !Expression -> Expression

-- | Terminal object contains no expression
Terminal :: !UnresolvedValue -> Expression
data SelectorCase
SelectorValue :: !UnresolvedValue -> SelectorCase
SelectorType :: !UDataType -> SelectorCase
SelectorDefault :: SelectorCase

-- | An unresolved value, typically the parser's output.
data UnresolvedValue

-- | Special tokens generated when parsing the <tt>true</tt> or
--   <tt>false</tt> literals.
UBoolean :: !Bool -> UnresolvedValue

-- | Raw string.
UString :: !Text -> UnresolvedValue

-- | A string that might contain variable references. The type should be
--   refined at one point.
UInterpolable :: !(Vector Expression) -> UnresolvedValue

-- | Special token that is generated when parsing the <tt>undef</tt>
--   literal.
UUndef :: UnresolvedValue

-- | A Resource[reference]
UResourceReference :: !Text -> !Expression -> UnresolvedValue
UArray :: !(Vector Expression) -> UnresolvedValue
UHash :: !(Vector (Pair Expression Expression)) -> UnresolvedValue

-- | The regular expression compilation is performed during parsing.
URegexp :: !CompRegex -> UnresolvedValue
UVariableReference :: !Text -> UnresolvedValue
UFunctionCall :: !Text -> !(Vector Expression) -> UnresolvedValue
UHOLambdaCall :: !HOLambdaCall -> UnresolvedValue
UNumber :: !Scientific -> UnresolvedValue
UDataType :: UDataType -> UnresolvedValue

-- | <i>High Order lambdas</i>.
data LambdaFunc
LambEach :: LambdaFunc
LambMap :: LambdaFunc
LambReduce :: LambdaFunc
LambFilter :: LambdaFunc
LambSlice :: LambdaFunc
LambLookup :: LambdaFunc
data HOLambdaCall
HOLambdaCall :: !LambdaFunc -> !(Maybe Expression) -> !LambdaParameters -> !(Vector Statement) -> !(Maybe Expression) -> HOLambdaCall
[_hoLambdaFunc] :: HOLambdaCall -> !LambdaFunc
[_hoLambdaExpr] :: HOLambdaCall -> !(Maybe Expression)
[_hoLambdaParams] :: HOLambdaCall -> !LambdaParameters
[_hoLambdaStatements] :: HOLambdaCall -> !(Vector Statement)
[_hoLambdaLastExpr] :: HOLambdaCall -> !(Maybe Expression)
data ChainableRes
ChainResColl :: !ResCollDecl -> ChainableRes
ChainResDecl :: !ResDecl -> ChainableRes
ChainResRefr :: !Text -> [Expression] -> !PPosition -> ChainableRes
class HasHOLambdaCall c_a1mIv
hOLambdaCall :: HasHOLambdaCall c_a1mIv => Lens' c_a1mIv HOLambdaCall
hoLambdaExpr :: HasHOLambdaCall c_a1mIv => Lens' c_a1mIv (Maybe Expression)
hoLambdaFunc :: HasHOLambdaCall c_a1mIv => Lens' c_a1mIv LambdaFunc
hoLambdaLastExpr :: HasHOLambdaCall c_a1mIv => Lens' c_a1mIv (Maybe Expression)
hoLambdaParams :: HasHOLambdaCall c_a1mIv => Lens' c_a1mIv LambdaParameters
hoLambdaStatements :: HasHOLambdaCall c_a1mIv => Lens' c_a1mIv (Vector Statement)
data LambdaParameter
LParam :: !(Maybe UDataType) -> !Text -> LambdaParameter

-- | Lambda block parameters:
--   
--   Currently only two types of block parameters are supported: single
--   values and pairs.
data LambdaParameters

-- | <pre>
--   |k|
--   </pre>
BPSingle :: !LambdaParameter -> LambdaParameters

-- | <pre>
--   |k,v|
--   </pre>
BPPair :: !LambdaParameter -> !LambdaParameter -> LambdaParameters
data CompRegex
CompRegex :: !Text -> !Regex -> CompRegex
data CollectorType
Collector :: CollectorType
ExportedCollector :: CollectorType
data Virtuality

-- | Normal resource, that will be included in the catalog.
Normal :: Virtuality

-- | Type for virtual resources.
Virtual :: Virtuality

-- | Type for exported resources.
Exported :: Virtuality

-- | These are resources that are exported AND realized in the catalog.
ExportedRealized :: Virtuality
data NodeDesc
NodeName :: !Text -> NodeDesc
NodeMatch :: !CompRegex -> NodeDesc
NodeDefault :: NodeDesc

-- | Relationship/ordering between resources.
data LinkType

-- | Applies a resource after the target resource.
RRequire :: LinkType

-- | Applies a resource before the target resource.
RBefore :: LinkType

-- | Applies a resource before the target resource. The target resource
--   refreshes if the notifying resource changes.
RNotify :: LinkType

-- | Applies a resource after the target resource. The subscribing resource
--   refreshes if the target resource changes.
RSubscribe :: LinkType
data UDataType
UDTType :: UDataType
UDTString :: (Maybe Int) -> (Maybe Int) -> UDataType
UDTInteger :: (Maybe Int) -> (Maybe Int) -> UDataType
UDTFloat :: (Maybe Double) -> (Maybe Double) -> UDataType
UDTBoolean :: UDataType
UDTArray :: UDataType -> Int -> (Maybe Int) -> UDataType
UDTHash :: UDataType -> UDataType -> Int -> (Maybe Int) -> UDataType
UDTUndef :: UDataType
UDTScalar :: UDataType
UDTData :: UDataType
UDTOptional :: UDataType -> UDataType
UNotUndef :: UDataType
UDTVariant :: (NonEmpty UDataType) -> UDataType
UDTPattern :: (NonEmpty CompRegex) -> UDataType
UDTEnum :: (NonEmpty Expression) -> UDataType
UDTAny :: UDataType
UDTCollection :: UDataType
UDTRegexp :: (Maybe CompRegex) -> UDataType

-- | Search expression inside collector `<a>searchexpr |</a>`
data SearchExpression
EqualitySearch :: !Text -> !Expression -> SearchExpression
NonEqualitySearch :: !Text -> !Expression -> SearchExpression
AndSearch :: !SearchExpression -> !SearchExpression -> SearchExpression
OrSearch :: !SearchExpression -> !SearchExpression -> SearchExpression
AlwaysTrue :: SearchExpression
data AttributeDecl
AttributeDecl :: !Text -> !ArrowOp -> !Expression -> AttributeDecl
AttributeWildcard :: !Expression -> AttributeDecl
data ArrowOp

-- | <tt>+&gt;</tt>
AppendArrow :: ArrowOp

-- | `=&gt;`
AssignArrow :: ArrowOp

-- | All types of conditional statements : <tt>case</tt>, <tt>if</tt>, ...
--   
--   Stored as an ordered list of pair <tt> (condition, statements) </tt>.
--   Interpreted as "if first cond is true, choose first statements, else
--   take the next pair, check the condition ..."
data ConditionalDecl
ConditionalDecl :: !(Vector (Pair Expression (Vector Statement))) -> !PPosition -> ConditionalDecl
data ClassDecl
ClassDecl :: !Text -> !(Vector (Pair (Pair Text (Maybe UDataType)) (Maybe Expression))) -> !(Maybe Text) -> !(Vector Statement) -> !PPosition -> ClassDecl

-- | Resource default:
--   
--   <pre>
--   File { mode =&gt; 755 }
--   </pre>
--   
--   <a>puppet reference</a>.
data ResDefaultDecl
ResDefaultDecl :: !Text -> !(Vector AttributeDecl) -> !PPosition -> ResDefaultDecl
data DepDecl
DepDecl :: !(Pair Text Expression) -> !(Pair Text Expression) -> !LinkType -> !PPosition -> DepDecl

-- | All possible statements.
data Statement
ResourceDeclaration :: !ResDecl -> Statement
ResourceDefaultDeclaration :: !ResDefaultDecl -> Statement
ResourceOverrideDeclaration :: !ResOverrideDecl -> Statement
ResourceCollectionDeclaration :: !ResCollDecl -> Statement
ClassDeclaration :: !ClassDecl -> Statement
DefineDeclaration :: !DefineDecl -> Statement
NodeDeclaration :: !NodeDecl -> Statement
ConditionalDeclaration :: !ConditionalDecl -> Statement
VarAssignmentDeclaration :: !VarAssignDecl -> Statement
MainFunctionDeclaration :: !MainFuncDecl -> Statement
HigherOrderLambdaDeclaration :: !HigherOrderLambdaDecl -> Statement
DependencyDeclaration :: !DepDecl -> Statement

-- | Special statement used to include the expressions that are top level.
--   Certainly buggy, but probably just like the original implementation.
TopContainer :: !(Vector Statement) -> !Statement -> Statement

-- | Resource declaration:
--   
--   <pre>
--   file { mode =&gt; 755}
--   </pre>
data ResDecl
ResDecl :: !Text -> !Expression -> !(Vector AttributeDecl) -> !Virtuality -> !PPosition -> ResDecl

-- | Resource override:
--   
--   <pre>
--   File[<tt>title</tt>] { mode =&gt; 755}
--   </pre>
--   
--   See <a>puppet reference</a>.
data ResOverrideDecl
ResOverrideDecl :: !Text -> !Expression -> !(Vector AttributeDecl) -> !PPosition -> ResOverrideDecl
data DefineDecl
DefineDecl :: !Text -> !(Vector (Pair (Pair Text (Maybe UDataType)) (Maybe Expression))) -> !(Vector Statement) -> !PPosition -> DefineDecl

-- | A node is a collection of statements + maybe an inherit node.
data NodeDecl
NodeDecl :: !NodeDesc -> !(Vector Statement) -> !(Maybe NodeDesc) -> !PPosition -> NodeDecl

-- | <pre>
--   $newvar = <tt>world</tt>
--   </pre>
data VarAssignDecl
VarAssignDecl :: Maybe UDataType -> !Text -> !Expression -> !PPosition -> VarAssignDecl
[_vadtype] :: VarAssignDecl -> Maybe UDataType
[_vadname] :: VarAssignDecl -> !Text
[_vadvalue] :: VarAssignDecl -> !Expression
[_vadpos] :: VarAssignDecl -> !PPosition
data MainFuncDecl
MainFuncDecl :: !Text -> !(Vector Expression) -> !PPosition -> MainFuncDecl

-- | <i>Higher order function</i> call.
data HigherOrderLambdaDecl
HigherOrderLambdaDecl :: !HOLambdaCall -> !PPosition -> HigherOrderLambdaDecl

-- | Resource Collector including exported collector (`&lt;&lt;|
--   |&gt;&gt;`)
--   
--   <pre>
--   User &lt;| title == <tt>jenkins</tt> |&gt; { groups +&gt; "docker"}
--   </pre>
--   
--   See <a>puppet reference</a>
data ResCollDecl
ResCollDecl :: !CollectorType -> !Text -> !SearchExpression -> !(Vector AttributeDecl) -> !PPosition -> ResCollDecl
_Statements :: Lens' Statement [Statement]
_ResDecl :: Prism' Statement ResDecl
_ResDefaultDecl :: Prism' Statement ResDefaultDecl
_ResOverrDecl :: Prism' Statement ResOverrideDecl
_ResCollDecl :: Prism' Statement ResCollDecl
_ConditionalDecl :: Prism' Statement ConditionalDecl
_ClassDecl :: Prism' Statement ClassDecl
_DefineDecl :: Prism' Statement DefineDecl
_NodeDecl :: Prism' Statement NodeDecl
_VarAssignDecl :: Prism' Statement VarAssignDecl
_MainFuncDecl :: Prism' Statement MainFuncDecl
_HigherOrderLambdaDecl :: Prism' Statement HigherOrderLambdaDecl
_DepDecl :: Prism' Statement DepDecl
_Equal :: Prism' Expression (Expression, Expression)
_Different :: Prism' Expression (Expression, Expression)
_Not :: Prism' Expression Expression
_And :: Prism' Expression (Expression, Expression)
_Or :: Prism' Expression (Expression, Expression)
_LessThan :: Prism' Expression (Expression, Expression)
_MoreThan :: Prism' Expression (Expression, Expression)
_LessEqualThan :: Prism' Expression (Expression, Expression)
_MoreEqualThan :: Prism' Expression (Expression, Expression)
_RegexMatch :: Prism' Expression (Expression, Expression)
_NotRegexMatch :: Prism' Expression (Expression, Expression)
_Contains :: Prism' Expression (Expression, Expression)
_Addition :: Prism' Expression (Expression, Expression)
_Substraction :: Prism' Expression (Expression, Expression)
_Division :: Prism' Expression (Expression, Expression)
_Multiplication :: Prism' Expression (Expression, Expression)
_Modulo :: Prism' Expression (Expression, Expression)
_RightShift :: Prism' Expression (Expression, Expression)
_LeftShift :: Prism' Expression (Expression, Expression)
_Lookup :: Prism' Expression (Expression, Expression)
_Negate :: Prism' Expression Expression
_ConditionalValue :: Prism' Expression (Expression, Vector (Pair SelectorCase Expression))
_FunctionApplication :: Prism' Expression (Expression, Expression)
_Terminal :: Prism' Expression UnresolvedValue
instance Data.Foldable.Foldable Puppet.Parser.OperatorChain

module Puppet.Interpreter

-- | Call the operational <a>interpretMonad</a> function to compute the
--   catalog. Returns either an error, or a tuple containing all the
--   resources, dependency map, exported resources, and defined resources
--   alongside with all messages that have been generated by the
--   compilation process.
--   
--   The later defined resources (eg. all class declarations) are pulled
--   out of the <a>InterpreterState</a> and might not be up to date. There
--   are only useful for coverage testing (checking dependencies for
--   instance).
interpretCatalog :: Monad m => InterpreterReader m -> NodeName -> Facts -> Container Text -> m (Pair (Either PrettyError (FinalCatalog, EdgeMap, FinalCatalog, [Resource])) [Pair Priority Doc])

-- | Main internal entry point, this function completes the interpretation
--   TODO: add some doc here
computeCatalog :: NodeName -> InterpreterMonad (FinalCatalog, EdgeMap, FinalCatalog, [Resource])
evaluateStatement :: Statement -> InterpreterMonad [Resource]
initialState :: Facts -> Container Text -> InterpreterState
extractFromState :: InterpreterState -> Maybe (Text, Container ScopeInformation)
containerModName :: CurContainerDesc -> Text
data InterpreterState
InterpreterState :: !(Container ScopeInformation) -> !(Container (Pair ClassIncludeType PPosition)) -> !(HashMap RIdentifier Resource) -> ![CurContainerDesc] -> !PPosition -> !(HashMap (TopLevelType, Text) Statement) -> ![LinkInformation] -> ![ResourceModifier] -> InterpreterState
scopes :: Lens' InterpreterState (Container ScopeInformation)
definedResources :: Lens' InterpreterState (HashMap RIdentifier Resource)
nestedDeclarations :: Lens' InterpreterState (HashMap (TopLevelType, Text) Statement)
resModifiers :: Lens' InterpreterState [ResourceModifier]
extraRelations :: Lens' InterpreterState [LinkInformation]
curScope :: Lens' InterpreterState [CurContainerDesc]
curPos :: Lens' InterpreterState PPosition
loadedClasses :: Lens' InterpreterState (Container (Pair ClassIncludeType PPosition))
data InterpreterReader m
InterpreterReader :: !(Container NativeTypeMethods) -> TopLevelType -> Text -> m (Either PrettyError Statement) -> TemplateSource -> InterpreterState -> InterpreterReader m -> m (Either PrettyError Text) -> PuppetDBAPI m -> Container ([PValue] -> InterpreterMonad PValue) -> Text -> HieraQueryLayers m -> IoMethods m -> HashSet Text -> HashSet Text -> Bool -> PuppetDirPaths -> Maybe FilePath -> InterpreterReader m
readerNativeTypes :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (Container NativeTypeMethods)
readerGetStatement :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (TopLevelType -> Text -> m_a2Ak6 (Either PrettyError Statement))
readerGetTemplate :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (TemplateSource -> InterpreterState -> InterpreterReader m_a2Ak6 -> m_a2Ak6 (Either PrettyError Text))
readerPdbApi :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (PuppetDBAPI m_a2Ak6)
readerExternalFunc :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (Container ([PValue] -> InterpreterMonad PValue))
readerNodename :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) Text
readerHieraQuery :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (HieraQueryLayers m_a2Ak6)
readerIoMethods :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (IoMethods m_a2Ak6)
readerIgnoredModules :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (HashSet Text)
readerExternalModules :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (HashSet Text)
readerIsStrict :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) Bool
readerPuppetPaths :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) PuppetDirPaths
readerRebaseFile :: forall m_a2Ak6. Lens' (InterpreterReader m_a2Ak6) (Maybe FilePath)

-- | The main monad
type InterpreterMonad = ProgramT InterpreterInstr (State InterpreterState)

-- | Log
type InterpreterWriter = [Pair Priority Doc]
data InterpreterInstr a
[GetNativeTypes] :: InterpreterInstr (Container NativeTypeMethods)
[GetStatement] :: TopLevelType -> Text -> InterpreterInstr Statement
[ComputeTemplate] :: TemplateSource -> InterpreterState -> InterpreterInstr Text
[ExternalFunction] :: Text -> [PValue] -> InterpreterInstr PValue
[GetNodeName] :: InterpreterInstr Text
[HieraQuery] :: Container Text -> Text -> HieraQueryType -> InterpreterInstr (Maybe PValue)
[GetCurrentCallStack] :: InterpreterInstr [String]
[IsIgnoredModule] :: Text -> InterpreterInstr Bool
[IsExternalModule] :: Text -> InterpreterInstr Bool
[IsStrict] :: InterpreterInstr Bool
[PuppetPaths] :: InterpreterInstr PuppetDirPaths
[RebaseFile] :: InterpreterInstr (Maybe FilePath)
[ErrorThrow] :: PrettyError -> InterpreterInstr a
[ErrorCatch] :: InterpreterMonad a -> (PrettyError -> InterpreterMonad a) -> InterpreterInstr a
[WriterTell] :: InterpreterWriter -> InterpreterInstr ()
[WriterPass] :: InterpreterMonad (a, InterpreterWriter -> InterpreterWriter) -> InterpreterInstr a
[WriterListen] :: InterpreterMonad a -> InterpreterInstr (a, InterpreterWriter)
[PDBInformation] :: InterpreterInstr Doc
[PDBReplaceCatalog] :: WireCatalog -> InterpreterInstr ()
[PDBReplaceFacts] :: [(NodeName, Facts)] -> InterpreterInstr ()
[PDBDeactivateNode] :: NodeName -> InterpreterInstr ()
[PDBGetFacts] :: Query FactField -> InterpreterInstr [FactInfo]
[PDBGetResources] :: Query ResourceField -> InterpreterInstr [Resource]
[PDBGetNodes] :: Query NodeField -> InterpreterInstr [NodeInfo]
[PDBCommitDB] :: InterpreterInstr ()
[PDBGetResourcesOfNode] :: NodeName -> Query ResourceField -> InterpreterInstr [Resource]
[ReadFile] :: [Text] -> InterpreterInstr Text
[TraceEvent] :: String -> InterpreterInstr ()

-- | The intepreter can run in two modes : a strict mode (recommended), and
--   a permissive mode.
data Strictness
Strict :: Strictness
Permissive :: Strictness
data IoMethods m
IoMethods :: m [String] -> [Text] -> m (Either String Text) -> String -> m () -> IoMethods m
ioGetCurrentCallStack :: forall m_a2Ak8. Lens' (IoMethods m_a2Ak8) (m_a2Ak8 [String])
ioReadFile :: forall m_a2Ak8. Lens' (IoMethods m_a2Ak8) ([Text] -> m_a2Ak8 (Either String Text))
ioTraceEvent :: forall m_a2Ak8. Lens' (IoMethods m_a2Ak8) (String -> m_a2Ak8 ())
class Monad m => MonadThrowPos m
throwPosError :: MonadThrowPos m => Doc -> m a
data ResourceModifier
ResourceModifier :: !Text -> !ModifierType -> !ResourceCollectorType -> !RSearchExpression -> !(Resource -> InterpreterMonad Resource) -> !PPosition -> ResourceModifier
rmResType :: Lens' ResourceModifier Text
rmDeclaration :: Lens' ResourceModifier PPosition
rmSearch :: Lens' ResourceModifier RSearchExpression
rmType :: Lens' ResourceModifier ResourceCollectorType
rmMutation :: Lens' ResourceModifier (Resource -> InterpreterMonad Resource)
rmModifierType :: Lens' ResourceModifier ModifierType
data ModifierType

-- | For collectors, optional resources
ModifierCollector :: ModifierType

-- | For stuff like realize
ModifierMustMatch :: ModifierType
data OverrideType

-- | Overriding forbidden, will throw an error
CantOverride :: OverrideType

-- | Can silently replace
Replace :: OverrideType

-- | Silently ignore errors
CantReplace :: OverrideType

-- | Can append values
AppendAttribute :: OverrideType
data ResourceCollectorType
RealizeVirtual :: ResourceCollectorType
RealizeCollected :: ResourceCollectorType
DontRealize :: ResourceCollectorType

-- | Puppet has two main ways to declare classes: include-like and
--   resource-like.
--   
--   See <a>puppet reference</a>.
data ClassIncludeType

-- | Using the include or contain function
ClassIncludeLike :: ClassIncludeType

-- | Resource like declaration
ClassResourceLike :: ClassIncludeType
data RSearchExpression
REqualitySearch :: !Text -> !PValue -> RSearchExpression
RNonEqualitySearch :: !Text -> !PValue -> RSearchExpression
RAndSearch :: !RSearchExpression -> !RSearchExpression -> RSearchExpression
ROrSearch :: !RSearchExpression -> !RSearchExpression -> RSearchExpression
RAlwaysTrue :: RSearchExpression
data ScopeInformation
ScopeInformation :: !(Container (Pair (Pair PValue PPosition) CurContainerDesc)) -> !(Container ResDefaults) -> !(HashSet Text) -> !CurContainer -> !(HashMap RIdentifier ResRefOverride) -> !(Maybe Text) -> ScopeInformation
scopeResDefaults :: Lens' ScopeInformation (Container ResDefaults)
scopeVariables :: Lens' ScopeInformation (Container (Pair (Pair PValue PPosition) CurContainerDesc))
scopeParent :: Lens' ScopeInformation (Maybe Text)
scopeOverrides :: Lens' ScopeInformation (HashMap RIdentifier ResRefOverride)
scopeContainer :: Lens' ScopeInformation CurContainer
scopeExtraTags :: Lens' ScopeInformation (HashSet Text)

-- | The type of the container together with its tags.
data CurContainer
CurContainer :: !CurContainerDesc -> !(HashSet Text) -> CurContainer
cctype :: Lens' CurContainer CurContainerDesc
cctags :: Lens' CurContainer (HashSet Text)

-- | From the evaluation of Resource Default Declaration.
data ResDefaults
ResDefaults :: !Text -> !Text -> !(Container PValue) -> !PPosition -> ResDefaults
resDefValues :: Lens' ResDefaults (Container PValue)
resDefSrcScope :: Lens' ResDefaults Text
resDefPos :: Lens' ResDefaults PPosition
resDefType :: Lens' ResDefaults Text

-- | From the evaluation of Resource Override Declaration.
data ResRefOverride
ResRefOverride :: !RIdentifier -> !(Container PValue) -> !PPosition -> ResRefOverride
[_rrid] :: ResRefOverride -> !RIdentifier
[_rrparams] :: ResRefOverride -> !(Container PValue)
[_rrpos] :: ResRefOverride -> !PPosition
data ScopeEnteringContext
SENormal :: ScopeEnteringContext

-- | We enter the scope as the child of another class
SEChild :: !Text -> ScopeEnteringContext

-- | We enter the scope as the parent of another class
SEParent :: !Text -> ScopeEnteringContext

-- | Differentiate the distinct top level types such as node, define or
--   class.
data TopLevelType

-- | For node entries
TopNode :: TopLevelType

-- | For defines
TopDefine :: TopLevelType

-- | For classes
TopClass :: TopLevelType

-- | All available queries including the global and module layer The
--   environment layer is not implemented.
--   
--   The datatype belongs to the <a>Puppet.Interpreter</a> module because
--   it serves to implement how Hiera is used within Puppet.
data HieraQueryLayers m
HieraQueryLayers :: HieraQueryFunc m -> Container (HieraQueryFunc m) -> HieraQueryLayers m
[_globalLayer] :: HieraQueryLayers m -> HieraQueryFunc m
[_moduleLayer] :: HieraQueryLayers m -> Container (HieraQueryFunc m)
globalLayer :: forall m_a2Ak7. Lens' (HieraQueryLayers m_a2Ak7) (HieraQueryFunc m_a2Ak7)
moduleLayer :: forall m_a2Ak7. Lens' (HieraQueryLayers m_a2Ak7) (Container (HieraQueryFunc m_a2Ak7))

-- | Whether the template source is specified <tt>inline</tt> or loaded
--   from a file.
data TemplateSource
Inline :: Text -> TemplateSource
Filename :: FilePath -> TemplateSource

-- | A pure function for resolving variables.
getVariable :: Container ScopeInformation -> Text -> Text -> Either Doc PValue

-- | Turns a <a>PValue</a> into a <a>Bool</a> as explained in the reference
--   documentation.
pValue2Bool :: PValue -> Bool

-- | Resolves a variable, or throws an error if it can't.
resolveVariable :: Text -> InterpreterMonad PValue

-- | The main resolution function : turns an <a>Expression</a> into a
--   <a>PValue</a>, if possible.
resolveExpression :: Expression -> InterpreterMonad PValue

-- | Resolves an <a>UnresolvedValue</a> (terminal for the <a>Expression</a>
--   data type) into a <a>PValue</a>
resolveValue :: UnresolvedValue -> InterpreterMonad PValue

-- | Turns strings, numbers and booleans into <a>Text</a>, or throws an
--   error.
resolvePValueString :: PValue -> InterpreterMonad Text

-- | Turns everything it can into a number, or throws an error
resolvePValueNumber :: PValue -> InterpreterMonad Scientific

-- | <pre>
--   resolveExpressionString = resolveExpression &gt;=&gt; resolvePValueString
--   </pre>
resolveExpressionString :: Expression -> InterpreterMonad Text

-- | Just like <a>resolveExpressionString</a>, but accepts arrays.
resolveExpressionStrings :: Expression -> InterpreterMonad [Text]
resolveFunction' :: Text -> [PValue] -> InterpreterMonad PValue
resolveDataType :: UDataType -> InterpreterMonad DataType

-- | A hiera helper function, that will throw all Hiera errors and log
--   messages to the main monad.
runHiera :: Text -> HieraQueryType -> InterpreterMonad (Maybe PValue)

-- | A simple helper that checks if a given type is native or a define.
isNativeType :: Text -> InterpreterMonad Bool

-- | Turns an unresolved <a>SearchExpression</a> from the parser into a
--   fully resolved <a>RSearchExpression</a>.
resolveSearchExpression :: SearchExpression -> InterpreterMonad RSearchExpression

-- | Checks whether a given <a>Resource</a> matches a
--   <a>RSearchExpression</a>. Note that the expression doesn't check for
--   type, so you must filter the resources by type beforehand, if needs
--   be.
checkSearchExpression :: RSearchExpression -> Resource -> Bool

-- | Turns a resource type and <a>RSearchExpression</a> into something that
--   can be used in a PuppetDB query.
searchExpressionToPuppetDB :: Text -> RSearchExpression -> Query ResourceField

-- | Generates variable associations for evaluation of blocks. Each item
--   corresponds to an iteration in the calling block.
hfGenerateAssociations :: HOLambdaCall -> InterpreterMonad [[(Text, PValue)]]

-- | Sets the proper variables, and returns the scope variables the way
--   they were before being modified. This is a hack that ensures that
--   variables are local to the new scope.
--   
--   It doesn't work at all like other Puppet parts, but consistency isn't
--   really expected here ...
hfSetvars :: [(Text, PValue)] -> InterpreterMonad (Container (Pair (Pair PValue PPosition) CurContainerDesc))

-- | Restores what needs restoring. This will erase all allocations.
hfRestorevars :: Container (Pair (Pair PValue PPosition) CurContainerDesc) -> InterpreterMonad ()

-- | Converts class resource names to lowercase (fix for the jenkins
--   plugin).
fixResourceName :: Text -> Text -> Text

-- | Checks that a value matches a puppet datatype
datatypeMatch :: DataType -> PValue -> Bool
checkMatch :: DataType -> PValue -> InterpreterMonad ()

-- | The operational interpreter function
interpretMonad :: Monad m => InterpreterReader m -> InterpreterState -> InterpreterMonad a -> m (Either PrettyError a, InterpreterState, InterpreterWriter)


-- | At the top of the abstraction level, the module exposes all high-end
--   services:
--   
--   <ul>
--   <li>the preferences container</li>
--   <li>the puppet daemon</li>
--   <li>the statistic module</li>
--   <li>the stdlib functions</li>
--   <li>a bunch of pure runners</li>
--   </ul>
--   
--   Naturally nothing from <a>Puppet.Runner</a> should be used in lower
--   abstraction layers.
module Puppet.Runner
data Preferences m
Preferences :: PuppetDirPaths -> PuppetDBAPI m -> Container NativeTypeMethods -> Container ([PValue] -> InterpreterMonad PValue) -> Maybe FilePath -> HashSet Text -> Strictness -> Bool -> [Text] -> [Text] -> HashSet Text -> Container Text -> Container PValue -> Container PValue -> Priority -> Maybe FilePath -> Preferences m
prefPuppetPaths :: forall m_a3I3r. Lens' (Preferences m_a3I3r) PuppetDirPaths
prefPDB :: forall m_a3I3r m_a3I8n. Lens (Preferences m_a3I3r) (Preferences m_a3I8n) (PuppetDBAPI m_a3I3r) (PuppetDBAPI m_a3I8n)
prefNatTypes :: forall m_a3I3r. Lens' (Preferences m_a3I3r) (Container NativeTypeMethods)
prefExtFuncs :: forall m_a3I3r. Lens' (Preferences m_a3I3r) (Container ([PValue] -> InterpreterMonad PValue))
prefHieraPath :: forall m_a3I3r. Lens' (Preferences m_a3I3r) (Maybe FilePath)
prefIgnoredmodules :: forall m_a3I3r. Lens' (Preferences m_a3I3r) (HashSet Text)
prefStrictness :: forall m_a3I3r. Lens' (Preferences m_a3I3r) Strictness
prefExtraTests :: forall m_a3I3r. Lens' (Preferences m_a3I3r) Bool
prefKnownusers :: forall m_a3I3r. Lens' (Preferences m_a3I3r) [Text]
prefKnowngroups :: forall m_a3I3r. Lens' (Preferences m_a3I3r) [Text]
prefExternalmodules :: forall m_a3I3r. Lens' (Preferences m_a3I3r) (HashSet Text)
prefPuppetSettings :: forall m_a3I3r. Lens' (Preferences m_a3I3r) (Container Text)
prefFactsOverride :: forall m_a3I3r. Lens' (Preferences m_a3I3r) (Container PValue)
prefFactsDefault :: forall m_a3I3r. Lens' (Preferences m_a3I3r) (Container PValue)
prefLogLevel :: forall m_a3I3r. Lens' (Preferences m_a3I3r) Priority
prefRebaseFile :: forall m_a3I3r. Lens' (Preferences m_a3I3r) (Maybe FilePath)

-- | Generate default preferences.
dfPreferences :: FilePath -> IO (Preferences IO)
data PuppetDirPaths
class HasPuppetDirPaths c_avnk
puppetDirPaths :: HasPuppetDirPaths c_avnk => Lens' c_avnk PuppetDirPaths
baseDir :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath
manifestPath :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath
modulesPath :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath
templatesPath :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath
testPath :: HasPuppetDirPaths c_avnk => Lens' c_avnk FilePath

-- | A default evaluation function for arbitrary interpreter actions.
dummyEval :: InterpreterMonad a -> Either PrettyError a

-- | A bunch of facts that can be used for pure evaluation.
dummyFacts :: Facts

-- | Evaluates an interpreter expression in a pure context.
pureEval :: Facts -> HashMap (TopLevelType, Text) Statement -> InterpreterMonad a -> (Either PrettyError a, InterpreterState, InterpreterWriter)

-- | More general version of <a>pureEval</a> where you pass the initial
--   state directly
pureEval' :: HashMap (TopLevelType, Text) Statement -> InterpreterState -> InterpreterMonad a -> (Either PrettyError a, InterpreterState, InterpreterWriter)

-- | A pure <a>InterpreterReader</a>, that can only evaluate a subset of
--   the templates, and that can include only the supplied top level
--   statements.
pureReader :: HashMap (TopLevelType, Text) Statement -> InterpreterReader Identity

-- | Wraps a computation, and measures related execution statistics.
measure :: MStats -> Text -> IO a -> IO a

-- | Create a new statistical container.
newStats :: IO MStats

-- | Returns the actual statistical values.
getStats :: MStats -> IO StatsTable
data StatsPoint
StatsPoint :: !Int -> !Double -> !Double -> !Double -> StatsPoint

-- | Total number of calls to a computation
[_statspointCount] :: StatsPoint -> !Int

-- | Total time spent during this computation
[_statspointTotal] :: StatsPoint -> !Double

-- | Minimum execution time
[_statspointMin] :: StatsPoint -> !Double

-- | Maximum execution time
[_statspointMax] :: StatsPoint -> !Double
data MStats

-- | Contains the implementation of the StdLib functions.
stdlibFunctions :: Container ([PValue] -> InterpreterMonad PValue)

-- | API for the Daemon. The main method is <a>getCatalog</a>: given a node
--   and a list of facts, it returns the result of the compilation. This
--   will be either an error, or a tuple containing:
--   
--   <ul>
--   <li>all the resources in this catalog</li>
--   <li>the dependency map</li>
--   <li>the exported resources</li>
--   <li>a list of known resources, that might not be up to date, but are
--   here for code coverage tests.</li>
--   </ul>
--   
--   Notes :
--   
--   <ul>
--   <li>It might be buggy when top level statements that are not
--   class/define/nodes are altered.</li>
--   </ul>
data Daemon
Daemon :: NodeName -> Facts -> IO (Either PrettyError (FinalCatalog, EdgeMap, FinalCatalog, [Resource])) -> MStats -> MStats -> MStats -> Daemon
[getCatalog] :: Daemon -> NodeName -> Facts -> IO (Either PrettyError (FinalCatalog, EdgeMap, FinalCatalog, [Resource]))
[parserStats] :: Daemon -> MStats
[catalogStats] :: Daemon -> MStats
[templateStats] :: Daemon -> MStats

-- | Entry point to get a Daemon. It will initialize the parsing and
--   interpretation infrastructure from the <a>Preferences</a>.
--   
--   Cache the AST of every .pp file. It could use a bit of memory. As a
--   comparison, it fits in 60 MB with the author's manifests, but really
--   breathes when given 300 MB of heap space. In this configuration, even
--   if it spawns a ruby process for every template evaluation, it is way
--   faster than the puppet stack.
--   
--   It can optionally talk with PuppetDB, by setting an URL via the
--   <a>prefPDB</a>. The recommended way to set it to
--   <a>http://localhost:8080</a> and set a SSH tunnel :
--   
--   <pre>
--   ssh -L 8080:localhost:8080 puppet.host
--   </pre>
initDaemon :: Preferences IO -> IO Daemon

-- | Evaluate a list of ruby statements.
rubyEvaluate :: Container ScopeInformation -> ScopeName -> [RubyStatement] -> Either Doc Text
