https-everywhere-rules/https-everywhere-rules-raw/src/Data/HTTPSEverywhere/Rules/Raw.hs

24 lines
698 B
Haskell

module Data.HTTPSEverywhere.Rules.Raw (
getRule,
getRules
) where
import Prelude hiding (readFile)
import Data.Functor.Infix ((<$$>))
import Data.Text.Lazy (Text)
import Data.Text.Lazy.IO (readFile)
import System.Directory (getDirectoryContents)
import System.FilePath.Posix (combine, takeExtension)
import Paths_https_everywhere_rules_raw (getDataFileName)
getRule :: FilePath -> IO Text
getRule = readFile
getRules :: IO [FilePath]
getRules = getDataFileName [] >>= filter isXML <$$> getAbsoluteDirectoryContents
where isXML = (== ".xml") . takeExtension
getAbsoluteDirectoryContents :: FilePath -> IO [FilePath]
getAbsoluteDirectoryContents x = combine x <$$> getDirectoryContents x