packages feed

bytestring-conversion 0.3.0 → 0.3.1

raw patch · 6 files changed

+31/−8 lines, 6 filesdep +blaze-textual

Dependencies added: blaze-textual

Files

+ CHANGELOG.txt view
@@ -0,0 +1,3 @@+0.3.1+------+- Use `blaze-textual` on Windows instead of `double-conversion`
README.md view
@@ -1,4 +1,8 @@ bytestring-conversion ===================== +[![Build Status](https://travis-ci.org/twittner/bytestring-conversion.svg?branch=master)][1]+ Type-classes to convert values to and from `ByteString`.++[1]: https://travis-ci.org/twittner/bytestring-conversion
bytestring-conversion.cabal view
@@ -1,18 +1,18 @@ name:                bytestring-conversion-version:             0.3.0+version:             0.3.1 synopsis:            Type-classes to convert values to and from ByteString.-license:             OtherLicense+license:             MPL-2.0 license-file:        LICENSE author:              Toralf Wittner maintainer:          Toralf Wittner <tw@dtex.org>-copyright:           (c) 2014 Toralf Wittner+copyright:           (C) 2014-2015 Toralf Wittner homepage:            https://github.com/twittner/bytestring-conversion/ bug-reports:         https://github.com/twittner/bytestring-conversion/issues stability:           experimental category:            Data build-type:          Simple cabal-version:       >= 1.10-extra-source-files:  README.md+extra-source-files:  README.md, CHANGELOG.txt  description:     Defines the type-classes 'ToByteString' and 'FromByteString'@@ -26,7 +26,6 @@     default-language: Haskell2010     hs-source-dirs:   src     ghc-options:      -Wall -O2 -fwarn-tabs -funbox-strict-fields-    ghc-prof-options: -prof -auto-all      exposed-modules:         Data.ByteString.Conversion@@ -41,16 +40,20 @@       , attoparsec        >= 0.10   && < 1.0       , bytestring        >= 0.10.4 && < 1.0       , case-insensitive  >= 1.2    && < 2.0-      , double-conversion >= 2.0    && < 3.0       , text              >= 0.11   && < 2.0 +    if os(windows)+        cpp-options:   -DWINDOWS+        build-depends: blaze-textual >= 0.2 && < 0.3+    else+        build-depends: double-conversion >= 2.0 && < 3.0+ test-suite bytestring-conversion-tests     type:             exitcode-stdio-1.0     default-language: Haskell2010     hs-source-dirs:   test     main-is:          Tests.hs     ghc-options:      -Wall -O2 -fwarn-tabs-    ghc-prof-options: -prof -auto-all      other-modules:         Properties
src/Data/ByteString/Conversion/Internal.hs view
@@ -9,6 +9,7 @@ import Control.Applicative import Data.Bits (Bits) import Text.Printf (PrintfArg)+import Prelude  -- | Newtype wrapper to parse and produce integral numbers in -- hexadecimal format
src/Data/ByteString/Conversion/To.hs view
@@ -3,6 +3,7 @@ -- file, You can obtain one at http://mozilla.org/MPL/2.0/.  {-# LANGUAGE BangPatterns      #-}+{-# LANGUAGE CPP               #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE FlexibleInstances #-} @@ -18,7 +19,6 @@ import Data.ByteString.Lazy.Builder import Data.ByteString.Lazy.Builder.Extras hiding (runBuilder) import Data.CaseInsensitive (CI, original)-import Data.Double.Conversion.Text import Data.Int import Data.List (intersperse) import Data.Monoid@@ -32,6 +32,12 @@ import qualified Data.Text.Lazy          as TL import qualified Data.Text.Lazy.Encoding as TL +#ifdef WINDOWS+import Blaze.Text.Double+#else+import Data.Double.Conversion.Text+#endif+ class ToByteString a where     builder :: a -> Builder @@ -42,8 +48,13 @@ instance ToByteString TL.Text      where builder x = lazyByteString $ TL.encodeUtf8 x instance ToByteString Char         where builder x = builder $ T.singleton x instance ToByteString [Char]       where builder x = builder $ TL.pack x+#ifdef WINDOWS+instance ToByteString Float        where builder x = double $ float2Double x+instance ToByteString Double       where builder x = double x+#else instance ToByteString Float        where builder x = builder $ toShortest $ float2Double x instance ToByteString Double       where builder x = builder $ toShortest x+#endif  instance ToByteString Int          where builder x = intDec x instance ToByteString Int8         where builder x = int8Dec x
test/Properties.hs view
@@ -17,6 +17,7 @@ import Test.Tasty import Test.Tasty.QuickCheck import Text.Printf+import Prelude  tests :: TestTree tests = testGroup "Properties"