From 0c1963044b47793eff2958b775287216ecca7993 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sat, 25 Nov 2017 12:13:16 +0300 Subject: xinclude2nix: format with hindent -XArrows --- modules/pkgs/xinclude2nix/xinclude2nix.hs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'modules/pkgs') diff --git a/modules/pkgs/xinclude2nix/xinclude2nix.hs b/modules/pkgs/xinclude2nix/xinclude2nix.hs index 49d34ca..aaf505e 100644 --- a/modules/pkgs/xinclude2nix/xinclude2nix.hs +++ b/modules/pkgs/xinclude2nix/xinclude2nix.hs @@ -6,21 +6,25 @@ Extract included files Prints list of included files -} - -module Main where +module Main + ( main + ) where import Data.List (intercalate, isPrefixOf, stripPrefix) import Data.Maybe (fromMaybe) import System.Environment (getArgs) -import Text.XML.HXT.Core ( (>>>), deep, getAttrValue, hasAttr, hasName, - isElem, readDocument, returnA, runX) +import Text.XML.HXT.Core + ((>>>), deep, getAttrValue, hasAttr, hasName, isElem, readDocument, + returnA, runX) getXIncludes :: String -> IO [String] -getXIncludes xmlFileName = runX $ readDocument [] xmlFileName - >>> deep (isElem >>> hasName "xi:include" >>> hasAttr "href") >>> - proc d -> do - href <- getAttrValue "href" -< d - returnA -< href +getXIncludes xmlFileName = + runX $ + readDocument [] xmlFileName >>> + deep (isElem >>> hasName "xi:include" >>> hasAttr "href") >>> + proc d -> + do href <- getAttrValue "href" -< d + returnA -< href getFiles :: [String] -> [String] getFiles = map stripScheme . filter isFile @@ -33,7 +37,7 @@ unique :: [String] -> [String] unique [] = [] unique (x:xs) | x `elem` xs = unique xs - | otherwise = x:unique xs + | otherwise = x : unique xs toNix :: [String] -> String toNix ss = "[" ++ intercalate " " (map show ss) ++ "]" @@ -43,4 +47,3 @@ main = do paths <- getArgs includedFiles <- unique . getFiles . concat <$> mapM getXIncludes paths putStrLn $ toNix includedFiles - -- cgit v1.2.3