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/src/Processors.hs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'compiler/src/Processors.hs') diff --git a/compiler/src/Processors.hs b/compiler/src/Processors.hs index 0efbf6d..73529ee 100644 --- a/compiler/src/Processors.hs +++ b/compiler/src/Processors.hs @@ -57,10 +57,7 @@ data Format = formatFromPath :: Path -> Format formatFromPath = - maybe Unknown fromExt - . fmap (map toLower) - . fmap takeExtension - . fileName + maybe Unknown ((fromExt . map toLower) . takeExtension) . fileName where fromExt :: String -> Format fromExt ext = case ext of @@ -97,12 +94,12 @@ type FileProcessor = copyFileProcessor :: FileProcessor copyFileProcessor inputPath outputPath = - (putStrLn $ "Copying:\t" ++ outputPath) + putStrLn ("Copying:\t" ++ outputPath) >> ensureParentDir (flip System.Directory.copyFile) outputPath inputPath resizePictureUpTo :: Resolution -> FileProcessor resizePictureUpTo maxResolution inputPath outputPath = - (putStrLn $ "Generating:\t" ++ outputPath) + putStrLn ("Generating:\t" ++ outputPath) >> ensureParentDir (flip resize) outputPath inputPath where maxSize :: Resolution -> String @@ -143,7 +140,7 @@ withCached processor inputPath outputPath = resourceAt :: FilePath -> Path -> IO Resource -resourceAt fsPath resPath = getModificationTime fsPath >>= return . Resource resPath +resourceAt fsPath resPath = Resource resPath <$> getModificationTime fsPath getImageResolution :: FilePath -> IO Resolution getImageResolution fsPath = @@ -160,9 +157,7 @@ getImageResolution fsPath = _ -> throwIO $ ProcessingException fsPath "Unable to read image resolution." getPictureProps :: ItemDescriber -getPictureProps fsPath resource = - getImageResolution fsPath - >>= return . Picture resource +getPictureProps fsPath resource = Picture resource <$> getImageResolution fsPath type ItemDescriber = -- cgit v1.2.3