bytestring-show 0.2 → 0.2.1
raw patch · 6 files changed
+55/−25 lines, 6 filesdep +integerdep ~basesetup-changed
Dependencies added: integer
Dependency ranges changed: base
Files
- Setup.lhs +1/−1
- Text/Show/ByteString/Char.hs +0/−0
- Text/Show/ByteString/Float.hs +0/−0
- Text/Show/ByteString/Int.hs +0/−0
- Text/Show/ByteString/Integer.hs +31/−5
- bytestring-show.cabal +23/−19
Setup.lhs view
@@ -2,6 +2,6 @@ > import Distribution.Simple > import System.Cmd (system) -> main = defaultMainWithHooks (defaultUserHooks { runTests = tests })+> main = defaultMainWithHooks (simpleUserHooks { runTests = tests }) > tests _ _ _ _ = system "runhaskell Tests/Properties.hs" >> return ()
Text/Show/ByteString/Char.hs view
Text/Show/ByteString/Float.hs view
Text/Show/ByteString/Int.hs view
Text/Show/ByteString/Integer.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MagicHash, BangPatterns #-}+{-# LANGUAGE UnboxedTuples, MagicHash, BangPatterns, CPP #-} -- --------------------------------------------------------------------------- -- |@@ -15,8 +15,14 @@ module Text.Show.ByteString.Integer where import GHC.Base++#ifdef INTEGER_GMP+import GHC.Integer.Internals+#endif+ import GHC.Num + import Data.Binary.Put import Text.Show.ByteString.Util@@ -47,19 +53,34 @@ splith :: Integer -> [Integer] -> [Integer] splith _ [ ] = error "splith: the impossible happened." splith p (n:ns) = case n `quotRemInteger` p of- (q, r) -> if q > 0+#ifdef INTEGER_GMP+ (# q, r #) ->+#else+ (q, r) -> +#endif+ if q > 0 then q : r : splitb p ns else r : splitb p ns splitb :: Integer -> [Integer] -> [Integer] splitb _ [ ] = [] splitb p (n:ns) = case n `quotRemInteger` p of- (q, r) -> q : r : splitb p ns+#ifdef INTEGER_GMP+ (# q, r #) ->+#else+ (q, r) ->+#endif+ q : r : splitb p ns printh :: [Integer] -> Put printh [ ] = error "printh: the impossible happened." printh (n:ns) = case n `quotRemInteger` mx of- (q', r') -> let q = fromInteger q'+#ifdef INTEGER_GMP+ (# q', r' #) ->+#else+ (q', r') ->+#endif+ let q = fromInteger q' r = fromInteger r' in if q > 0 then phead q >> pblock r >> printb ns else phead r >> printb ns@@ -67,7 +88,12 @@ printb :: [Integer] -> Put printb [ ] = return () printb (n:ns) = case n `quotRemInteger` mx of- (q', r') -> let q = fromInteger q'+#ifdef INTEGER_GMP+ (# q', r' #) ->+#else+ (q', r') ->+#endif+ let q = fromInteger q' r = fromInteger r' in pblock q >> pblock r >> printb ns
bytestring-show.cabal view
@@ -1,31 +1,35 @@-Name: bytestring-show-Version: 0.2-License: BSD3-License-File: LICENSE-Author: Dan Doel-Maintainer: Dan Doel <dan.doel@gmail.com>-Homepage: http://code.haskell.org/~dolio/-Category: Text-Synopsis: Efficient conversion of values into readable byte strings.-Description: Efficient conversion of values into readable byte strings.-Build-Type: Simple-Cabal-Version: >= 1.2+name: bytestring-show+version: 0.2.1+license: BSD3+license-file: LICENSE+author: Dan Doel+maintainer: Dan Doel <dan.doel@gmail.com>+homepage: http://code.haskell.org/~dolio/+category: Text+synopsis: Efficient conversion of values into readable byte strings.+description: Efficient conversion of values into readable byte strings.+build-type: Simple+cabal-version: >= 1.2 -Library- Build-Depends: base, binary, bytestring >= 0.9, array, containers+library+ build-depends: base, binary, bytestring >= 0.9, array, containers - Exposed-Modules:+ exposed-modules: Text.Show.ByteString - Other-Modules:+ other-modules: Text.Show.ByteString.Util Text.Show.ByteString.Char Text.Show.ByteString.Int Text.Show.ByteString.Float Text.Show.ByteString.Integer - Extensions:- MagicHash, BangPatterns, TypeSynonymInstances+ extensions:+ UnboxedTuples, MagicHash, BangPatterns, TypeSynonymInstances, CPP - GHC-Options:+ ghc-options: -O2 -Wall++ if impl(ghc >= 6.9)+ build-depends: integer+ cpp-options: -DINTEGER_GMP