git.iko.soy/typeable/http-api-data
on master help sign in
Allow negative integers yesodweb/yesod#613
commit8fe4152722dc999e6ec0afaf738330827858b37e authorMichael Snoyman <michael@snoyman.com> dateFri 18 Oct 2013, 06:45 (13 years ago) parent658f725
3 files changed+4−5
Web/PathPieces.hs+3−3 path-pieces.cabal−1 test/main.hs+1−1
Web/PathPieces.hs+3−3
@@ -33,21 +33,21 @@ instance PathPiece L.Text where
3333
3434instance PathPiece Integer where
3535 fromPathPiece s =
36− case Data.Text.Read.decimal s of
36+ case Data.Text.Read.signed Data.Text.Read.decimal s of
3737 Right (i, _) -> Just i
3838 Left _ -> Nothing
3939 toPathPiece = S.pack . show
4040
4141instance PathPiece Int where
4242 fromPathPiece s =
43− case Data.Text.Read.decimal s of
43+ case Data.Text.Read.signed Data.Text.Read.decimal s of
4444 Right (i, _) -> Just i
4545 Left _ -> Nothing
4646 toPathPiece = S.pack . show
4747
4848instance PathPiece Int64 where
4949 fromPathPiece s =
50− case Data.Text.Read.decimal s of
50+ case Data.Text.Read.signed Data.Text.Read.decimal s of
5151 Right (i, _) -> Just i
5252 Left _ -> Nothing
5353 toPathPiece = S.pack . show
path-pieces.cabal−1
@@ -26,7 +26,6 @@ test-suite test
2626 ghc-options: -Wall
2727 build-depends: HUnit
2828 , hspec >= 1.3
29− , file-location >= 0.4 && < 0.5
3029 , base >= 4 && < 5
3130 , QuickCheck
3231 , path-pieces
test/main.hs+1−1
@@ -34,7 +34,7 @@ spec = do
3434
3535 prop "toPathPiece <=> fromPathPiece String" $ \(p::Int) ->
3636 case (fromPathPiece . toPathPiece) p of
37− Nothing -> p < 0
37+ Nothing -> False
3838 Just pConverted -> p == pConverted
3939
4040 describe "PathMultiPiece" $ do