-- 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
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_a115s
nativeTypeMethods :: HasNativeTypeMethods c_a115s => Lens' c_a115s NativeTypeMethods
puppetFields :: HasNativeTypeMethods c_a115s => Lens' c_a115s (HashSet Text)
puppetValidate :: HasNativeTypeMethods c_a115s => Lens' c_a115s 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_auPz
puppetDirPaths :: HasPuppetDirPaths c_auPz => Lens' c_auPz PuppetDirPaths
baseDir :: HasPuppetDirPaths c_auPz => Lens' c_auPz FilePath
manifestPath :: HasPuppetDirPaths c_auPz => Lens' c_auPz FilePath
modulesPath :: HasPuppetDirPaths c_auPz => Lens' c_auPz FilePath
templatesPath :: HasPuppetDirPaths c_auPz => Lens' c_auPz FilePath
testPath :: HasPuppetDirPaths c_auPz => Lens' c_auPz 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_aPj9
resource :: HasResource c_aPj9 => Lens' c_aPj9 Resource
ralias :: HasResource c_aPj9 => Lens' c_aPj9 (HashSet Text)
rattributes :: HasResource c_aPj9 => Lens' c_aPj9 (Container PValue)
rid :: HasResource c_aPj9 => Lens' c_aPj9 RIdentifier
rnode :: HasResource c_aPj9 => Lens' c_aPj9 NodeName
rpos :: HasResource c_aPj9 => Lens' c_aPj9 PPosition
rrelations :: HasResource c_aPj9 => Lens' c_aPj9 (HashMap RIdentifier (HashSet LinkType))
rscope :: HasResource c_aPj9 => Lens' c_aPj9 [CurContainerDesc]
rtags :: HasResource c_aPj9 => Lens' c_aPj9 (HashSet Text)
rvirtuality :: HasResource c_aPj9 => Lens' c_aPj9 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_aPtp
rIdentifier :: HasRIdentifier c_aPtp => Lens' c_aPtp RIdentifier
iname :: HasRIdentifier c_aPtp => Lens' c_aPtp Text
itype :: HasRIdentifier c_aPtp => Lens' c_aPtp 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_aQa3
linkInformation :: HasLinkInformation c_aQa3 => Lens' c_aQa3 LinkInformation
linkPos :: HasLinkInformation c_aQa3 => Lens' c_aQa3 PPosition
linkType :: HasLinkInformation c_aQa3 => Lens' c_aQa3 LinkType
linkdst :: HasLinkInformation c_aQa3 => Lens' c_aQa3 RIdentifier
linksrc :: HasLinkInformation c_aQa3 => Lens' c_aQa3 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_aZ8p
wireCatalog :: HasWireCatalog c_aZ8p => Lens' c_aZ8p WireCatalog
wireCatalogEdges :: HasWireCatalog c_aZ8p => Lens' c_aZ8p (Vector PuppetEdge)
wireCatalogNodename :: HasWireCatalog c_aZ8p => Lens' c_aZ8p NodeName
wireCatalogResources :: HasWireCatalog c_aZ8p => Lens' c_aZ8p (Vector Resource)
wireCatalogTransactionUUID :: HasWireCatalog c_aZ8p => Lens' c_aZ8p Text
wireCatalogVersion :: HasWireCatalog c_aZ8p => Lens' c_aZ8p 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_a1ICa
factInfo :: HasFactInfo c_a1ICa => Lens' c_a1ICa FactInfo
factInfoName :: HasFactInfo c_a1ICa => Lens' c_a1ICa Text
factInfoNodename :: HasFactInfo c_a1ICa => Lens' c_a1ICa NodeName
factInfoVal :: HasFactInfo c_a1ICa => Lens' c_a1ICa 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_a1MVD
nodeInfo :: HasNodeInfo c_a1MVD => Lens' c_a1MVD NodeInfo
nodeInfoCatalogT :: HasNodeInfo c_a1MVD => Lens' c_a1MVD (Maybe UTCTime)
nodeInfoDeactivated :: HasNodeInfo c_a1MVD => Lens' c_a1MVD Bool
nodeInfoFactsT :: HasNodeInfo c_a1MVD => Lens' c_a1MVD (Maybe UTCTime)
nodeInfoName :: HasNodeInfo c_a1MVD => Lens' c_a1MVD NodeName
nodeInfoReportT :: HasNodeInfo c_a1MVD => Lens' c_a1MVD (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_a1oVJ
hOLambdaCall :: HasHOLambdaCall c_a1oVJ => Lens' c_a1oVJ HOLambdaCall
hoLambdaExpr :: HasHOLambdaCall c_a1oVJ => Lens' c_a1oVJ (Maybe Expression)
hoLambdaFunc :: HasHOLambdaCall c_a1oVJ => Lens' c_a1oVJ LambdaFunc
hoLambdaLastExpr :: HasHOLambdaCall c_a1oVJ => Lens' c_a1oVJ (Maybe Expression)
hoLambdaParams :: HasHOLambdaCall c_a1oVJ => Lens' c_a1oVJ LambdaParameters
hoLambdaStatements :: HasHOLambdaCall c_a1oVJ => Lens' c_a1oVJ (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_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (Container NativeTypeMethods)
readerGetStatement :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (TopLevelType -> Text -> m_a2Mrz (Either PrettyError Statement))
readerGetTemplate :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (TemplateSource -> InterpreterState -> InterpreterReader m_a2Mrz -> m_a2Mrz (Either PrettyError Text))
readerPdbApi :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (PuppetDBAPI m_a2Mrz)
readerExternalFunc :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (Container ([PValue] -> InterpreterMonad PValue))
readerNodename :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) Text
readerHieraQuery :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (HieraQueryLayers m_a2Mrz)
readerIoMethods :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (IoMethods m_a2Mrz)
readerIgnoredModules :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (HashSet Text)
readerExternalModules :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (HashSet Text)
readerIsStrict :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) Bool
readerPuppetPaths :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) PuppetDirPaths
readerRebaseFile :: forall m_a2Mrz. Lens' (InterpreterReader m_a2Mrz) (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_a2MrB. Lens' (IoMethods m_a2MrB) (m_a2MrB [String])
ioReadFile :: forall m_a2MrB. Lens' (IoMethods m_a2MrB) ([Text] -> m_a2MrB (Either String Text))
ioTraceEvent :: forall m_a2MrB. Lens' (IoMethods m_a2MrB) (String -> m_a2MrB ())
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_a2MrA. Lens' (HieraQueryLayers m_a2MrA) (HieraQueryFunc m_a2MrA)
moduleLayer :: forall m_a2MrA. Lens' (HieraQueryLayers m_a2MrA) (Container (HieraQueryFunc m_a2MrA))

-- | 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_a3W3F. Lens' (Preferences m_a3W3F) PuppetDirPaths
prefPDB :: forall m_a3W3F m_a3W8E. Lens (Preferences m_a3W3F) (Preferences m_a3W8E) (PuppetDBAPI m_a3W3F) (PuppetDBAPI m_a3W8E)
prefNatTypes :: forall m_a3W3F. Lens' (Preferences m_a3W3F) (Container NativeTypeMethods)
prefExtFuncs :: forall m_a3W3F. Lens' (Preferences m_a3W3F) (Container ([PValue] -> InterpreterMonad PValue))
prefHieraPath :: forall m_a3W3F. Lens' (Preferences m_a3W3F) (Maybe FilePath)
prefIgnoredmodules :: forall m_a3W3F. Lens' (Preferences m_a3W3F) (HashSet Text)
prefStrictness :: forall m_a3W3F. Lens' (Preferences m_a3W3F) Strictness
prefExtraTests :: forall m_a3W3F. Lens' (Preferences m_a3W3F) Bool
prefKnownusers :: forall m_a3W3F. Lens' (Preferences m_a3W3F) [Text]
prefKnowngroups :: forall m_a3W3F. Lens' (Preferences m_a3W3F) [Text]
prefExternalmodules :: forall m_a3W3F. Lens' (Preferences m_a3W3F) (HashSet Text)
prefPuppetSettings :: forall m_a3W3F. Lens' (Preferences m_a3W3F) (Container Text)
prefFactsOverride :: forall m_a3W3F. Lens' (Preferences m_a3W3F) (Container PValue)
prefFactsDefault :: forall m_a3W3F. Lens' (Preferences m_a3W3F) (Container PValue)
prefLogLevel :: forall m_a3W3F. Lens' (Preferences m_a3W3F) Priority
prefRebaseFile :: forall m_a3W3F. Lens' (Preferences m_a3W3F) (Maybe FilePath)

-- | Generate default preferences.
dfPreferences :: FilePath -> IO (Preferences IO)
data PuppetDirPaths
class HasPuppetDirPaths c_auPz
puppetDirPaths :: HasPuppetDirPaths c_auPz => Lens' c_auPz PuppetDirPaths
baseDir :: HasPuppetDirPaths c_auPz => Lens' c_auPz FilePath
manifestPath :: HasPuppetDirPaths c_auPz => Lens' c_auPz FilePath
modulesPath :: HasPuppetDirPaths c_auPz => Lens' c_auPz FilePath
templatesPath :: HasPuppetDirPaths c_auPz => Lens' c_auPz FilePath
testPath :: HasPuppetDirPaths c_auPz => Lens' c_auPz 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
