summaryrefslogtreecommitdiffhomepage
path: root/lib/Language/Haskell/Stylish/Config/Internal.hs
blob: b6160f9cf8ac10c8f21b0c1d1d859cb54bbcde1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--------------------------------------------------------------------------------
module Language.Haskell.Stylish.Config.Internal
    ( ancestors
    ) where


--------------------------------------------------------------------------------
import           Data.List       (inits)
import           System.FilePath (joinPath, splitPath)


--------------------------------------------------------------------------------
-- All ancestors of a dir (including that dir)
ancestors :: FilePath -> [FilePath]
ancestors = map joinPath . reverse . dropWhile null . inits . splitPath