From 49b4cf05fba4aff0ca8de92f274bfc5c4752f5e2 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 4 Aug 2022 09:48:48 -0400 Subject: Add wutbar glyph and use it --- Alpha.hs | 5 +++++ Biz/Bild.hs | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/Alpha.hs b/Alpha.hs index 619973c..6cc9b18 100644 --- a/Alpha.hs +++ b/Alpha.hs @@ -54,6 +54,7 @@ module Alpha (?:), (?.), (?+), + (?|), -- * Text str, @@ -187,6 +188,10 @@ _ ?+ [] = panic "wutlus: empty cond list" (?<) :: Bool -> (Bool -> Text -> a) -> Text -> a a ?< f = if not a then f a else panic "wutgal failed" +-- | When. wutbar +(?|) :: Applicative f => Bool -> f () -> f () +a ?| f = when a f + -- | Removes newlinse from a string. strip :: String -> String strip = filter (/= '\n') diff --git a/Biz/Bild.hs b/Biz/Bild.hs index ed59598..ea5875f 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -383,30 +383,30 @@ analyze hmap ns = case Map.lookup ns hmap of /> Regex.match (metaSys "//") |> catMaybes |> Set.fromList - guileFlags <- - if "guile_3_0" `elem` sysdeps - then - Process.readProcess "guile-config" ["compile"] "" - /> String.words - /> (++ ["-shared", "-fPIC"]) - /> map Text.pack - else pure mempty - Just - outToPath out], []) - ], - outPath = outToPath out, - .. - } + ("guile_3_0" `elem` sysdeps) + ?. ( pure mempty, + Process.readProcess "guile-config" ["compile"] "" + /> String.words + /> (++ ["-shared", "-fPIC"]) + /> map Text.pack + ) + +> \guileFlags -> + Target + { langdeps = Set.empty, -- c has no lang deps...? + compiler = Gcc, + builder = Local <| user, + compilerFlags = + concat + [ [o, dir, Text.pack absPath] ++ guileFlags + | let outable = out /= None, + o <- outable ?: (["-o"], []), + dir <- outable ?: ([Text.pack <| root outToPath out], []) + ], + outPath = outToPath out, + .. + } + |> Just + |> pure Namespace.Hs -> do langdeps <- detectHaskellImports contentLines let out = @@ -654,7 +654,7 @@ build andTest loud analysis = do Guile -> do Log.info ["bild", "dev", "guile", nschunk namespace] _ <- proc loud namespace "guild" compilerFlags - when (out /= None) <| do + (out /= None) ?| do writeFile (root outToPath out) <| Text.pack -- cgit v1.2.3