Skip to content
Browse files

Fix Cabal warnings.

  • Loading branch information...
1 parent 7a1b2e4 commit 033ea83162eaf988af3e4e71c334d23fd0c0a1ef @solidsnack committed
View
4 Data/ByteString/Nums/Careless/Float.hs
@@ -9,7 +9,6 @@
module Data.ByteString.Nums.Careless.Float where
-import Data.Char
import Prelude hiding (break, length, null, drop, tail, head)
import Data.ByteString hiding (head, break, pack)
import Data.ByteString.Char8 hiding (inits, elem, last, foldl')
@@ -47,6 +46,7 @@ instance Floatable Lazy.ByteString Rational where
+strict_float :: (Fractional f) => ByteString -> f
strict_float bytes
| null bytes = 0
| head bytes == '-' = foldn 0 (tail integer) + nfrac
@@ -66,6 +66,7 @@ strict_float bytes
| otherwise = foldp 0 fractional' * p
+lazy_float :: (Fractional f) => Lazy.ByteString -> f
lazy_float bytes
| Lazy.null bytes = 0
| Lazy.head bytes == '-' = foldn 0 (Lazy.tail integer) + nfrac
@@ -85,6 +86,7 @@ lazy_float bytes
| otherwise = foldp 0 fractional' * p
+point :: Char -> Bool
point c = c == '.' || c == ','
View
4 Data/ByteString/Nums/Careless/Hex.hs
@@ -12,9 +12,7 @@ module Data.ByteString.Nums.Careless.Hex where
import Prelude hiding (head, tail, drop)
import Data.Word
import Data.Int
-import Data.Ratio
import Data.ByteString hiding (head, pack)
-import Data.ByteString.Char8 hiding (foldl')
import Data.ByteString.Internal
import qualified Data.ByteString.Lazy.Char8 as Lazy
import qualified Data.ByteString.Lazy.Internal as Lazy
@@ -100,8 +98,10 @@ hexalize acc byte
between a z = byte >= c2w a && byte <= c2w z
place_up b = (0x10 * acc) + fromIntegral b
+strict_hex :: (Num n) => ByteString -> n
strict_hex bytes = foldl' hexalize 0 bytes
+lazy_hex :: (Num n) => Lazy.ByteString -> n
lazy_hex bytes = Lazy.foldlChunks (foldl' hexalize) 0 bytes
View
5 Data/ByteString/Nums/Careless/Int.hs
@@ -12,7 +12,6 @@ module Data.ByteString.Nums.Careless.Int where
import Prelude hiding (head, tail, null)
import Data.Word
import Data.Int
-import Data.Ratio
import Data.ByteString hiding (head, pack)
import Data.ByteString.Internal
import Data.ByteString.Char8 hiding (foldl')
@@ -93,6 +92,7 @@ instance Intable Lazy.ByteString Integer where
lazy_unsigned :: (Num n) => Lazy.ByteString -> n
lazy_unsigned = Lazy.foldlChunks (foldl' positive) 0
+lazy_signed :: (Num n) => Lazy.ByteString -> n
lazy_signed bytes
| Lazy.null bytes = 0
| Lazy.head bytes == '-' = fold negative 0 (Lazy.tail bytes)
@@ -105,6 +105,7 @@ lazy_signed bytes
strict_unsigned :: (Num n) => ByteString -> n
strict_unsigned = foldl' positive 0
+strict_signed :: (Num n) => ByteString -> n
strict_signed bytes
| null bytes = 0
| head bytes == '-' = foldl' negative 0 (tail bytes)
@@ -112,8 +113,10 @@ strict_signed bytes
| otherwise = foldl' positive 0 bytes
+positive :: (Num n) => n -> Word8 -> n
positive acc byte = (acc * 10) + fromIntegral (byte - c2w '0')
+negative :: (Num n) => n -> Word8 -> n
negative acc byte = (acc * 10) - fromIntegral (byte - c2w '0')
View
2 bytestring-nums.cabal
@@ -1,5 +1,5 @@
name : bytestring-nums
-version : 0.3.5
+version : 0.3.6
category : Text
license : BSD3
license-file : LICENSE

0 comments on commit 033ea83

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