Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pb/next #46

Merged
merged 9 commits into from
May 28, 2024
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
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is a list of commits to be ignored in commands such as git-blame. To
# make this work, you need to run:
#
# git config blame.ignoreRevsFile .git-blame-ignore-revs
#
###
39 changes: 16 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,44 @@ jobs:
strategy:
matrix:
stack-yaml:
- stack-nightly.yaml # ghc-9.2
- stack.yaml # ghc-9.0
- stack-nightly.yaml # ghc-9.8
- stack.yaml # ghc-9.6
- stack-lts-21.25.yaml # ghc-9.4
- stack-lts-20.26.yaml # ghc-9.2
- stack-lts-19.33.yaml # ghc-9.0
- stack-lts-18.28.yaml # ghc-8.10
- stack-lts-16.31.yaml # ghc-8.8
- stack-lts-14.27.yaml # ghc-8.6
- stack-lts-12.26.yaml # ghc-8.4
fail-fast: false

env:
STACK_YAML: ${{ matrix.stack-yaml }}

steps:
- uses: actions/checkout@v2
- uses: freckle/stack-cache-action@v1
with:
stack-yaml: ${{ matrix.stack-yaml }}
- uses: actions/checkout@v4

- id: stack
uses: freckle/stack-action@v3
uses: freckle/stack-action@v5
with:
stack-yaml: ${{ matrix.stack-yaml }}
stack-arguments: --coverage
compiler-tools: hpc-lcov

- if: ${{ matrix.stack-yaml == 'stack.yaml' }}
name: Reformat coverage
run: |
tix='${{ steps.stack.outputs.local-hpc-root }}/combined/all/all.tix'
stack --resolver lts-18.28 --no-terminal install --copy-compiler-tool hpc-lcov
stack --resolver lts-18.28 --no-terminal exec -- hpc-lcov --file "$tix"
run: stack exec -- hpc-lcov --file '${{ steps.stack.outputs.local-hpc-root }}/combined/all/all.tix'

- if: ${{ matrix.stack-yaml == 'stack.yaml' }}
name: Upload coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
files: ./lcov.info

- if: ${{ matrix.stack-yaml == 'stack.yaml' }}
uses: freckle/weeder-action@v1
with:
weeder-version: 2.3.0

hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: rwe/actions-hlint-setup@v1
- run: |
curl -o .hlint.yaml https://raw.githubusercontent.com/pbrisbin/dotfiles/master/hlint.yaml
- uses: rwe/actions-hlint-run@v2
- uses: actions/checkout@v4
- uses: haskell-actions/hlint-setup@v2
- uses: haskell-actions/hlint-run@v2
with:
fail-on: warning
13 changes: 2 additions & 11 deletions .restyled.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
---
restylers:
- stylish-haskell:
include:
- "**/*.hs"
- "!src/Yesod/Paginator/Pages.hs" # avoid DerivingStrategies
- brittany:
include:
- "**/*.hs"
- "!src/Yesod/Paginator/Pages.hs" # avoid DerivingStrategies
- "!example/Main.hs" # HsSpliceE
- "!src/Yesod/Paginator/Widgets.hs" # HsSpliceE
- "!stylish-haskell"
- fourmolu
23 changes: 0 additions & 23 deletions .stylish-haskell.yaml

This file was deleted.

42 changes: 0 additions & 42 deletions Makefile

This file was deleted.

1 change: 1 addition & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import Distribution.Simple

main = defaultMain
40 changes: 0 additions & 40 deletions brittany.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions doctest/Main.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Main
( main
) where
( main
) where

import Prelude

Expand Down
27 changes: 15 additions & 12 deletions example/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
{-# OPTIONS_GHC -Wno-unused-top-binds #-}

module Main
( main
) where
( main
) where

import Prelude

Expand All @@ -19,15 +19,18 @@ import Yesod.Paginator

data App = App

mkYesod "App" [parseRoutes|
mkYesod
"App"
[parseRoutes|
/ RootR GET
|]

instance Yesod App where
approot = ApprootRelative
defaultLayout widget = do
pc <- widgetToPageContent widget
withUrlRenderer [hamlet|$newline never
approot = ApprootRelative
defaultLayout widget = do
pc <- widgetToPageContent widget
withUrlRenderer
[hamlet|$newline never
$doctype 5
<html lang="en">
<head>
Expand All @@ -43,13 +46,13 @@ instance Yesod App where

getRootR :: Handler Html
getRootR = do
let things' = [1 .. 1142] :: [Int]
let things' = [1 .. 1142] :: [Int]

pages <- paginate 3 things'
pages <- paginate 3 things'

defaultLayout $ do
setTitle "My title"
[whamlet|$newline never
defaultLayout $ do
setTitle "My title"
[whamlet|$newline never
<h1>Pagination Examples
<h2>The things:
<ul>
Expand Down
17 changes: 17 additions & 0 deletions fourmolu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
indentation: 2
column-limit: 80 # ignored until v12 / ghc-9.6
function-arrows: leading
comma-style: leading # default
import-export-style: leading
indent-wheres: false # default
record-brace-space: true
newlines-between-decls: 1 # default
haddock-style: single-line
let-style: mixed
in-style: left-align
single-constraint-parens: never # ignored until v12 / ghc-9.6
unicode: never # default
respectful: true # default
fixities:
- "infix 4 `stringEqual`"
- "infixl 1 &"
3 changes: 3 additions & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ ghc-options:
- -Wno-unsafe

when:
- condition: impl(ghc >= 9.8)
ghc-options:
- -Wno-missing-role-annotations
- condition: impl(ghc >= 9.2)
ghc-options:
- -Wno-missing-kind-signatures
Expand Down
40 changes: 19 additions & 21 deletions src/Yesod/Paginator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,36 @@
-- ^{'simple' 5 pages}
-- |]
-- @
--
module Yesod.Paginator
(
-- * Type-safe numerics
PageNumber
, PerPage
, ItemsCount
( -- * Type-safe numerics
PageNumber
, PerPage
, ItemsCount

-- * Paginated data
, Pages
, pagesCurrent
, Pages
, pagesCurrent

-- * The current page
, Page
, pageItems
, Page
, pageItems

-- * Paginators
, paginate
, paginateWith
, selectPaginated
, selectPaginatedWith
, paginate
, paginateWith
, selectPaginated
, selectPaginatedWith

-- * Widgets
, simple
, simpleWith
, ellipsed
, ellipsedWith
, simple
, simpleWith
, ellipsed
, ellipsedWith

-- * Pagination configuration
, PaginationConfig(..)
, PageParamName(..)
)
, PaginationConfig (..)
, PageParamName (..)
)
where

import Yesod.Paginator.Pages
Expand Down
Loading
Loading