From 478fb074b7101beabc149f01f45061d3aeefe3eb Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 21 May 2020 01:02:31 +0200 Subject: compiler: fix typo --- compiler/app/Main.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/app') diff --git a/compiler/app/Main.hs b/compiler/app/Main.hs index 48e5644..061fab7 100644 --- a/compiler/app/Main.hs +++ b/compiler/app/Main.hs @@ -42,7 +42,7 @@ data Options = Options , outputDir :: FilePath , outputIndex :: FilePath , galleryConfig :: FilePath - , rebuilAll :: Bool + , rebuildAll :: Bool , cleanOutput :: Bool , withViewer :: Maybe FilePath } deriving (Show, Data, Typeable) @@ -73,7 +73,7 @@ options = Options &= name "gallery-config" &= explicit &= help "Gallery configuration file (default=/gallery.yaml)" - , rebuilAll = False + , rebuildAll = False &= name "r" &= name "rebuild-all" &= explicit @@ -130,7 +130,7 @@ main = (galleryOutputDir opts) (outputIndex opts) [outputDir opts] - (rebuilAll opts) + (rebuildAll opts) (cleanOutput opts) where checkDistinctPaths :: FilePath -> FilePath -> IO () -- cgit v1.2.3 From 00c6216259d8a7b131307953ba5000d2b5dc564b Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 13 Jun 2020 00:06:18 +0200 Subject: compiler: trivial code simplifications Following HLint's advice. --- compiler/app/Main.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'compiler/app') diff --git a/compiler/app/Main.hs b/compiler/app/Main.hs index 061fab7..e71e0db 100644 --- a/compiler/app/Main.hs +++ b/compiler/app/Main.hs @@ -21,6 +21,7 @@ module Main where import GHC.Generics (Generic) import Paths_ldgallery_compiler (version, getDataFileName) import Control.Monad (when) +import Data.Functor ((<&>)) import Data.Maybe (isJust) import Data.Version (showVersion) import Data.Aeson (ToJSON) @@ -32,7 +33,7 @@ import Compiler import Files (readDirectory, copyTo, remove) -data ViewerConfig = ViewerConfig +newtype ViewerConfig = ViewerConfig { galleryRoot :: String } deriving (Generic, Show, ToJSON) @@ -92,7 +93,7 @@ options = Options &= help "Deploy either the bundled or the given static web viewer to the output directory" } - &= summary ("ldgallery v" ++ (showVersion version) ++ " - a static web gallery generator with tags") + &= summary ("ldgallery v" ++ showVersion version ++ " - a static web gallery generator with tags") &= program "ldgallery" &= help "Compile a gallery" &= helpArg [explicit, name "h", name "help"] @@ -146,7 +147,7 @@ main = deployViewer :: FilePath -> Options -> IO () deployViewer distPath Options{outputDir, cleanOutput} = - (when cleanOutput $ cleanViewerDir outputDir) + when cleanOutput (cleanViewerDir outputDir) >> copyViewer distPath outputDir >> writeJSON (outputDir "config.json") viewerConfig @@ -154,8 +155,8 @@ main = cleanViewerDir :: FilePath -> IO () cleanViewerDir target = listDirectory target - >>= return . filter (/= gallerySubdir) - >>= mapM_ remove . map (target ) + <&> filter (/= gallerySubdir) + >>= mapM_ (remove . (target )) copyViewer :: FilePath -> FilePath -> IO () copyViewer dist target = -- cgit v1.2.3