summaryrefslogtreecommitdiff
path: root/src/Config.hs
diff options
context:
space:
mode:
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