summaryrefslogtreecommitdiff
path: root/Biz/Log.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-07-23 14:28:35 -0400
committerBen Sima <ben@bsima.me>2021-11-26 13:47:37 -0500
commit0264f4a5dc37b16f872e6fa92bd8f1fc1e2b1826 (patch)
treedb66845496f21afe845abaa23546b82be9c8adf0 /Biz/Log.hs
parent7f311fd420e92b6d90007fdd3b2d843e6e1752c3 (diff)
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.
Diffstat (limited to 'Biz/Log.hs')
-rw-r--r--Biz/Log.hs8
1 files changed, 4 insertions, 4 deletions
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