Skip to content
Browse files

Remove dependency on bytestring-nums.

  • Loading branch information...
1 parent f92e7cb commit 41428d52d46f0840e9b7ca85c0a5fbca7417a462 @gregorycollins gregorycollins committed Sep 11, 2012
Showing with 6 additions and 14 deletions.
  1. +0 −1 snap-server.cabal
  2. +2 −6 src/Snap/Internal/Http/Parser.hs
  3. +4 −4 src/Snap/Internal/Http/Server.hs
  4. +0 −3 test/snap-server-testsuite.cabal
View
1 snap-server.cabal
@@ -92,7 +92,6 @@ Library
blaze-builder >= 0.2.1.4 && < 0.4,
blaze-builder-enumerator >= 0.2.0 && < 0.3,
bytestring >= 0.9.1 && < 0.11,
- bytestring-nums,
case-insensitive >= 0.3 && < 0.5,
containers >= 0.3 && < 0.6,
directory-tree >= 0.10 && < 0.11,
View
8 src/Snap/Internal/Http/Parser.hs
@@ -28,7 +28,6 @@ import qualified Data.ByteString.Char8 as S
import qualified Data.ByteString.Unsafe as S
import Data.ByteString.Internal (w2c)
import qualified Data.ByteString.Lazy.Char8 as L
-import qualified Data.ByteString.Nums.Careless.Hex as Cvt
import Data.Char
import Data.Int
import Data.Typeable
@@ -207,15 +206,12 @@ chunkParserToEnumeratee getChunk client = do
------------------------------------------------------------------------------
pGetTransferChunk :: Parser (Maybe ByteString)
pGetTransferChunk = do
- !hex <- liftM fromHex $ (takeWhile (isHexDigit . w2c))
+ !hex <- liftM unsafeFromHex $ (takeWhile (isHexDigit . w2c))
takeTill ((== '\r') . w2c)
crlf
- if hex <= 0
+ if hex <= (0 :: Int)
then return Nothing
else do
x <- take hex
crlf
return $! Just x
- where
- fromHex :: ByteString -> Int
- fromHex s = Cvt.hex (L.fromChunks [s])
View
8 src/Snap/Internal/Http/Server.hs
@@ -28,7 +28,6 @@ import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as SC
import qualified Data.ByteString.Lazy as L
import Data.ByteString.Internal (c2w, w2c)
-import qualified Data.ByteString.Nums.Careless.Int as Cvt
import Data.Enumerator.Internal
import Data.Int
import Data.IORef
@@ -63,6 +62,7 @@ import qualified Snap.Internal.Http.Server.TLS as TLS
import Snap.Internal.Http.Server.SimpleBackend
import Snap.Internal.Iteratee.Debug
+import Snap.Internal.Parsing (unsafeFromInt)
import Snap.Iteratee hiding (head, take, map)
import qualified Snap.Iteratee as I
@@ -600,7 +600,7 @@ receiveRequest writeEnd = do
hdrs = rqHeaders req
- mbCL = H.lookup "content-length" hdrs >>= return . Cvt.int . head
+ mbCL = H.lookup "content-length" hdrs >>= return . unsafeFromInt . head
--------------------------------------------------------------------------
@@ -694,7 +694,7 @@ receiveRequest writeEnd = do
hdrs = toHeaders kvps
- mbContentLength = liftM (Cvt.int . head) $
+ mbContentLength = liftM (unsafeFromInt . head) $
H.lookup "content-length" hdrs
cookies = concat $
@@ -704,7 +704,7 @@ receiveRequest writeEnd = do
contextPath = "/"
- parseHost h = (a, Cvt.int (S.drop 1 b))
+ parseHost h = (a, unsafeFromInt (S.drop 1 b))
where
(a,b) = S.break (== (c2w ':')) h
View
3 test/snap-server-testsuite.cabal
@@ -26,7 +26,6 @@ Executable testsuite
blaze-builder >= 0.2.1.4 && <0.4,
blaze-builder-enumerator >= 0.2.0 && <0.3,
bytestring,
- bytestring-nums >= 0.3.1 && <0.4,
containers,
directory,
directory-tree,
@@ -93,7 +92,6 @@ Executable pongserver
blaze-builder >= 0.2.1.4 && <0.4,
blaze-builder-enumerator >= 0.2.0 && <0.3,
bytestring,
- bytestring-nums >= 0.3.1 && <0.4,
cereal >= 0.3 && <0.4,
containers,
directory-tree,
@@ -160,7 +158,6 @@ Executable testserver
blaze-builder >= 0.2.1.4 && <0.4,
blaze-builder-enumerator >= 0.2.0 && <0.3,
bytestring,
- bytestring-nums >= 0.3.1 && <0.4,
case-insensitive >= 0.3 && <0.5,
containers,
directory-tree,

0 comments on commit 41428d5

Please sign in to comment.
Something went wrong with that request. Please try again.