diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,30 +1,19 @@
-Copyright (c)2010, Patrick Brisbin
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
+Copyright (c) 2021 Pat Brisbin <pbrisbin@gmail.com>
 
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
 
-    * Neither the name of Patrick Brisbin nor the names of other
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/doctest/Main.hs b/doctest/Main.hs
--- a/doctest/Main.hs
+++ b/doctest/Main.hs
@@ -1,4 +1,8 @@
-module Main (main) where
+module Main
+    ( main
+    ) where
+
+import Prelude
 
 import Test.DocTest
 
diff --git a/example/Main.hs b/example/Main.hs
--- a/example/Main.hs
+++ b/example/Main.hs
@@ -3,10 +3,16 @@
 {-# LANGUAGE QuasiQuotes #-}
 {-# LANGUAGE TemplateHaskell #-}
 {-# LANGUAGE TypeFamilies #-}
-{-# OPTIONS_GHC -fno-warn-unused-top-binds #-}
+{-# OPTIONS_GHC -Wno-missing-deriving-strategies #-}
+{-# OPTIONS_GHC -Wno-missing-local-signatures #-}
+{-# OPTIONS_GHC -Wno-unused-top-binds #-}
 
-module Main (main) where
+module Main
+    ( main
+    ) where
 
+import Prelude
+
 import Network.Wai.Handler.Warp (run)
 import Yesod
 import Yesod.Paginator
@@ -37,7 +43,7 @@
 
 getRootR :: Handler Html
 getRootR = do
-    let things' = [1..1142] :: [Int]
+    let things' = [1 .. 1142] :: [Int]
 
     pages <- paginate 3 things'
 
diff --git a/src/Yesod/Paginator/Pages.hs b/src/Yesod/Paginator/Pages.hs
--- a/src/Yesod/Paginator/Pages.hs
+++ b/src/Yesod/Paginator/Pages.hs
@@ -31,8 +31,7 @@
     , takeNextPages
     , getPreviousPage
     , getNextPage
-    )
-where
+    ) where
 
 import Yesod.Paginator.Prelude
 
@@ -40,22 +39,19 @@
 import Web.PathPieces
 
 newtype PageNumber = PageNumber Natural
-    deriving (Enum, Eq, Integral, Num, Ord, Real)
-    deriving newtype (Show, ToMarkup)
+    deriving newtype (Enum, Eq, Integral, Num, Ord, Real, Show, ToMarkup)
 
 newtype PerPage = PerPage Natural
-    deriving (Enum, Eq, Integral, Num, Ord, Real)
-    deriving newtype (Read, Show, PathPiece)
+    deriving newtype (Enum, Eq, Integral, Num, Ord, Real, Read, Show, PathPiece)
 
 newtype ItemsCount = ItemsCount Natural
-    deriving (Enum, Eq, Integral, Num, Ord, Real)
-    deriving newtype (Read, Show, PathPiece)
+    deriving newtype (Enum, Eq, Integral, Num, Ord, Real, Read, Show, PathPiece)
 
 data Page a = Page
     { pageItems :: [a]
     , pageNumber :: PageNumber
     }
-    deriving (Eq, Show)
+    deriving stock (Eq, Show)
 
 setPageItems :: Page a -> [b] -> Page b
 setPageItems page items = page { pageItems = items }
@@ -82,7 +78,7 @@
     , pagesNext :: [PageNumber]
     , pagesLast :: PageNumber
     }
-    deriving (Eq, Show)
+    deriving stock (Eq, Show)
 
 setPagesCurrent :: Pages a -> Page b -> Pages b
 setPagesCurrent pages current = pages { pagesCurrent = current }
@@ -97,7 +93,8 @@
     foldMap f = foldMap f . pagesCurrent
 
 instance Traversable Pages where
-    traverse f pages = setPagesCurrent pages <$> traverse f (pagesCurrent pages)
+    traverse f pages =
+        setPagesCurrent pages <$> traverse f (pagesCurrent pages)
 
 -- | Take previous pages, going back from current
 --
@@ -168,6 +165,7 @@
 getLastPage :: ItemsCount -> PerPage -> PageNumber
 getLastPage total = fromIntegral . carry . (total `divMod`) . fromIntegral
   where
+    carry :: (Eq a, Num a) => (a, a) -> a
     carry (q, 0) = q
     carry (q, _) = q + 1
 
diff --git a/src/Yesod/Paginator/PaginationConfig.hs b/src/Yesod/Paginator/PaginationConfig.hs
--- a/src/Yesod/Paginator/PaginationConfig.hs
+++ b/src/Yesod/Paginator/PaginationConfig.hs
@@ -6,8 +6,7 @@
     ( PaginationConfig(..)
     , PageParamName(..)
     , defaultPaginationConfig
-    )
-where
+    ) where
 
 import Yesod.Paginator.Prelude
 
@@ -15,13 +14,13 @@
 import Yesod.Paginator.Pages
 
 newtype PageParamName = PageParamName { unPageParamName :: Text }
-    deriving (Eq)
+    deriving stock Eq
     deriving newtype (Read, Show, PathPiece)
 
 data PaginationConfig = PaginationConfig
-  { paginationConfigPageParamName :: PageParamName
-  , paginationConfigPerPage :: PerPage
-  }
+    { paginationConfigPageParamName :: PageParamName
+    , paginationConfigPerPage :: PerPage
+    }
 
 defaultPaginationConfig :: PaginationConfig
 defaultPaginationConfig = PaginationConfig
diff --git a/src/Yesod/Paginator/Prelude.hs b/src/Yesod/Paginator/Prelude.hs
--- a/src/Yesod/Paginator/Prelude.hs
+++ b/src/Yesod/Paginator/Prelude.hs
@@ -4,13 +4,13 @@
 module Yesod.Paginator.Prelude
     ( module X
     , module Yesod.Paginator.Prelude
-    )
-where
+    ) where
 
 import Prelude as X
 
 import Control.Monad as X
 import Data.List as X
+    (genericDrop, genericLength, genericReplicate, genericTake, nubBy)
 import Data.Maybe as X
 import Data.Text as X (Text, pack, unpack)
 import Numeric.Natural as X
diff --git a/src/Yesod/Paginator/Widgets.hs b/src/Yesod/Paginator/Widgets.hs
--- a/src/Yesod/Paginator/Widgets.hs
+++ b/src/Yesod/Paginator/Widgets.hs
@@ -7,8 +7,7 @@
     , simpleWith
     , ellipsed
     , ellipsedWith
-    )
-where
+    ) where
 
 import Yesod.Paginator.Prelude
 
@@ -100,14 +99,18 @@
         (mFirstPage, firstEllipses)
             | pageNumber (pagesCurrent pages) == 1 = (Nothing, False)
             | headMay prevPages == Just 1 = (Nothing, False)
-            | headMay prevPages == Just 2 = (Just 1, False)
+            | headMay prevPages == Just 2 = (Just (1 :: PageNumber), False)
             | otherwise = (Just 1, True)
 
         (mLastPage, lastEllipses)
-            | pageNumber (pagesCurrent pages) == pagesLast pages = (Nothing, False)
-            | lastMay nextPages == Just (pagesLast pages) = (Nothing, False)
-            | lastMay nextPages == Just (pagesLast pages - 1) = (Just $ pagesLast pages, False)
-            | otherwise = (Just $ pagesLast pages, True)
+            | pageNumber (pagesCurrent pages) == pagesLast pages
+            = (Nothing, False)
+            | lastMay nextPages == Just (pagesLast pages)
+            = (Nothing, False)
+            | lastMay nextPages == Just (pagesLast pages - 1)
+            = (Just $ pagesLast pages, False)
+            | otherwise
+            = (Just $ pagesLast pages, True)
 
     [whamlet|$newline never
         <ul .pagination>
@@ -164,14 +167,21 @@
         then (prevPagesNaive, nextPages)
         else (prevPagesCalcd, nextPages)
   where
-    nextPages = takeNextPages (elements - genericLength prevPagesNaive - 1) pages
+    nextPages =
+        takeNextPages (elements - genericLength prevPagesNaive - 1) pages
     prevPagesNaive = takePreviousPages (elements `div` 2) pages
-    prevPagesCalcd = takePreviousPages (elements - genericLength nextPages - 1) pages
+    prevPagesCalcd =
+        takePreviousPages (elements - genericLength nextPages - 1) pages
 
-getUpdateGetParams :: PageParamName -> WidgetFor site (PageNumber -> [(Text, Text)])
+getUpdateGetParams
+    :: PageParamName -> WidgetFor site (PageNumber -> [(Text, Text)])
 getUpdateGetParams pageParamName = do
     params <- handlerToWidget $ reqGetParams <$> getRequest
-    pure $ \number -> nubOn fst $ [(unPageParamName pageParamName, tshow number)] <> params
+    pure
+        $ \number ->
+              nubOn fst
+                  $ [(unPageParamName pageParamName, tshow number)]
+                  <> params
 
 renderGetParams :: [(Text, Text)] -> Text
 renderGetParams [] = ""
diff --git a/test/Spec.hs b/test/Spec.hs
--- a/test/Spec.hs
+++ b/test/Spec.hs
@@ -1,1 +1,2 @@
+{-# OPTIONS_GHC -Wno-missing-export-lists #-}
 {-# OPTIONS_GHC -F -pgmF hspec-discover #-}
diff --git a/test/SpecHelper.hs b/test/SpecHelper.hs
--- a/test/SpecHelper.hs
+++ b/test/SpecHelper.hs
@@ -3,12 +3,12 @@
 {-# LANGUAGE TemplateHaskell #-}
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE ViewPatterns #-}
+{-# OPTIONS_GHC -Wno-missing-local-signatures #-}
 
 module SpecHelper
     ( module SpecHelper
     , module X
-    )
-where
+    ) where
 
 import Test.Hspec as X
 import Yesod.Core
diff --git a/test/Yesod/Paginator/PagesSpec.hs b/test/Yesod/Paginator/PagesSpec.hs
--- a/test/Yesod/Paginator/PagesSpec.hs
+++ b/test/Yesod/Paginator/PagesSpec.hs
@@ -3,9 +3,10 @@
 
 module Yesod.Paginator.PagesSpec
     ( spec
-    )
-where
+    ) where
 
+import Prelude
+
 import Data.Foldable (traverse_)
 import Data.Functor.Classes (Eq1(..), Show1(..))
 import Data.Proxy
@@ -59,5 +60,8 @@
 itPreserves :: Laws -> Spec
 itPreserves Laws {..} = mkContext $ traverse_ (uncurry mkIt) lawsProperties
   where
+    mkContext :: SpecWith a -> SpecWith a
     mkContext = context $ lawsTypeclass <> " laws"
+
+    mkIt :: Example a => String -> a -> SpecWith (Arg a)
     mkIt name = it $ "preserves " <> name
diff --git a/yesod-paginator.cabal b/yesod-paginator.cabal
--- a/yesod-paginator.cabal
+++ b/yesod-paginator.cabal
@@ -1,104 +1,148 @@
 cabal-version: 1.12
-
--- This file has been generated from package.yaml by hpack version 0.31.2.
---
--- see: https://github.com/sol/hpack
---
--- hash: 997fa6b9ee2b93c5590ad92497cf2b628931167ff2ccdd566227408106b0e1df
-
-name:           yesod-paginator
-version:        1.1.1.0
-synopsis:       A pagination approach for yesod
-description:    Paginate a list showing a per-item widget and links to other pages
-category:       Web, Yesod
-homepage:       http://github.com/pbrisbin/yesod-paginator
-author:         Patrick Brisbin
-maintainer:     pbrisbin@gmail.com
-license:        BSD3
-license-file:   LICENSE
-build-type:     Simple
+name:          yesod-paginator
+version:       1.1.2.1
+license:       MIT
+license-file:  LICENSE
+maintainer:    Patrick Brisbin <pbrisbin@gmail.com>
+author:        Patrick Brisbin <pbrisbin@gmail.com>
+homepage:      http://github.com/pbrisbin/yesod-paginator
+synopsis:      A pagination approach for yesod
+description:
+    Paginate a list showing a per-item widget and links to other pages
 
-source-repository head
-  type: git
-  location: git://github.com/pbrisbin/yesod-paginator.git
+category:      Web, Yesod
+build-type:    Simple
 
 flag examples
-  description: Build the examples
-  manual: False
-  default: False
+    description: Build the examples
+    default:     False
 
 library
-  exposed-modules:
-      Yesod.Paginator
-      Yesod.Paginator.Pages
-      Yesod.Paginator.Paginate
-      Yesod.Paginator.PaginationConfig
-      Yesod.Paginator.Prelude
-      Yesod.Paginator.Widgets
-  other-modules:
-      Paths_yesod_paginator
-  hs-source-dirs:
-      src
-  default-extensions: NoImplicitPrelude
-  ghc-options: -Wall
-  build-depends:
-      base >4.8.0 && <5
-    , blaze-markup
-    , path-pieces
-    , persistent >=2.5
-    , safe
-    , text >=0.11 && <2.0
-    , transformers
-    , uri-encode
-    , yesod-core >=1.4
-  default-language: Haskell2010
+    exposed-modules:
+        Yesod.Paginator
+        Yesod.Paginator.Pages
+        Yesod.Paginator.Paginate
+        Yesod.Paginator.PaginationConfig
+        Yesod.Paginator.Prelude
+        Yesod.Paginator.Widgets
 
+    hs-source-dirs:     src
+    other-modules:      Paths_yesod_paginator
+    default-language:   Haskell2010
+    default-extensions: NoImplicitPrelude
+    ghc-options:
+        -Weverything -Wno-all-missed-specialisations
+        -Wno-missing-import-lists -Wno-safe -Wno-unsafe
+
+    build-depends:
+        base >=4.11.1.0 && <5,
+        blaze-markup >=0.8.2.2,
+        path-pieces >=0.2.1,
+        persistent >=2.8.2,
+        safe >=0.3.17,
+        text >=1.2.3.1,
+        transformers >=0.5.5.0,
+        uri-encode >=1.5.0.5,
+        yesod-core >=1.6.9
+
+    if impl(ghc >=9.2)
+        ghc-options: -Wno-missing-kind-signatures
+
+    if impl(ghc >=8.10)
+        ghc-options:
+            -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module
+
+    if impl(ghc >=8.8)
+        ghc-options: -fwrite-ide-info
+
 executable yesod-paginator-example
-  main-is: Main.hs
-  other-modules:
-      Paths_yesod_paginator
-  hs-source-dirs:
-      example
-  ghc-options: -Wall
-  build-depends:
-      base >4.8.0 && <5
-    , warp
-    , yesod
-    , yesod-paginator
-  if !(flag(examples))
-    buildable: False
-  default-language: Haskell2010
+    main-is:            Main.hs
+    hs-source-dirs:     example
+    other-modules:      Paths_yesod_paginator
+    default-language:   Haskell2010
+    default-extensions: NoImplicitPrelude
+    ghc-options:
+        -Weverything -Wno-all-missed-specialisations
+        -Wno-missing-import-lists -Wno-safe -Wno-unsafe
 
+    build-depends:
+        base >=4.11.1.0 && <5,
+        warp >=3.2.25,
+        yesod >=1.6.0,
+        yesod-paginator -any
+
+    if impl(ghc >=9.2)
+        ghc-options: -Wno-missing-kind-signatures
+
+    if impl(ghc >=8.10)
+        ghc-options:
+            -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module
+
+    if impl(ghc >=8.8)
+        ghc-options: -fwrite-ide-info
+
+    if !flag(examples)
+        buildable: False
+
 test-suite doctests
-  type: exitcode-stdio-1.0
-  main-is: Main.hs
-  other-modules:
-      Paths_yesod_paginator
-  hs-source-dirs:
-      doctest
-  ghc-options: -Wall
-  build-depends:
-      base >4.8.0 && <5
-    , doctest
-  default-language: Haskell2010
+    type:               exitcode-stdio-1.0
+    main-is:            Main.hs
+    hs-source-dirs:     doctest
+    other-modules:      Paths_yesod_paginator
+    default-language:   Haskell2010
+    default-extensions: NoImplicitPrelude
+    ghc-options:
+        -Weverything -Wno-all-missed-specialisations
+        -Wno-missing-import-lists -Wno-safe -Wno-unsafe
 
+    build-depends:
+        base >=4.11.1.0 && <5,
+        doctest >=0.16.0.1
+
+    if impl(ghc >=9.2)
+        ghc-options: -Wno-missing-kind-signatures
+
+    if impl(ghc >=8.10)
+        ghc-options:
+            -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module
+
+    if impl(ghc >=8.8)
+        ghc-options: -fwrite-ide-info
+
 test-suite test
-  type: exitcode-stdio-1.0
-  main-is: Spec.hs
-  other-modules:
-      SpecHelper
-      Yesod.Paginator.PagesSpec
-      Yesod.Paginator.WidgetsSpec
-      Paths_yesod_paginator
-  hs-source-dirs:
-      test
-  ghc-options: -Wall
-  build-depends:
-      QuickCheck
-    , base >4.8.0 && <5
-    , hspec
-    , quickcheck-classes
-    , yesod-core
-    , yesod-paginator
-    , yesod-test
-  default-language: Haskell2010
+    type:               exitcode-stdio-1.0
+    main-is:            Spec.hs
+    hs-source-dirs:     test
+    other-modules:
+        SpecHelper
+        Yesod.Paginator.PagesSpec
+        Yesod.Paginator.WidgetsSpec
+        Paths_yesod_paginator
+
+    default-language:   Haskell2010
+    default-extensions: NoImplicitPrelude
+    ghc-options:
+        -Weverything -Wno-all-missed-specialisations
+        -Wno-missing-import-lists -Wno-safe -Wno-unsafe
+
+    build-depends:
+        QuickCheck >=2.11.3,
+        base >=4.11.1.0 && <5,
+        hspec >=2.5.5,
+        quickcheck-classes >=0.4.13,
+        yesod-core >=1.6.9,
+        yesod-paginator -any,
+        yesod-test >=1.6.5.1
+
+    if impl(ghc >=9.2)
+        ghc-options: -Wno-missing-kind-signatures
+
+    if impl(ghc >=8.10)
+        ghc-options:
+            -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module
+
+    if impl(ghc >=8.8)
+        ghc-options: -fwrite-ide-info
+
+    if impl(ghc >=8.8)
+        ghc-options: -Wno-missing-deriving-strategies
