diff --git a/.github/workflows/fourmolu.yaml b/.github/workflows/fourmolu.yaml index 99e27b7..1838704 100644 --- a/.github/workflows/fourmolu.yaml +++ b/.github/workflows/fourmolu.yaml @@ -4,5 +4,7 @@ jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: fourmolu/fourmolu-action@v6 + - uses: actions/checkout@v4 + - uses: haskell-actions/run-fourmolu@v11 + with: + version: "0.18.0.0" diff --git a/fourmolu.yaml b/fourmolu.yaml index 6b09872..dfc2c06 100644 --- a/fourmolu.yaml +++ b/fourmolu.yaml @@ -1,11 +1,19 @@ -comma-style: leading +indentation: 2 function-arrows: leading -haddock-style: single-line +comma-style: leading import-export-style: leading -in-style: left-align +import-grouping: by-scope indent-wheres: true -indentation: 2 -let-style: inline -newlines-between-decls: 1 record-brace-space: true +newlines-between-decls: 1 +haddock-style: single-line +let-style: inline +in-style: no-space +single-constraint-parens: never +single-deriving-parens: never +sort-constraints: true +sort-derived-classes: true +sort-deriving-clauses: true +trailing-section-operators: false +unicode: never respectful: true diff --git a/src/Data/Pool.hs b/src/Data/Pool.hs index 3a67e44..3594b4b 100644 --- a/src/Data/Pool.hs +++ b/src/Data/Pool.hs @@ -70,8 +70,8 @@ takeResource pool = mask_ $ do then do q <- newEmptyTMVar writeTVar (stripeVar lp) $! stripe {queueR = Queue q (queueR stripe)} - pure $ - waitForResource (stripeVar lp) q >>= \case + pure + $ waitForResource (stripeVar lp) q >>= \case Just a -> pure (a, lp) Nothing -> do a <- createResource (poolConfig pool) `onException` restoreSize (stripeVar lp) @@ -133,8 +133,8 @@ takeAvailableResource pool lp stripe = case cache stripe of a <- createResource (poolConfig pool) `onException` restoreSize (stripeVar lp) pure (a, lp) Entry a _ : as -> do - writeTVar (stripeVar lp) $! - stripe + writeTVar (stripeVar lp) + $! stripe { available = available stripe - 1 , cache = as } diff --git a/src/Data/Pool/Internal.hs b/src/Data/Pool/Internal.hs index 11d35d2..3aad38d 100644 --- a/src/Data/Pool/Internal.hs +++ b/src/Data/Pool/Internal.hs @@ -164,7 +164,7 @@ newPool pc = do stripeResources :: Int -> [(Int, Int)] stripeResources numStripes = let (base, rest) = quotRem (poolMaxResources pc) numStripes - in zip [1 .. numStripes] $ addRest (replicate numStripes base) rest + in zip [1 .. numStripes] $ addRest (replicate numStripes base) rest where addRest [] = error "unreachable" addRest acc@(r : rs) = \case diff --git a/src/Data/Pool/Introspection.hs b/src/Data/Pool/Introspection.hs index 785a358..53e8fbe 100644 --- a/src/Data/Pool/Introspection.hs +++ b/src/Data/Pool/Introspection.hs @@ -39,7 +39,7 @@ data Resource a = Resource , acquisitionTime :: !Double , creationTime :: !(Maybe Double) } - deriving stock (Eq, Show, Generic) + deriving stock (Eq, Generic, Show) -- | Describes how a resource was acquired from the pool. data Acquisition @@ -47,7 +47,7 @@ data Acquisition Immediate | -- | The thread had to wait until a resource was released. Delayed - deriving stock (Eq, Show, Generic) + deriving stock (Eq, Generic, Show) -- | 'Data.Pool.withResource' with introspection capabilities. withResource :: Pool a -> (Resource a -> IO r) -> IO r @@ -68,8 +68,8 @@ takeResource pool = mask_ $ do then do q <- newEmptyTMVar writeTVar (stripeVar lp) $! stripe {queueR = Queue q (queueR stripe)} - pure $ - waitForResource (stripeVar lp) q >>= \case + pure + $ waitForResource (stripeVar lp) q >>= \case Just a -> do t2 <- getMonotonicTime let res =