summaryrefslogtreecommitdiffhomepage
path: root/lib/Language/Haskell/Stylish/Config/Internal.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Language/Haskell/Stylish/Config/Internal.hs')
-rw-r--r--lib/Language/Haskell/Stylish/Config/Internal.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Language/Haskell/Stylish/Config/Internal.hs b/lib/Language/Haskell/Stylish/Config/Internal.hs
new file mode 100644
index 0000000..b6160f9
--- /dev/null
+++ b/lib/Language/Haskell/Stylish/Config/Internal.hs
@@ -0,0 +1,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