pseudo-boolean 0.1.6.0 → 0.1.7.0
raw patch · 3 files changed
+38/−43 lines, 3 filesdep ~megaparsecPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: megaparsec
API changes (from Hackage documentation)
+ Data.PseudoBoolean.Megaparsec: type ParseError = ParseErrorBundle ByteString Void
- Data.PseudoBoolean.Megaparsec: parseOPBByteString :: String -> ByteString -> Either (ParseError Word8 Void) Formula
+ Data.PseudoBoolean.Megaparsec: parseOPBByteString :: String -> ByteString -> Either ParseError Formula
- Data.PseudoBoolean.Megaparsec: parseOPBFile :: FilePath -> IO (Either (ParseError Word8 Void) Formula)
+ Data.PseudoBoolean.Megaparsec: parseOPBFile :: FilePath -> IO (Either ParseError Formula)
- Data.PseudoBoolean.Megaparsec: parseOPBString :: String -> String -> Either (ParseError Word8 Void) Formula
+ Data.PseudoBoolean.Megaparsec: parseOPBString :: String -> String -> Either ParseError Formula
- Data.PseudoBoolean.Megaparsec: parseWBOByteString :: String -> ByteString -> Either (ParseError Word8 Void) SoftFormula
+ Data.PseudoBoolean.Megaparsec: parseWBOByteString :: String -> ByteString -> Either ParseError SoftFormula
- Data.PseudoBoolean.Megaparsec: parseWBOFile :: FilePath -> IO (Either (ParseError Word8 Void) SoftFormula)
+ Data.PseudoBoolean.Megaparsec: parseWBOFile :: FilePath -> IO (Either ParseError SoftFormula)
- Data.PseudoBoolean.Megaparsec: parseWBOString :: String -> String -> Either (ParseError Word8 Void) SoftFormula
+ Data.PseudoBoolean.Megaparsec: parseWBOString :: String -> String -> Either ParseError SoftFormula
Files
- README.md +5/−1
- pseudo-boolean.cabal +11/−5
- src/Data/PseudoBoolean/Megaparsec.hs +22/−37
README.md view
@@ -1,4 +1,8 @@ # pseudo-boolean Haskell library for parsing/generating OPB/WBO files used in pseudo boolean competition. -[](http://travis-ci.org/msakai/pseudo-boolean) [](https://coveralls.io/r/msakai/pseudo-boolean) [](https://hackage.haskell.org/package/pseudo-boolean)+[](https://travis-ci.org/msakai/pseudo-boolean)+[](https://coveralls.io/r/msakai/pseudo-boolean)+[](https://hackage.haskell.org/package/pseudo-boolean)+[](https://packdeps.haskellers.com/feed?needle=pseudo-boolean)+[](https://opensource.org/licenses/BSD-3-Clause)
pseudo-boolean.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: pseudo-boolean-version: 0.1.6.0+version: 0.1.7.0 synopsis: Reading/Writing OPB/WBO files used in pseudo boolean competition description: Reading\/Writing OPB\/WBO files used in pseudo boolean competition homepage: https://github.com/msakai/pseudo-boolean@@ -21,6 +21,12 @@ test/samples/normalized-1096.cudf.paranoid.opb test/samples/*.wbo cabal-version: >=1.10+tested-with:+ GHC ==7.8.4+ GHC ==7.10.3+ GHC ==8.0.2+ GHC ==8.2.2+ GHC ==8.4.3 source-repository head type: git@@ -46,10 +52,10 @@ FlexibleContexts OverloadedStrings build-depends:- base >=4.6.0.1 && <4.11,+ base >=4.6.0.1 && <4.13, containers >=0.4.2.1, parsec >=3.1.2 && <4,- megaparsec >=4 && <7,+ megaparsec >=4 && <8, bytestring >=0.9.2.1 && <0.11, bytestring-builder, dlist >=0.7.0 && <0.9.0,@@ -69,8 +75,8 @@ base, bytestring, tasty >=0.10.1,- tasty-hunit ==0.9.*,- tasty-quickcheck >=0.8 && <0.10,+ tasty-hunit >=0.9 && <0.11,+ tasty-quickcheck >=0.8 && <0.11, tasty-th, HUnit, QuickCheck >=2.5 && <3,
src/Data/PseudoBoolean/Megaparsec.hs view
@@ -33,6 +33,9 @@ , parseWBOString , parseWBOByteString , parseWBOFile++ -- * Error type+ , ParseError ) where import Prelude hiding (sum)@@ -46,7 +49,8 @@ import Data.Word import Data.Void #endif-import Text.Megaparsec+import Text.Megaparsec hiding (ParseError)+import qualified Text.Megaparsec as MP #if MIN_VERSION_megaparsec(6,0,0) import Text.Megaparsec.Byte #else@@ -75,6 +79,11 @@ #endif +#if MIN_VERSION_megaparsec(7,0,0)+anyChar :: C e s m => m Word8+anyChar = anySingle+#endif+ -- | Parser for OPB files #if MIN_VERSION_megaparsec(6,0,0) opbParser :: (MonadParsec e s m, Token s ~ Word8, IsString (Tokens s)) => m Formula@@ -246,37 +255,30 @@ literal :: C e s m => m Lit literal = variablename <|> (char8 '~' >> liftM negate variablename) +#if MIN_VERSION_megaparsec(7,0,0)+type ParseError = MP.ParseErrorBundle BL.ByteString Void+#elif MIN_VERSION_megaparsec(6,0,0)+type ParseError = MP.ParseError Word8 Void+#elif MIN_VERSION_megaparsec(5,0,0)+type ParseError = MP.ParseError Char Dec+#else+type ParseError = MP.ParseError+#endif+ -- | Parse a OPB format string containing pseudo boolean problem.+parseOPBString :: String -> String -> Either ParseError Formula #if MIN_VERSION_megaparsec(6,0,0)-parseOPBString :: String -> String -> Either (ParseError Word8 Void) Formula parseOPBString info s = parse (formula <* eof) info (BL.pack s) #else-#if MIN_VERSION_megaparsec(5,0,0)-parseOPBString :: String -> String -> Either (ParseError Char Dec) Formula-#else-parseOPBString :: String -> String -> Either ParseError Formula-#endif parseOPBString = parse (formula <* eof) #endif -- | Parse a OPB format lazy bytestring containing pseudo boolean problem.-#if MIN_VERSION_megaparsec(6,0,0)-parseOPBByteString :: String -> ByteString -> Either (ParseError Word8 Void) Formula-#elif MIN_VERSION_megaparsec(5,0,0)-parseOPBByteString :: String -> ByteString -> Either (ParseError Char Dec) Formula-#else parseOPBByteString :: String -> ByteString -> Either ParseError Formula-#endif parseOPBByteString = parse (formula <* eof) -- | Parse a OPB file containing pseudo boolean problem.-#if MIN_VERSION_megaparsec(6,0,0)-parseOPBFile :: FilePath -> IO (Either (ParseError Word8 Void) Formula)-#elif MIN_VERSION_megaparsec(5,0,0)-parseOPBFile :: FilePath -> IO (Either (ParseError Char Dec) Formula)-#else parseOPBFile :: FilePath -> IO (Either ParseError Formula)-#endif parseOPBFile filepath = do s <- BL.readFile filepath return $! parse (formula <* eof) filepath s@@ -331,36 +333,19 @@ return (Just cost, c) -- | Parse a WBO format string containing weighted boolean optimization problem.+parseWBOString :: String -> String -> Either ParseError SoftFormula #if MIN_VERSION_megaparsec(6,0,0)-parseWBOString :: String -> String -> Either (ParseError Word8 Void) SoftFormula parseWBOString info s = parse (softformula <* eof) info (BL.pack s) #else-#if MIN_VERSION_megaparsec(5,0,0)-parseWBOString :: String -> String -> Either (ParseError Char Dec) SoftFormula-#else-parseWBOString :: String -> String -> Either ParseError SoftFormula-#endif parseWBOString = parse (softformula <* eof) #endif -- | Parse a WBO format lazy bytestring containing pseudo boolean problem.-#if MIN_VERSION_megaparsec(6,0,0)-parseWBOByteString :: String -> ByteString -> Either (ParseError Word8 Void) SoftFormula-#elif MIN_VERSION_megaparsec(5,0,0)-parseWBOByteString :: String -> ByteString -> Either (ParseError Char Dec) SoftFormula-#else parseWBOByteString :: String -> ByteString -> Either ParseError SoftFormula-#endif parseWBOByteString = parse (softformula <* eof) -- | Parse a WBO file containing weighted boolean optimization problem.-#if MIN_VERSION_megaparsec(6,0,0)-parseWBOFile :: FilePath -> IO (Either (ParseError Word8 Void) SoftFormula)-#elif MIN_VERSION_megaparsec(5,0,0)-parseWBOFile :: FilePath -> IO (Either (ParseError Char Dec) SoftFormula)-#else parseWBOFile :: FilePath -> IO (Either ParseError SoftFormula)-#endif parseWBOFile filepath = do s <- BL.readFile filepath return $! parse (softformula <* eof) filepath s