summaryrefslogtreecommitdiff
path: root/src/Config.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2026-04-06 23:35:05 +0200
committerTom Smeding <tom@tomsmeding.com>2026-04-06 23:36:28 +0200
commit287d9e5c4fc50bcca2474b9783148181d7ede872 (patch)
tree81a80cc5f5aabb2d3cffd3874438782d32096cff /src/Config.hs
parent875da72c83b20260ac5af2bdcc8b992d657fd97e (diff)
Log watching
Diffstat (limited to 'src/Config.hs')
-rw-r--r--src/Config.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Config.hs b/src/Config.hs
index ee2909c..f50c8b6 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -5,11 +5,14 @@
{-# LANGUAGE TypeFamilies #-}
module Config (
Config, Config'(..), ConfigStage(..), IfFull,
- Channel(..),
+ Channel(..), prettyChannel,
readConfig, enrichConfig,
) where
+import Prelude hiding (foldl') -- exported since GHC 9.10 (base 4.20)
+
import Data.Char (isSpace)
+import Data.List (foldl')
import Data.Map.Strict (Map)
import Data.Map.Strict qualified as Map
import Data.Text (Text)
@@ -70,6 +73,9 @@ type family IfFull stage a where
data Channel = Channel { chanNetwork :: Text, chanChannel :: Text }
deriving (Show, Eq, Ord)
+prettyChannel :: Channel -> Text
+prettyChannel (Channel nw ch) = nw <> T.pack "/" <> ch
+
readConfig :: FilePath -> IO (Config' User)
readConfig path = foldl' parseLine initConfig . lines <$> readFile path