Created
July 21, 2015 07:39
-
-
Save JustusAdam/1e6ed19c3dc83c2710ff to your computer and use it in GitHub Desktop.
Let stylish-haskell loose on a directory and all its subdirectories.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE UnicodeSyntax #-} | |
module StyleAll where | |
import Control.Monad | |
import Control.Monad.Unicode | |
import Data.Bool | |
import Prelude.Unicode | |
import System.Directory | |
import System.Environment | |
import System.FilePath | |
import System.Process | |
styleCmd = callCommand ∘ ("stylish-haskell -i " ⧺) | |
handleOne file = | |
doesFileExist file ≫= | |
bool | |
(getDirectoryContents file ≫= mapM_ (handleOne ∘ (file </>)) ∘ filter (not ∘ (∈ [".", ".."])) ) | |
(when (takeExtension file ∈ [".hs", ".lhs"]) $ styleCmd file) | |
main = | |
getArgs ≫= mapM_ handleOne |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment