Skip to content

Commit 8ef0bcf

Browse files
committed
Improved code style by using mapM instead of sequence
1 parent 6f74569 commit 8ef0bcf

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

tasklite-core/app/Main.hs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import Protolude (
2727
Semigroup ((<>)),
2828
Show,
2929
Text,
30-
Traversable (sequence),
3130
die,
3231
filter,
3332
foldMap,
@@ -1279,24 +1278,26 @@ printOutput appName config = do
12791278
hookFiles <- listDirectory hooksPathNorm
12801279

12811280
hookFilesPerm :: [(FilePath, Permissions)] <-
1282-
sequence $
1283-
hookFiles
1284-
& filter
1285-
( \name ->
1286-
("pre-" `isPrefixOf` name) || ("post-" `isPrefixOf` name)
1287-
)
1288-
<&> (hooksPathNorm </>)
1289-
<&> \path -> do
1290-
perm <- getPermissions path
1291-
pure (path, perm)
1281+
hookFiles
1282+
& filter
1283+
( \name ->
1284+
("pre-" `isPrefixOf` name) || ("post-" `isPrefixOf` name)
1285+
)
1286+
<&> (hooksPathNorm </>)
1287+
& P.mapM
1288+
( \path -> do
1289+
perm <- getPermissions path
1290+
pure (path, perm)
1291+
)
12921292

12931293
hookFilesPermContent <-
1294-
sequence $
1295-
hookFilesPerm
1296-
& filter (\(_, perm) -> executable perm)
1297-
<&> \(filePath, perm) -> do
1298-
fileContent <- readFile filePath
1299-
pure (filePath, perm, fileContent)
1294+
hookFilesPerm
1295+
& filter (\(_, perm) -> executable perm)
1296+
& P.mapM
1297+
( \(filePath, perm) -> do
1298+
fileContent <- readFile filePath
1299+
pure (filePath, perm, fileContent)
1300+
)
13001301

13011302
let configNorm = addHookFilesToConfig configNormHookDir hookFilesPermContent
13021303

@@ -1306,7 +1307,7 @@ printOutput appName config = do
13061307
connection <- setupConnection configNorm
13071308

13081309
-- For debugging SQLite interactions
1309-
-- SQLite.setTrace connection $ Just print
1310+
-- SQLite.setTrace connection $ Just P.print
13101311

13111312
migrationsStatus <- runMigrations configNorm connection
13121313
nowElapsed <- timeCurrentP

0 commit comments

Comments
 (0)