call-alloy 0.3.0.2 → 0.3.0.3
raw patch · 3 files changed
+76/−1 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- call-alloy.cabal +1/−1
- src/Language/Alloy/Internal/Call.hs +71/−0
ChangeLog.md view
@@ -4,6 +4,10 @@ ## Released changes +### 0.3.0.3++- fix runtime error on WARN+ ### 0.3.0.2 - fix runtime error on PARTIAL_INSTANCE
call-alloy.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: call-alloy-version: 0.3.0.2+version: 0.3.0.3 synopsis: A simple library to call Alloy given a specification description: Please see the README on GitHub at <https://github.com/marcellussiegburg/call-alloy#readme> category: Language
src/Language/Alloy/Internal/Call.hs view
@@ -169,6 +169,24 @@ filterLast _ [] = [] filterLast p x@[_] = filter p x filterLast p (x:xs) = x:filterLast p xs+{-+ prependLine xs = BS.append xs . BS.append "\n"+ getWholeOutput h inst = do+ eof <- hIsEOF h+ if eof+ then do+ let inst' = inst ""+ return $ if BS.null inst'+ then id+ else (inst' :)+ else catch+ (do+ l <- BS.hGetLine h+ if l == begin+ then (. ((inst . prependLine l $ "") :)) <$> getWholeOutput h id+ else getWholeOutput h $ inst . prependLine l)+ (\(_ :: IOException) -> return id)+-} getWholeOutput h = do eof <- hIsEOF h if eof@@ -206,6 +224,12 @@ and @+[main] WARN kodkod.engine.config.Reporter - Temporal formula: will be reduced to possibly unsound static version.+@++and++@ PARTIAL_INSTANCE @ @@ -215,6 +239,8 @@ removeInfoLines (x:xs) | Just _ <- BS.stripPrefix "[main] INFO" x = removeInfoLines xs+ | Just _ <- BS.stripPrefix "[main] WARN" x+ = removeInfoLines xs | x == partialInstance = removeInfoLines xs removeInfoLines xs = xs@@ -250,6 +276,51 @@ getClassPath = do mclassPath' <- readIORef mclassPath maybe readClassPath return mclassPath'++{-+{-+data CallAlloyConfig = Config {+ alloyJarFile :: FilePath,+ alloyClassFile :: FilePath,+ keepFiles :: Bool+ }+-}++jarFileEnv :: String+jarFileEnv = "ALLOY_JAR_FILE"++callAlloyEnv :: String+callAlloyEnv = "CALL_ALLOY_CLASS_FILE"++keepFilesEnv :: String+keepFilesEnv = "KEEP_ALLOY_FILES"++{-|+Lookup environment variables which are to prefer if present.+-}+getEnvironmentInformation :: IO CallAlloyConfig+getEnvironmentInformation = do+ alloy <- lookupEnv jarFileEnv+ callAlloy <- lookupEnv callAlloyEnv+ keep <- lookupEnv keepFilesEnv+ let mconfig = Config <$> alloy <*> callAlloy <*> pure (isJust keep)+ case mconfig of+ Nothing -> do+ dataDir <- getXdgDirectory XdgData $ appName </> "dataDir"+ Just c -> return c+-}+{-+getVersionFile :: IO FilePath+getVersionFile = do+ configDir <- getXdgDirectory XdgConfig appName+ let versionFile = configDir </> "version"+ exists <- doesFileExist versionFile+ if exists+ then do+ version <- read <$> readFile versionFile+ unless (version == versionHash) $ createVersionFile configDir versionFile+ else createVersionFile configDir versionFile+-} fallbackToTempDir :: IO FilePath -> IO FilePath fallbackToTempDir m = catch m $ \e ->