From 0264f4a5dc37b16f872e6fa92bd8f1fc1e2b1826 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 23 Jul 2021 14:28:35 -0400 Subject: Automatically detect Haskell dependencies This parses the files contents for imports, then uses ghc-pkg to lookup the package that provides the module. Now I can do that analysis in Haskell instead of nix, which is much easier to code with. --- Biz/Log.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Biz/Log.hs') diff --git a/Biz/Log.hs b/Biz/Log.hs index 9a790aa..747efed 100644 --- a/Biz/Log.hs +++ b/Biz/Log.hs @@ -1,7 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE NoImplicitPrelude #-} --- : dep rainbow module Biz.Log ( Lvl (..), good, @@ -44,7 +43,7 @@ msg lvl labels = -- systemd doesn't render msgs produced by putChunk, so when live we don't -- use rainbow at all "Live" -> putStr txt - _ -> Rainbow.putChunk <| fore color <| clear <> chunk txt <> "\r" + _ -> Rainbow.hPutChunks IO.stderr [fore color <| clear <> chunk txt <> "\r"] where txt = Text.intercalate gap (label : labels) (color, label) = case lvl of @@ -60,7 +59,7 @@ gap :: Text gap = ": " br :: IO () -br = Rainbow.putChunk "\n" >> IO.hFlush stdout +br = Rainbow.hPutChunks stderr ["\n"] >> IO.hFlush stderr good, pass, info, warn, fail :: [Text] -> IO () good = msg Good @@ -74,12 +73,13 @@ mark :: Show a => Text -> a -> a mark label val = unsafePerformIO <| do msg Mark [label, tshow val] + br pure val -- | Pipelined version of 'mark'. -- -- @ --- mark label val = val ~| label +-- mark label val = val ~& label -- @ (~&) :: Show a => a -> Text -> a (~&) val label = mark label val -- cgit v1.2.3