Skip to content

Commit 0a71bcf

Browse files
committed
style: prefer <> over ++
1 parent bf812f6 commit 0a71bcf

6 files changed

Lines changed: 10 additions & 9 deletions

File tree

‎.hlint.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
- warn: {lhs: map, rhs: fmap, name: Use fmap}
2+
- warn: {lhs: a ++ b, rhs: a <> b, name: Use <>}

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CI (`.github/workflows/ci.yml`) runs all of the above; keep it green.
1313

1414
## Style
1515

16-
- `fmap` over `map`
16+
- `fmap` over `map`, `<>` over `++` (enforced by hlint)
1717
- curried constraints: `Read a => Ord a => a`, not `(Read a, Ord a) => a`;
1818
not enforced by tooling; constraint aliases such as `CLIEffects` stay tuples
1919
- `-Wredundant-constraints` on: only add `Show e` for `throwError` where needed

‎src/Data/CLI/Args.hs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ argParser cmdParser =
4747
( short 'l'
4848
<> long "log-level"
4949
<> metavar "LEVEL"
50-
<> help ("Log level: " ++ intercalate ", " (fmap fst logLevels))
50+
<> help ("Log level: " <> intercalate ", " (fmap fst logLevels))
5151
)
5252
)
5353
<*> switch (short 'd' <> long "debug" <> help "Enable debug output (overruled by -l)")

‎src/Data/Error/CLI.hs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ data CLIError
1313

1414
-- | @since 0.1.0.0
1515
displayCLIError :: CLIError -> String
16-
displayCLIError (InputError s) = "input error: " ++ s
17-
displayCLIError (NotFoundError s) = "not found: " ++ s
18-
displayCLIError (NotImplemented s) = "not implemented: " ++ s
16+
displayCLIError (InputError s) = "input error: " <> s
17+
displayCLIError (NotFoundError s) = "not found: " <> s
18+
displayCLIError (NotImplemented s) = "not implemented: " <> s
1919
displayCLIError (UserCanceled Nothing) = "user canceled"
20-
displayCLIError (UserCanceled (Just s)) = "user canceled: " ++ s
20+
displayCLIError (UserCanceled (Just s)) = "user canceled: " <> s

‎src/Effectful/CLI/IO.hs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ printLines = printOutput . unlines
5050
-- | @since 0.1.0.0
5151
prompt :: IOE :> es => Maybe String -> Eff es String
5252
prompt p = liftIO $ do
53-
hPutStr stderr (fromMaybe "" p ++ "> ")
53+
hPutStr stderr (fromMaybe "" p <> "> ")
5454
hFlush stderr
5555
getLine
5656

@@ -91,7 +91,7 @@ chooseItem
9191
:: Error CLIError :> es
9292
=> IOE :> es
9393
=> String -> [String] -> (a -> [String]) -> [a] -> Eff es a
94-
chooseItem name _ _ [] = throwError (NotFoundError ("no item found for " ++ name))
94+
chooseItem name _ _ [] = throwError (NotFoundError ("no item found for " <> name))
9595
chooseItem _ _ _ [x] = pure x
9696
chooseItem name headers row xs = do
9797
let hs = "#" : headers

‎src/Effectful/CLI/Sleep.hs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ sleep n = do
3434
-- | @since 0.1.0.0
3535
sleepUntil :: IOE :> es => Logger :> es => LocalTime -> Eff es ()
3636
sleepUntil t = do
37-
logInfoN (T.pack ("sleeping until " ++ formatTime defaultTimeLocale "%R" t))
37+
logInfoN (T.pack ("sleeping until " <> formatTime defaultTimeLocale "%R" t))
3838
now <- getLocalTime
3939
sleep . ceiling . nominalDiffTimeToSeconds $ diffLocalTime t now

0 commit comments

Comments
 (0)