From 3e0fc912477f5fd894b96139cac03b8d3cc52523 Mon Sep 17 00:00:00 2001 From: Vanessa McHale Date: Sun, 29 Jul 2018 23:58:32 -0500 Subject: [PATCH] release --- ats-pkg/ats-pkg.cabal | 2 +- ats-pkg/src/Language/ATS/Package/Build.hs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ats-pkg/ats-pkg.cabal b/ats-pkg/ats-pkg.cabal index 01999b0c..f0685fa5 100644 --- a/ats-pkg/ats-pkg.cabal +++ b/ats-pkg/ats-pkg.cabal @@ -1,6 +1,6 @@ cabal-version: 2.0 name: ats-pkg -version: 3.1.0.5 +version: 3.1.0.6 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018 Vanessa McHale diff --git a/ats-pkg/src/Language/ATS/Package/Build.hs b/ats-pkg/src/Language/ATS/Package/Build.hs index b9c50160..2a14fab9 100644 --- a/ats-pkg/src/Language/ATS/Package/Build.hs +++ b/ats-pkg/src/Language/ATS/Package/Build.hs @@ -117,16 +117,19 @@ mkManpage mStr = do -- cfgFile :: FilePath -- cfgFile = ".atspkg" "config" +parens :: String -> String +parens s = mconcat [ "(", s, ")" ] + -- FIXME this doesn't rebuild when it should; it should rebuild when -- @atspkg.dhall@ changes. getConfig :: MonadIO m => Maybe String -> Maybe FilePath -> m Pkg getConfig mStr dir' = liftIO $ do d <- fromMaybe <$> fmap ( "atspkg.dhall") getCurrentDirectory <*> pure dir' b <- not <$> doesFileExist (".atspkg" "config") - let strMod = maybe id (\s -> (<> (" " <> s))) mStr + let go = case mStr of { Just x -> (<> (" " <> parens x)) ; Nothing -> id } b' <- shouldWrite mStr (".atspkg" "args") if b || b' - then input auto (T.pack (strMod d)) + then input auto (T.pack (go d)) else fmap (decode . BSL.fromStrict) . BS.readFile $ ".atspkg" "config" manTarget :: Text -> FilePath @@ -217,7 +220,7 @@ mkConfig mStr = do (".atspkg" "config") %> \out -> do need ["atspkg.dhall", args] - let go = case mStr of { Just x -> (<> (" " <> x)) ; Nothing -> id } + let go = case mStr of { Just x -> (<> (" " <> parens x)) ; Nothing -> id } x <- liftIO $ input auto (T.pack (go "./atspkg.dhall")) liftIO $ BSL.writeFile out (encode (x :: Pkg))