Commit e2b1184cdd9ce7a102dea64fe8aaa4251e7586a3 Parent: 59afb09d3cd53085b3d9bed728d4bbca26b6d4b8 Author: mcol <mcol@posteo.net> Date: 2021-09-23 21:54:33 +0100 Committer: mcol <mcol@posteo.net> Committed: 2021-09-23 21:54:33 +0100 Use lambda case for case statements
src/Templates.hs Modified
@@ -1,3 +1,5 @@ +{-# Language LambdaCase #-} + module Templates ( Template, templateGinger, @@ -45,12 +47,11 @@ includes. -} includeResolver :: FilePath -> IO (Maybe String) -includeResolver path = tryIOError (readFile path) >>= \e -> - case e of - Right contents -> return $ Just contents - Left err -> do - print err - return Nothing +includeResolver path = tryIOError (readFile path) >>= \case + Right contents -> return $ Just contents + Left err -> do + print err + return Nothing {- This is used to filter files in the template directory so that we only try to load
src/Repositories.hs Modified
@@ -1,3 +1,4 @@ +{-# Language LambdaCase #-} {-# Language OverloadedStrings #-} -- Needed for resolveReference module Repositories ( @@ -45,8 +46,7 @@ processRepo' :: [Template] -> FilePath -> FilePath -> ReaderT LgRepo IO () processRepo' templates outputDirectory path = do liftIO $ createDirectoryIfMissing True outPath - ref <- resolveReference "HEAD" - case ref of + resolveReference "HEAD" >>= \case Nothing -> liftIO . print $ "gitserve: " <> name <> ": Failed to resolve HEAD." Just commitID -> do let head = Tagged commitID