on 3caa3db help sign in
13 lines 425 B history raw
1module Obelisk.ExecutableConfig (get) where
3import Control.Exception
4import Data.Text (Text)
5import Data.Text as T
6import Data.Text.IO as T
7import System.FilePath.Posix ((</>))
8import System.IO.Error
10get :: Text -> IO (Maybe Text)
11get path = do
12 let doesNotExist = \e -> if isDoesNotExistError e then Just () else Nothing
13 catchJust doesNotExist (fmap Just $ T.readFile $ "config" </> T.unpack path) (\_ -> pure Nothing)