Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .github/workflows/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,39 @@ jobs:

- id: matrix
uses: freckle/stack-action/generate-matrix@v5
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: haskell-actions/hlint-setup@v2
with:
version: "3.10"

- uses: haskell-actions/hlint-run@v2
with:
path: '["src/", "test/", "effectful-data-cache-opentelemetry/src/", "effectful-data-cache-opentelemetry/test/"]'
fail-on: warning

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: haskell-actions/run-fourmolu@v13
with:
version: "0.21.0.0"
pattern: |
src/**/*.hs
test/**/*.hs
effectful-data-cache-opentelemetry/src/**/*.hs
effectful-data-cache-opentelemetry/test/**/*.hs
build:
needs: generate-matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-15]
stack-yaml: ${{ fromJSON(needs.generate-matrix.outputs.stack-yamls) }}
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 2 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- warn: {lhs: map, rhs: fmap, name: Use fmap}
- warn: {lhs: a ++ b, rhs: a <> b, name: Use <>}
18 changes: 18 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# AGENTS

Haskell library (stack + hpack). Edit `package.yaml`, never generated `.cabal`.

## Commands

- build and test (GHC 9.10): `stack build --test --ghc-options=-Werror`
- format: `fourmolu -i src test effectful-data-cache-opentelemetry/{src,test}` (fourmolu 0.21.0.0, config in `fourmolu.yaml`)
- lint: `hlint src test effectful-data-cache-opentelemetry/{src,test}` (rules in `.hlint.yaml`; HLS has no hlint plugin on GHC 9.10)

CI (`.github/workflows/stack.yml`) runs all of the above; keep it green.

## Style

- `fmap` over `map`, `<>` over `++` (enforced by hlint)
- curried constraints: `Read a => Ord a => a`, not `(Read a, Ord a) => a`;
not enforced by tooling
- `-Wredundant-constraints` on: only add `Show e` for `throwError` where needed
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ attr
:: ImmutableSpan
-> Text
-> Maybe Attribute
attr s k = lookupAttribute (spanAttributes s) k
attr s = lookupAttribute (spanAttributes s)

spec :: Spec
spec = do
Expand All @@ -49,7 +49,7 @@ spec = do
insert @String @Int "a" (1 :: Int)
_ <- lookup @String @Int "a"
purge @String @Int
map spanName spans `shouldBe` ["cache.insert", "cache.lookup", "cache.purge"]
fmap spanName spans `shouldBe` ["cache.insert", "cache.lookup", "cache.purge"]

it "records hits and misses" $ do
(_, spans) <- traced $ do
Expand Down
16 changes: 16 additions & 0 deletions fourmolu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
column-limit: 90
comma-style: leading
function-arrows: leading
haddock-style: single-line
haddock-style-module: single-line
import-export-style: diff-friendly
indentation: 2
let-style: inline
respectful: false
single-constraint-parens: never
single-deriving-parens: never
sort-constraints: true
sort-derived-classes: true
sort-deriving-clauses: true
...
Loading