suntheme/app/Getters.hs
q9i 13188fe64d refactor: create getters module
group helper funcs for creating directory names and fetching network resources into a single module
2024-08-16 20:22:15 -07:00

17 lines
513 B
Haskell

module Getters where
import Const (prog)
import System.FilePath ((</>))
import System.Directory (XdgDirectory(XdgCache, XdgConfig), getXdgDirectory)
import Control.Exception (SomeException, try)
import Network.HTTP.Request (Response, get)
pathToCache :: String -> IO String
pathToCache str = (</> str) <$> getXdgDirectory XdgCache prog
pathToConfig :: String -> IO String
pathToConfig str = (</> str) <$> getXdgDirectory XdgConfig prog
fetch :: String -> IO (Either SomeException Response)
fetch = try . get