git.iko.soy/typeable/bytestring-conversion
on 968cc7a help sign in
7 files changed+24−130
since splitsnapshots
unifiedsplit
.travis.yml−84 CHANGELOG.txt−7 README.md+1−2 bytestring-conversion.cabal+19−21 src/Data/ByteString/Conversion/Internal.hs−1 src/Data/ByteString/Conversion/To.hs+4−14 test/Properties.hs−1
.travis.ymldeleted−84
@@ -1,84 +0,0 @@
1−# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
2−language: c
3−sudo: false
4−
5−cache:
6− directories:
7− - $HOME/.cabsnap
8− - $HOME/.cabal/packages
9−
10−before_cache:
11− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
12− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
13−
14−matrix:
15− include:
16− - env: CABALVER=1.18 GHCVER=7.4.2
17− compiler: ": #GHC 7.4.2"
18− addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2], sources: [hvr-ghc]}}
19− - env: CABALVER=1.18 GHCVER=7.6.3
20− compiler: ": #GHC 7.6.3"
21− addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3], sources: [hvr-ghc]}}
22− - env: CABALVER=1.18 GHCVER=7.8.4
23− compiler: ": #GHC 7.8.4"
24− addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
25− - env: CABALVER=1.22 GHCVER=7.10.3
26− compiler: ": #GHC 7.10.3"
27− addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
28−
29−before_install:
30− - unset CC
31− - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
32−
33−install:
34− - cabal --version
35− - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
36− - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
37− then
38− zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
39− $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
40− fi
41− - travis_retry cabal update -v
42− - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
43− - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
44− - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
45−
46−# check whether current requested install-plan matches cached package-db snapshot
47− - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
48− then
49− echo "cabal build-cache HIT";
50− rm -rfv .ghc;
51− cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
52− cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
53− else
54− echo "cabal build-cache MISS";
55− rm -rf $HOME/.cabsnap;
56− mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
57− cabal install --only-dependencies --enable-tests --enable-benchmarks;
58− fi
59−
60−# snapshot package-db on cache miss
61− - if [ ! -d $HOME/.cabsnap ];
62− then
63− echo "snapshotting package-db to build-cache";
64− mkdir $HOME/.cabsnap;
65− cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
66− cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
67− fi
68−
69−# Here starts the actual work to be performed for the package under test;
70−# any command which exits with a non-zero exit code causes the build to fail.
71−script:
72− - if [ -f configure.ac ]; then autoreconf -i; fi
73− - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
74− - cabal build # this builds all libraries and executables (including tests/benchmarks)
75− - cabal test
76− - cabal sdist # tests that a source-distribution can be generated
77−
78−# Check that the resulting source distribution can be built & installed.
79−# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
80−# `cabal install --force-reinstalls dist/*-*.tar.gz`
81− - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
82− (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
83−
84−# EOF
CHANGELOG.txtdeleted−7
@@ -1,7 +0,0 @@
1−0.3.2
2−------
3−- GHC and `bytestring` version compatibility updates.
4−
5−0.3.1
6−------
7−- Use `blaze-textual` on Windows instead of `double-conversion`
README.md+1−2
@@ -1,5 +1,4 @@
11bytestring-conversion
22=====================
33
4−Type-classes to convert values to and from textual `ByteString` encodings.
5−
4+Type-classes to convert values to and from `ByteString`.
bytestring-conversion.cabal+19−21
@@ -1,30 +1,32 @@
11name: bytestring-conversion
2−version: 0.3.2
2+version: 0.3.0
33synopsis: Type-classes to convert values to and from ByteString.
4−license: MPL-2.0
4+license: OtherLicense
55license-file: LICENSE
66author: Toralf Wittner
77maintainer: Toralf Wittner <tw@dtex.org>
8−copyright: (C) 2014-2015 Toralf Wittner
9−homepage: https://gitlab.com/twittner/bytestring-conversion
10−bug-reports: https://gitlab.com/twittner/bytestring-conversion/issues
8+copyright: (c) 2014 Toralf Wittner
9+homepage: https://github.com/twittner/bytestring-conversion/
10+bug-reports: https://github.com/twittner/bytestring-conversion/issues
11+stability: experimental
1112category: Data
1213build-type: Simple
1314cabal-version: >= 1.10
14−extra-source-files: README.md, CHANGELOG.txt
15+extra-source-files: README.md
1516
1617description:
1718 Defines the type-classes 'ToByteString' and 'FromByteString'
18− to convert values to and from textual 'ByteString' encodings.
19+ to convert values to and from ByteString.
1920
2021source-repository head
21− type: git
22− location: git@gitlab.com:twittner/bytestring-conversion.git
22+ type: git
23+ location: git://github.com/twittner/bytestring-conversion.git
2324
2425library
2526 default-language: Haskell2010
2627 hs-source-dirs: src
27− ghc-options: -Wall -O2 -fwarn-tabs
28+ ghc-options: -Wall -O2 -fwarn-tabs -funbox-strict-fields
29+ ghc-prof-options: -prof -auto-all
2830
2931 exposed-modules:
3032 Data.ByteString.Conversion
@@ -35,17 +37,12 @@ library
3537 Data.ByteString.Conversion.Internal
3638
3739 build-depends:
38− base >= 4.5 && < 5.0
39− , attoparsec >= 0.10 && < 1.0
40− , bytestring >= 0.10.2 && < 1.0
41− , case-insensitive >= 1.2 && < 2.0
42− , text >= 0.11 && < 3.0
43−
44− if os(windows)
45− cpp-options: -DWINDOWS
46− build-depends: blaze-textual >= 0.2 && < 0.3
47− else
48− build-depends: double-conversion >= 2.0 && < 3.0
40+ base >= 4.5 && < 5.0
41+ , attoparsec >= 0.10 && < 1.0
42+ , bytestring >= 0.10.4 && < 1.0
43+ , case-insensitive >= 1.2 && < 2.0
44+ , double-conversion >= 2.0 && < 3.0
45+ , text >= 0.11 && < 2.0
4946
5047test-suite bytestring-conversion-tests
5148 type: exitcode-stdio-1.0
@@ -53,6 +50,7 @@ test-suite bytestring-conversion-tests
5350 hs-source-dirs: test
5451 main-is: Tests.hs
5552 ghc-options: -Wall -O2 -fwarn-tabs
53+ ghc-prof-options: -prof -auto-all
5654
5755 other-modules:
5856 Properties
src/Data/ByteString/Conversion/Internal.hs−1
@@ -9,7 +9,6 @@ module Data.ByteString.Conversion.Internal where
99import Control.Applicative
1010import Data.Bits (Bits)
1111import Text.Printf (PrintfArg)
12−import Prelude
1312
1413-- | Newtype wrapper to parse and produce integral numbers in
1514-- hexadecimal format
src/Data/ByteString/Conversion/To.hs+4−14
@@ -3,7 +3,6 @@
33-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
44
55{-# LANGUAGE BangPatterns #-}
6−{-# LANGUAGE CPP #-}
76{-# LANGUAGE OverloadedStrings #-}
87{-# LANGUAGE FlexibleInstances #-}
98
@@ -16,11 +15,13 @@ module Data.ByteString.Conversion.To
1615
1716import Data.ByteString (ByteString)
1817import Data.ByteString.Conversion.Internal
19−import Data.ByteString.Builder
20−import Data.ByteString.Builder.Extra hiding (runBuilder)
18+import Data.ByteString.Lazy.Builder
19+import Data.ByteString.Lazy.Builder.Extras hiding (runBuilder)
2120import Data.CaseInsensitive (CI, original)
21+import Data.Double.Conversion.Text
2222import Data.Int
2323import Data.List (intersperse)
24+import Data.Monoid
2425import Data.Text (Text)
2526import Data.Text.Encoding (encodeUtf8)
2627import Data.Word
@@ -31,12 +32,6 @@ import qualified Data.Text as T
3132import qualified Data.Text.Lazy as TL
3233import qualified Data.Text.Lazy.Encoding as TL
3334
34−#ifdef WINDOWS
35−import Blaze.Text.Double
36−#else
37−import Data.Double.Conversion.Text
38−#endif
39−
4035class ToByteString a where
4136 builder :: a -> Builder
4237
@@ -47,13 +42,8 @@ instance ToByteString Text where builder x = byteString $ encodeUtf8 x
4742instance ToByteString TL.Text where builder x = lazyByteString $ TL.encodeUtf8 x
4843instance ToByteString Char where builder x = builder $ T.singleton x
4944instance ToByteString [Char] where builder x = builder $ TL.pack x
50−#ifdef WINDOWS
51−instance ToByteString Float where builder x = double $ float2Double x
52−instance ToByteString Double where builder x = double x
53−#else
5445instance ToByteString Float where builder x = builder $ toShortest $ float2Double x
5546instance ToByteString Double where builder x = builder $ toShortest x
56−#endif
5747
5848instance ToByteString Int where builder x = intDec x
5949instance ToByteString Int8 where builder x = int8Dec x
test/Properties.hs−1
@@ -17,7 +17,6 @@ import Test.QuickCheck
1717import Test.Tasty
1818import Test.Tasty.QuickCheck
1919import Text.Printf
20−import Prelude
2120
2221tests :: TestTree
2322tests = testGroup "Properties"