packages feed

language-puppet 0.11.0 → 0.11.1

raw patch · 2 files changed

+11/−55 lines, 2 filesdep ~filecachedep ~strict-base-types

Dependency ranges changed: filecache, strict-base-types

Files

Puppet/Parser.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE LambdaCase, GeneralizedNewtypeDeriving #-} module Puppet.Parser (puppetParser,expression,runMyParser) where  import qualified Data.Text as T@@ -26,12 +26,10 @@ import Text.Parsec.Error (ParseError) import Text.Parsec.Text () import qualified Text.Parsec.Prim as PP-import qualified Text.Parsec.Char as PP import Text.Parsec.Text () -import Unsafe.Coerce- newtype Parser a = Parser { unParser :: PP.ParsecT T.Text () IO a }+                   deriving (Functor, Monad, Parsing, LookAheadParsing, CharParsing, Applicative, Alternative, MonadIO)  getPosition :: Parser SourcePos getPosition = Parser PP.getPosition@@ -41,48 +39,6 @@  type OP = PP.ParsecT T.Text () IO -instance Functor Parser where-    fmap = unsafeCoerce (fmap :: (a -> b) -> OP a -> OP b)--instance Monad Parser where-    return = unsafeCoerce (return :: a -> OP a)-    fail = unsafeCoerce (fail :: String -> OP ())-    (>>=) = unsafeCoerce ((>>=) :: OP a -> (a -> OP b) -> OP b)--instance Parsing Parser where-    try           = unsafeCoerce (PP.try :: OP a -> OP a)-    (<?>)         = unsafeCoerce ((<?>) :: OP a -> String -> OP a)-    skipMany      = unsafeCoerce (PP.skipMany :: OP a -> OP ())-    skipSome      = unsafeCoerce (skipSome :: OP a -> OP ())-    unexpected    = unsafeCoerce (PP.unexpected :: String -> OP ())-    eof           = unsafeCoerce (eof :: OP ())-    notFollowedBy = Parser . notFollowedBy . unParser--instance LookAheadParsing Parser where-    lookAhead = unsafeCoerce (PP.lookAhead :: OP a -> OP a)--instance CharParsing Parser where-    satisfy = unsafeCoerce (PP.satisfy :: (Char -> Bool) -> OP Char)-    char    = unsafeCoerce (PP.char :: Char -> OP Char)-    notChar = Parser . notChar-    anyChar = unsafeCoerce (PP.anyChar :: OP Char)-    string  = unsafeCoerce (PP.string :: String -> OP String)--instance Applicative Parser where-    pure  = unsafeCoerce (pure :: a -> OP a)-    (<*>) = unsafeCoerce ((<*>) :: OP (a -> b) -> OP a -> OP b)-    (*>)  = unsafeCoerce ((*>) :: OP a -> OP b -> OP b)-    (<*)  = unsafeCoerce ((<*) :: OP a -> OP b -> OP a)--instance Alternative Parser where-    empty = unsafeCoerce (empty :: OP a)-    (<|>) = unsafeCoerce ((<|>) :: OP a -> OP a -> OP a)-    some  = unsafeCoerce (some :: OP a -> OP [a])-    many  = unsafeCoerce (many :: OP a -> OP [a])--instance MonadIO Parser where-    liftIO = unsafeCoerce (liftIO :: IO a -> OP a)- instance TokenParsing Parser where     someSpace = skipMany (simpleSpace <|> oneLineComment <|> multiLineComment)       where@@ -259,7 +215,7 @@     -- include foo::bar     let argsc sep e = (fmap (PValue . UString) (qualif1 className) <|> e <?> "Function argument A") `sep` comma         terminalF = terminalG (fail "function hack")-        expressionF = unsafeCoerce (buildExpressionParser expressionTable (unsafeCoerce (token terminalF)) <?> "function expression")+        expressionF = Parser (buildExpressionParser expressionTable (unParser (token terminalF)) <?> "function expression")         withparens = parens (argsc sepEndBy expression)         withoutparens = argsc sepEndBy1 expressionF     args  <- withparens <|> if nonparens@@ -308,7 +264,7 @@  expression :: Parser Expression expression = condExpression-             <|> unsafeCoerce (buildExpressionParser expressionTable (unsafeCoerce (token terminal)))+             <|> Parser (buildExpressionParser expressionTable (unParser (token terminal)))              <?> "expression"     where         condExpression = do@@ -357,10 +313,10 @@                     ]                   ]     where-        operator' :: String -> OP String-        operator' = unsafeCoerce operator-        reserved' :: String -> OP String-        reserved' = unsafeCoerce reserved+        operator' :: String -> OP ()+        operator' = unParser . operator+        reserved' :: String -> OP ()+        reserved' = unParser . reserved  stringExpression :: Parser Expression stringExpression = fmap (PValue . UInterpolable) interpolableString <|> (reserved "undef" *> return (PValue UUndef)) <|> fmap (PValue . UBoolean) puppetBool <|> variableOrHash <|> fmap (PValue . UString) literalValue
language-puppet.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                language-puppet-version:             0.11.0+version:             0.11.1 synopsis:            Tools to parse and evaluate the Puppet DSL. description:         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 ! homepage:            http://lpuppet.banquise.net/@@ -81,7 +81,7 @@   -- other-modules:          build-depends:       base ==4.6.*                         , bytestring-                        , strict-base-types    >= 0.2+                        , strict-base-types    >= 0.2.2                         , hashable             == 1.2.*                         , unordered-containers == 0.2.*                         , text                 >= 0.11@@ -98,7 +98,7 @@                         , transformers         == 0.3.*                         , hslogger             == 1.2.*                         , time                 == 1.4.*-                        , filecache            >= 0.2.3  && < 0.3+                        , filecache            >= 0.2.4  && < 0.3                         , regex-pcre-builtin   >= 0.94.4                         , pcre-utils           >= 0.1.0.1 && < 0.2                         , process              == 1.1.*