packages feed

bytestring-nums 0.3.1 → 0.3.2

raw patch · 5 files changed

+13/−74 lines, 5 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

- Data.ByteString.Nums.Careless: class (Intable b f, Fractional f) => Floatable b f
- Data.ByteString.Nums.Careless: class (Num n) => Hexable b n
- Data.ByteString.Nums.Careless: class (Num n) => Intable b n
- Data.ByteString.Nums.Careless: float :: (Floatable b f) => b -> f
- Data.ByteString.Nums.Careless: hex :: (Hexable b n) => b -> n
- Data.ByteString.Nums.Careless: int :: (Intable b n) => b -> n
- Data.ByteString.Nums.Careless.Float: lazy_float :: (Intable ByteString f, Fractional f) => ByteString -> f
- Data.ByteString.Nums.Careless.Float: point :: Char -> Bool
- Data.ByteString.Nums.Careless.Float: strict_float :: (Intable ByteString f, Fractional f) => ByteString -> f
- Data.ByteString.Nums.Careless.Hex: lazy_hex :: (Num n) => ByteString -> n
- Data.ByteString.Nums.Careless.Hex: strict_hex :: (Num n) => ByteString -> n
- Data.ByteString.Nums.Careless.Int: lazy_signed :: (Num n) => ByteString -> n
- Data.ByteString.Nums.Careless.Int: negative :: (Num n) => n -> Word8 -> n
- Data.ByteString.Nums.Careless.Int: positive :: (Num n) => n -> Word8 -> n
- Data.ByteString.Nums.Careless.Int: strict_signed :: (Num n) => ByteString -> n
- Data.ByteString.Nums.Careless.Float: float :: (Floatable b f) => b -> f
+ Data.ByteString.Nums.Careless.Float: float :: Floatable b f => b -> f
- Data.ByteString.Nums.Careless.Hex: class (Num n) => Hexable b n
+ Data.ByteString.Nums.Careless.Hex: class Num n => Hexable b n
- Data.ByteString.Nums.Careless.Hex: hex :: (Hexable b n) => b -> n
+ Data.ByteString.Nums.Careless.Hex: hex :: Hexable b n => b -> n
- Data.ByteString.Nums.Careless.Hex: hexalize :: (Num n) => n -> Word8 -> n
+ Data.ByteString.Nums.Careless.Hex: hexalize :: Num n => n -> Word8 -> n
- Data.ByteString.Nums.Careless.Int: class (Num n) => Intable b n
+ Data.ByteString.Nums.Careless.Int: class Num n => Intable b n
- Data.ByteString.Nums.Careless.Int: int :: (Intable b n) => b -> n
+ Data.ByteString.Nums.Careless.Int: int :: Intable b n => b -> n
- Data.ByteString.Nums.Careless.Int: lazy_unsigned :: (Num n) => ByteString -> n
+ Data.ByteString.Nums.Careless.Int: lazy_unsigned :: Num n => ByteString -> n
- Data.ByteString.Nums.Careless.Int: strict_unsigned :: (Num n) => ByteString -> n
+ Data.ByteString.Nums.Careless.Int: strict_unsigned :: Num n => ByteString -> n

Files

Data/ByteString/Nums/Careless.hs view
@@ -1,12 +1,13 @@   -{-| Careless conversion of @ByteString@s to numbers.+{-| Careless conversion of @ByteString@s to numbers, ignoring bytes that+    aren't hex or decimal digits.  -} module Data.ByteString.Nums.Careless-  ( Intable(..) -  , Hexable(..)-  , Floatable(..)+  ( module Data.ByteString.Nums.Careless.Int+  , module Data.ByteString.Nums.Careless.Hex+  , module Data.ByteString.Nums.Careless.Float   ) where  
Data/ByteString/Nums/Careless/Float.hs view
@@ -2,16 +2,10 @@  {-# LANGUAGE MultiParamTypeClasses            , TypeSynonymInstances-           , FlexibleContexts   #-}  -module Data.ByteString.Nums.Careless.Float-  ( point-  , lazy_float-  , strict_float-  , Floatable(..)-  ) where+module Data.ByteString.Nums.Careless.Float where   import Data.Char@@ -52,9 +46,6 @@   -{-| Implementation for strict @Data.ByteString.ByteString@.- -}-strict_float :: (Intable ByteString f, Fractional f) => ByteString -> f strict_float bytes   | null bytes               =  0   | head bytes == '-'        =  foldn 0 (tail integer) + nfrac@@ -74,9 +65,6 @@     | otherwise              =  foldp 0 fractional' * p  -{-| Implementation for lazy @Data.ByteString.Lazy.ByteString@.- -}-lazy_float :: (Intable Lazy.ByteString f, Fractional f) => Lazy.ByteString -> f lazy_float bytes   | Lazy.null bytes          =  0   | Lazy.head bytes == '-'   =  foldn 0 (Lazy.tail integer) + nfrac@@ -96,9 +84,6 @@     | otherwise              =  foldp 0 fractional' * p  -{-| Is this character a decimal point or comma?- -}-point                       ::  Char -> Bool point c                      =  c == '.' || c == ','  
Data/ByteString/Nums/Careless/Hex.hs view
@@ -5,12 +5,7 @@   #-}  -module Data.ByteString.Nums.Careless.Hex-  ( hexalize-  , lazy_hex-  , strict_hex-  , Hexable(..)-  ) where+module Data.ByteString.Nums.Careless.Hex where   import Prelude hiding (head, tail, drop)@@ -94,9 +89,6 @@   -{-| Folds a byte into a number if the byte is a hexadecimal digit; otherwise-    the byte is ignored.- -} hexalize                    ::  (Num n) => n -> Word8 -> n hexalize acc byte   | between 'a' 'f'          =  place_up (byte + 0x0a - c2w 'a')@@ -107,15 +99,8 @@   between a z                =  byte >= c2w a && byte <= c2w z   place_up b                 =  (0x10 * acc) + fromIntegral b --{-| Strict fold with 'hexalize'.- -}-strict_hex                  ::  (Num n) => ByteString -> n strict_hex bytes             =  foldl' hexalize 0 bytes -{-| Lazy fold with 'hexalize'.- -}-lazy_hex                    ::  (Num n) => Lazy.ByteString -> n lazy_hex bytes               =  Lazy.foldlChunks (foldl' hexalize) 0 bytes  
Data/ByteString/Nums/Careless/Int.hs view
@@ -5,15 +5,7 @@   #-}  -module Data.ByteString.Nums.Careless.Int-  ( positive-  , negative-  , lazy_unsigned-  , lazy_signed-  , strict_unsigned-  , strict_signed-  , Intable(..)-  ) where+module Data.ByteString.Nums.Careless.Int where   import Prelude hiding (head, tail, null)@@ -97,18 +89,9 @@   -{-| Implementation of unsigned number parser for-    'Data.ByteString.Lazy.ByteString'. Only digits are parsed; no sign-    specifier is allowed.- -} lazy_unsigned               ::  (Num n) => Lazy.ByteString -> n lazy_unsigned                =  Lazy.foldlChunks (foldl' positive) 0 -{-| Implementation of signed number parser for-    'Data.ByteString.Lazy.ByteString'. An initial, optional sign specifier is-    okay.- -}-lazy_signed                 ::  (Num n) => Lazy.ByteString -> n lazy_signed bytes   | Lazy.null bytes          =  0   | Lazy.head bytes == '-'   =  fold negative 0 (Lazy.tail bytes)@@ -118,16 +101,9 @@   fold                       =  Lazy.foldlChunks . foldl'  -{-| Implementation of unsigned number parser for 'Data.ByteString.ByteString'.-    Only digits are parsed; no sign specifier is allowed.- -} strict_unsigned             ::  (Num n) => ByteString -> n strict_unsigned              =  foldl' positive 0 -{-| Implementation of signed number parser for 'Data.ByteString.ByteString'.-    An initial, optional sign specifier is okay.- -}-strict_signed               ::  (Num n) => ByteString -> n strict_signed bytes   | null bytes               =  0   | head bytes == '-'        =  foldl' negative 0 (tail bytes)@@ -135,16 +111,8 @@   | otherwise                =  foldl' positive 0 bytes  -{-| Folds a byte into the accumulator, assuming the number we are parsing is-    a positive number.- -}-positive                    ::  (Num n) => n -> Word8 -> n positive  acc  byte          =  (acc * 10) + fromIntegral (byte - c2w '0') -{-| Folds a byte into the accumulator, assuming the number we are parsing is-    a negative number.- -}-negative                    ::  (Num n) => n -> Word8 -> n negative  acc  byte          =  (acc * 10) - fromIntegral (byte - c2w '0')  
bytestring-nums.cabal view
@@ -1,12 +1,12 @@ name                          : bytestring-nums-version                       : 0.3.1+version                       : 0.3.2 category                      : Text license                       : BSD3 license-file                  : LICENSE author                        : Jason Dusek maintainer                    : jason.dusek@gmail.com stability                     : experimental-homepage                      : http://github.com/jsnx/bytestring-nums+homepage                      : http://github.com/solidsnack/bytestring-nums synopsis                      : Parse numeric literals from ByteStrings. description                   :   Parse numeric literals from ByteStrings.@@ -18,7 +18,7 @@   library-  build-depends               : base >= 3 && <= 4 +  build-depends               : base >= 3 && < 5                               , containers                               , bytestring >= 0.9   exposed-modules             : Data.ByteString.Nums.Careless@@ -27,7 +27,7 @@                                 Data.ByteString.Nums.Careless.Float   extensions                  : MultiParamTypeClasses                                 TypeSynonymInstances-                                FlexibleContexts+                                BangPatterns   ghc-options                 : -O2 -Wall -funbox-strict-fields  @@ -35,7 +35,7 @@   main-is                     : SPOJEugeneKirpichov.hs   extensions                  : MultiParamTypeClasses                                 TypeSynonymInstances-                                FlexibleContexts+                                BangPatterns   ghc-options                 : -O2 -Wall -funbox-strict-fields