Skip to content

Commit 81b0769

Browse files
committed
format everything again.
looks like built-in fourmolu doesn't respect its config for some reason, resulting in formatting inconsistency depending on using lsp-format-buffer or the external binary. therefore let's switch to an external version and make sure to always use that for now. For the record we are using fourmolu v0.14.1.0
1 parent 0435a0c commit 81b0769

File tree

205 files changed

+819
-587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+819
-587
lines changed

fourmolu.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
indentation: 2
22
function-arrows: trailing
33
comma-style: leading
4-
import-export-style: leading
4+
import-export-style: diff-friendly
55
indent-wheres: true
66
record-brace-space: true
77
newlines-between-decls: 1

src/Javran/AdventOfCode/Cli/New.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ newCommand SubCmdContext {cmdHelpPrefix} =
6565
getArgs >>= \case
6666
[yearRaw, dayRaw]
6767
| [(year, "")] <- reads yearRaw
68-
, [(day, "")] <- reads dayRaw ->
69-
newCommandForYearDay year day
68+
, [(day, "")] <- reads dayRaw ->
69+
newCommandForYearDay year day
7070
_ -> die $ cmdHelpPrefix <> "<year> <day>"

src/Javran/AdventOfCode/Cli/ProgressReport.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ tabulateReport = mapMaybe ((\(i, m) -> (i,) <$> m) . second tabulateYear)
7777

7878
computeProgressReport :: IO ProgressReport
7979
computeProgressReport = do
80-
Just prjHomePre <- need "PROJECT_HOME"
81-
let prjHome = T.unpack prjHomePre
80+
Just prjHome <- (fmap . fmap) T.unpack $ need "PROJECT_HOME"
8281
gathered <- reduce Foldl.list do
8382
pushd (prjHome </> "src" </> "Javran" </> "AdventOfCode")
8483
fp <- lstree "."

src/Javran/AdventOfCode/Cli/SolutionCommand.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ parse = \case
3636
case xs of
3737
dayRaw : ys
3838
| Just day <- consumeAllWithReadP decimal1P dayRaw ->
39-
pure $ ModeYearDay year day ys
39+
pure $ ModeYearDay year day ys
4040
ys -> pure $ ModeYear year ys
4141
_ -> Nothing
4242

src/Javran/AdventOfCode/Cli/SolutionCommand/SolutionMain.hs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,33 @@ parseArgs = \case
8686
[] -> Right CmdRunLogin
8787
cmd : args ->
8888
if
89-
| cmd `elem` ["l", "login"] -> CmdRunLogin <$ expectNoExtra args
90-
| cmd `elem` ["e", "example"] ->
89+
| cmd `elem` ["l", "login"] -> CmdRunLogin <$ expectNoExtra args
90+
| cmd `elem` ["e", "example"] ->
9191
CmdRunExample <$> do
9292
mx <- atMostOneExtra args
9393
maybe (pure defExample) parseExampleName mx
94-
| cmd == "edit-example" ->
94+
| cmd == "edit-example" ->
9595
CmdEditExample <$> do
9696
mx <- atMostOneExtra args
9797
maybe (pure defExample) parseExampleName mx
98-
| cmd == "write-expect" -> CmdWriteExampleExpect <$ expectNoExtra args
99-
| cmd == "new" -> CmdNewSolution <$ expectNoExtra args
100-
| cmd == "submit" -> case args of
98+
| cmd == "write-expect" -> CmdWriteExampleExpect <$ expectNoExtra args
99+
| cmd == "new" -> CmdNewSolution <$ expectNoExtra args
100+
| cmd == "submit" -> case args of
101101
[whichRaw, answer]
102102
| [(w, "")] <- reads whichRaw
103-
, w `elem` [1, 2] ->
104-
pure $ CmdSubmit w answer
103+
, w `elem` [1, 2] ->
104+
pure $ CmdSubmit w answer
105105
_ -> Left "Expected <1|2> <answer>"
106-
| cmd == "test" ->
106+
| cmd == "test" ->
107107
CmdTest <$ expectNoExtra args
108-
| cmd == "add-extra" ->
108+
| cmd == "add-extra" ->
109109
CmdAddExtra <$> do
110110
mx <- atMostOneExtra args
111111
maybe (pure defExample) parseExampleName mx
112-
| cmd == "ls" -> CmdListExamples <$ expectNoExtra args
113-
| cmd == "download" ->
112+
| cmd == "ls" -> CmdListExamples <$ expectNoExtra args
113+
| cmd == "download" ->
114114
CmdDownload <$> atMostOneExtra args
115-
| otherwise -> Left $ "Unrecognized: " <> unwords (cmd : args)
115+
| otherwise -> Left $ "Unrecognized: " <> unwords (cmd : args)
116116
where
117117
defExample = ExName "example"
118118
atMostOneExtra = \case

src/Javran/AdventOfCode/ColorfulTerminal.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ getColorfulTerminal t = do
3131
(setForeground, setBackground) <-
3232
getCapability
3333
t
34-
( (,) <$> withForegroundColor @TermOutput
34+
( (,)
35+
<$> withForegroundColor @TermOutput
3536
<*> withBackgroundColor @TermOutput
3637
)
3738
pure

src/Javran/AdventOfCode/Infra.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ class Solution sol where
182182
, Rep sol ~ M1 D d f
183183
, Datatype d
184184
) =>
185-
forall p. p sol -> (Int, Int)
185+
forall p.
186+
p sol ->
187+
(Int, Int)
186188
solutionIndex _ =
187189
fromJust $
188190
consumeAllWithReadP

src/Javran/AdventOfCode/Main.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ main = do
2828
getArgs >>= \case
2929
args
3030
| Just mode <- SolutionCommand.parse args ->
31-
SolutionCommand.subCommand ctxt mode
31+
SolutionCommand.subCommand ctxt mode
3232
subCmd : args
3333
| Just handler <- lookup subCmd subCmdHandlers ->
34-
withArgs args (handler ctxt {cmdHelpPrefix = cmdHelpPrefix ctxt <> subCmd <> " "})
34+
withArgs args (handler ctxt {cmdHelpPrefix = cmdHelpPrefix ctxt <> subCmd <> " "})
3535
_ -> do
3636
forM_ subCmdHandlers $ \(sub, _) ->
3737
putStrLn $ cmdHelpPrefix ctxt <> sub <> " ..."

src/Javran/AdventOfCode/Y2015/Day1.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day1 (
2-
) where
2+
3+
) where
34

45
import Control.Applicative
56
import Data.List
@@ -17,5 +18,6 @@ instance Solution Day1 where
1718
answerShow (sum xs)
1819
let (ans2, _) : _ =
1920
dropWhile ((/= -1) . snd) $
20-
zip [0 :: Int ..] $ scanl' (+) 0 xs
21+
zip [0 :: Int ..] $
22+
scanl' (+) 0 xs
2123
answerShow ans2

src/Javran/AdventOfCode/Y2015/Day10.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day10 (
2-
) where
2+
3+
) where
34

45
import qualified Data.List.NonEmpty as NE
56
import Javran.AdventOfCode.Prelude

src/Javran/AdventOfCode/Y2015/Day11.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day11 (
2-
) where
2+
3+
) where
34

45
import Control.Monad
56
import Data.Char
@@ -40,13 +41,13 @@ incrStd = \case
4041
[] -> []
4142
c : ch ->
4243
if
43-
| c == 'z' -> 'a' : incrStd ch
44-
| c `elem` preBans ->
44+
| c == 'z' -> 'a' : incrStd ch
45+
| c `elem` preBans ->
4546
let c' = chr (ord c + 2)
4647
in if not checked || c' <= 'z'
4748
then c' : ch
4849
else error "resulting value out of range"
49-
| otherwise -> chr (ord c + 1) : ch
50+
| otherwise -> chr (ord c + 1) : ch
5051
where
5152
checked = False
5253
preBans = fmap pred bans

src/Javran/AdventOfCode/Y2015/Day12.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day12 (
2-
) where
2+
3+
) where
34

45
import Data.Aeson
56
import qualified Data.Aeson.KeyMap as KM

src/Javran/AdventOfCode/Y2015/Day13.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day13 (
2-
) where
2+
3+
) where
34

45
import Data.Char
56
import Data.Containers.ListUtils (nubOrd)

src/Javran/AdventOfCode/Y2015/Day14.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day14 (
2-
) where
2+
3+
) where
34

45
import Data.Char
56
import qualified Data.Map.Strict as M

src/Javran/AdventOfCode/Y2015/Day15.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day15 (
2-
) where
2+
3+
) where
34

45
import Control.Monad
56
import Data.Char
@@ -42,9 +43,9 @@ intPart n total
4243
| n <= 0 = errInvalid
4344
| n == 1 = pure [total]
4445
| otherwise = do
45-
v <- [0 .. total]
46-
ps <- intPart (n - 1) (total - v)
47-
pure $ v : ps
46+
v <- [0 .. total]
47+
ps <- intPart (n - 1) (total - v)
48+
pure $ v : ps
4849

4950
instance Solution Day15 where
5051
solutionRun _ SolutionContext {getInputS, answerShow} = do

src/Javran/AdventOfCode/Y2015/Day16.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day16 (
2-
) where
2+
3+
) where
34

45
import Control.Monad
56
import Data.Char

src/Javran/AdventOfCode/Y2015/Day17.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day17 (
2-
) where
2+
3+
) where
34

45
import Data.Function.Memoize (memoFix)
56
import qualified Data.Vector as V

src/Javran/AdventOfCode/Y2015/Day18.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day18 (
2-
) where
2+
3+
) where
34

45
import Control.Monad
56
import qualified Data.Map.Strict as M

src/Javran/AdventOfCode/Y2015/Day19.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day19 (
2-
) where
2+
3+
) where
34

45
import Control.Applicative
56
import Control.Monad

src/Javran/AdventOfCode/Y2015/Day2.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day2 (
2-
) where
2+
3+
) where
34

45
import Data.Monoid
56
import Javran.AdventOfCode.Prelude
@@ -12,8 +13,10 @@ type Box = (Int, Int, Int)
1213
boxP :: ReadP Box
1314
boxP =
1415
(,,)
15-
<$> decimal1P <* char 'x'
16-
<*> decimal1P <* char 'x'
16+
<$> decimal1P
17+
<* char 'x'
18+
<*> decimal1P
19+
<* char 'x'
1720
<*> decimal1P
1821

1922
paper, ribbon :: Box -> Int

src/Javran/AdventOfCode/Y2015/Day20.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day20 (
2-
) where
2+
3+
) where
34

45
import Control.Monad
56
import Javran.AdventOfCode.NumberTheory (sumOfDivisors)

src/Javran/AdventOfCode/Y2015/Day21.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day21 (
2-
) where
2+
3+
) where
34

45
import Control.Applicative
56
import Control.Lens

src/Javran/AdventOfCode/Y2015/Day22.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day22 (
2-
) where
2+
3+
) where
34

45
import Control.Monad
56
import Control.Monad.Loops
@@ -94,7 +95,7 @@ oneTurn = do
9495
pure [m]
9596
let conflicts =
9697
[Shield | M.member EShield effects]
97-
<> [Poison | M.member EPoison effects]
98+
<> [Poison | M.member EPoison effects]
9899
<> [Recharge | M.member ERecharge effects]
99100
actions1 = actions0 \\ conflicts
100101
actions2 = filter ((<= mana) . manaCost) actions1
@@ -214,6 +215,8 @@ instance Solution Day22 where
214215
}
215216

216217
answerShow $
217-
head $ solve bossDmg initGs oneTurn
218+
head $
219+
solve bossDmg initGs oneTurn
218220
answerShow $
219-
head $ solve bossDmg initGs oneTurn2
221+
head $
222+
solve bossDmg initGs oneTurn2

src/Javran/AdventOfCode/Y2015/Day23.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{-# LANGUAGE NoMonomorphismRestriction #-}
22

33
module Javran.AdventOfCode.Y2015.Day23 (
4-
) where
4+
5+
) where
56

67
import Control.Lens
78
import Data.Function

src/Javran/AdventOfCode/Y2015/Day24.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day24 (
2-
) where
2+
3+
) where
34

45
import Data.List
56
import Javran.AdventOfCode.Prelude

src/Javran/AdventOfCode/Y2015/Day25.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day25 (
2-
) where
2+
3+
) where
34

45
import Data.Mod
56
import Javran.AdventOfCode.GridSystem.RowThenCol.Uldr

src/Javran/AdventOfCode/Y2015/Day3.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day3 (
2-
) where
2+
3+
) where
34

45
import Control.Applicative
56
import Data.List

src/Javran/AdventOfCode/Y2015/Day4.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day4 (
2-
) where
2+
3+
) where
34

45
import qualified Crypto.Hash.MD5 as Md5
56
import Data.Bits

src/Javran/AdventOfCode/Y2015/Day5.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day5 (
2-
) where
2+
3+
) where
34

45
import Control.Monad
56
import Data.List

src/Javran/AdventOfCode/Y2015/Day6.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day6 (
2-
) where
2+
3+
) where
34

45
import Control.Monad
56
import Control.Monad.ST
@@ -35,7 +36,7 @@ instrP = do
3536

3637
simulate ::
3738
forall s a ans.
38-
(Arr.MArray (Arr.STUArray s) a (ST s)) =>
39+
Arr.MArray (Arr.STUArray s) a (ST s) =>
3940
[Instr] ->
4041
a ->
4142
(Op -> a -> a) ->

src/Javran/AdventOfCode/Y2015/Day7.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Javran.AdventOfCode.Y2015.Day7 (
2-
) where
2+
3+
) where
34

45
import Control.Applicative
56
import Control.Monad
@@ -92,8 +93,8 @@ instance Solution Day7 where
9293
ans1 <$ answerShow ans1
9394
do
9495
let gates2 =
95-
Gate {gIn = [Right ans1], gAction = \[x] -> x, gOut = "b"} :
96-
filter ((/= "b") . gOut) gates
96+
Gate {gIn = [Right ans1], gAction = \[x] -> x, gOut = "b"}
97+
: filter ((/= "b") . gOut) gates
9798
progression = iterate step (gates2, M.empty)
9899
(_, m) : _ = dropWhile (M.notMember "a" . snd) progression
99100
ans2 = m M.! "a"

0 commit comments

Comments
 (0)