diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 75e0a89..d50d39c 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -28,9 +28,14 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.2.2 + - compiler: ghc-9.4.2 compilerKind: ghc - compilerVersion: 9.2.2 + compilerVersion: 9.4.2 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.2.5 + compilerKind: ghc + compilerVersion: 9.2.5 setup-method: ghcup allow-failure: false - compiler: ghc-9.0.2 diff --git a/Web/Routes/PathInfo.hs b/Web/Routes/PathInfo.hs index 0668429..9675def 100644 --- a/Web/Routes/PathInfo.hs +++ b/Web/Routes/PathInfo.hs @@ -32,12 +32,13 @@ import Control.Applicative ((<$>), (<*)) import Control.Monad (msum) import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as B -import Data.Int (Int64) +import Data.Int (Int8, Int16, Int32, Int64) import Data.List as List (stripPrefix, tails) import Data.Text as Text (Text, pack, unpack, null, tails, stripPrefix) import Data.Text.Encoding (decodeUtf8) import Data.Text.Read (decimal, signed) import Data.Maybe (fromJust) +import Data.Word (Word, Word8, Word16, Word32, Word64) import Network.HTTP.Types import Text.ParserCombinators.Parsec.Combinator (notFollowedBy) import Text.ParserCombinators.Parsec.Error (ParseError, errorPos, errorMessages, showErrorMessages) @@ -340,14 +341,46 @@ instance PathInfo Int where toPathSegments i = [pack $ show i] fromPathSegments = pToken (const "Int") checkIntegral -instance PathInfo Integer where +instance PathInfo Int8 where toPathSegments i = [pack $ show i] - fromPathSegments = pToken (const "Integer") checkIntegral + fromPathSegments = pToken (const "Int8") checkIntegral + +instance PathInfo Int16 where + toPathSegments i = [pack $ show i] + fromPathSegments = pToken (const "Int16") checkIntegral + +instance PathInfo Int32 where + toPathSegments i = [pack $ show i] + fromPathSegments = pToken (const "Int32") checkIntegral instance PathInfo Int64 where toPathSegments i = [pack $ show i] fromPathSegments = pToken (const "Int64") checkIntegral +instance PathInfo Integer where + toPathSegments i = [pack $ show i] + fromPathSegments = pToken (const "Integer") checkIntegral + +instance PathInfo Word where + toPathSegments i = [pack $ show i] + fromPathSegments = pToken (const "Word") checkIntegral + +instance PathInfo Word8 where + toPathSegments i = [pack $ show i] + fromPathSegments = pToken (const "Word8") checkIntegral + +instance PathInfo Word16 where + toPathSegments i = [pack $ show i] + fromPathSegments = pToken (const "Word16") checkIntegral + +instance PathInfo Word32 where + toPathSegments i = [pack $ show i] + fromPathSegments = pToken (const "Word32") checkIntegral + +instance PathInfo Word64 where + toPathSegments i = [pack $ show i] + fromPathSegments = pToken (const "Word64") checkIntegral + checkIntegral :: Integral a => Text -> Maybe a checkIntegral txt = case signed decimal txt of diff --git a/web-routes.cabal b/web-routes.cabal index 659c97e..32fc610 100644 --- a/web-routes.cabal +++ b/web-routes.cabal @@ -1,5 +1,5 @@ Name: web-routes -Version: 0.27.14.4 +Version: 0.27.15 License: BSD3 License-File: LICENSE Author: jeremy@seereason.com @@ -10,7 +10,7 @@ Description: A collection of types and functions that ensure that URLs gene Homepage: http://www.happstack.com/docs/crashcourse/index.html#web-routes Cabal-Version: >= 1.10 Build-type: Simple -tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.1, GHC==8.6.5, GHC==8.8.4, GHC==8.10.7, GHC==9.0.2, GHC==9.2.2 +tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.1, GHC==8.6.5, GHC==8.8.4, GHC==8.10.7, GHC==9.0.2, GHC==9.2.5, GHC==9.4.2 test-suite Test Default-Language : Haskell2010 @@ -31,7 +31,7 @@ Library parsec >= 2 && < 4, bytestring >= 0.9 && < 0.12, http-types >= 0.6 && < 0.13, - mtl >= 2.0 && < 2.3, + mtl >= 2.0 && < 2.4, text >= 0.11 && < 2.1, utf8-string >= 0.3 && < 1.1, exceptions >= 0.6.1 && < 0.11