git.iko.soy/typeable/bytestring-conversion
on 5ededa3 help sign in
.travis.yml+4−84
since splitsnapshots
unifiedsplit
@@ -1,84 +1,4 @@
1−# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
2−language: c
1+language: haskell
3−sudo: false
2+ghc:
4−
3+ - 7.8
5−cache:
4+ - 7.6
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+4−1
@@ -1,5 +1,8 @@
1bytestring-conversion
1bytestring-conversion
2=====================
2=====================
3
3
4−Type-classes to convert values to and from textual `ByteString` encodings.
4+[![Build Status](https://travis-ci.org/twittner/bytestring-conversion.svg?branch=master)][1]
5
5
6+Type-classes to convert values to and from `ByteString`.
7+
8+[1]: https://travis-ci.org/twittner/bytestring-conversion
bytestring-conversion.cabal+19−21
@@ -1,30 +1,32 @@
1name: bytestring-conversion
1name: bytestring-conversion
2−version: 0.3.2
2+version: 0.3.0
3synopsis: Type-classes to convert values to and from ByteString.
3synopsis: Type-classes to convert values to and from ByteString.
4−license: MPL-2.0
4+license: OtherLicense
5license-file: LICENSE
5license-file: LICENSE
6author: Toralf Wittner
6author: Toralf Wittner
7maintainer: Toralf Wittner <tw@dtex.org>
7maintainer: Toralf Wittner <tw@dtex.org>
8−copyright: (C) 2014-2015 Toralf Wittner
8+copyright: (c) 2014 Toralf Wittner
9−homepage: https://gitlab.com/twittner/bytestring-conversion
9+homepage: https://github.com/twittner/bytestring-conversion/
10−bug-reports: https://gitlab.com/twittner/bytestring-conversion/issues
10+bug-reports: https://github.com/twittner/bytestring-conversion/issues
11+stability: experimental
11category: Data
12category: Data
12build-type: Simple
13build-type: Simple
13cabal-version: >= 1.10
14cabal-version: >= 1.10
14−extra-source-files: README.md, CHANGELOG.txt
15+extra-source-files: README.md
15
16
16description:
17description:
17 Defines the type-classes 'ToByteString' and 'FromByteString'
18 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.
19
20
20source-repository head
21source-repository head
21− type: git
22+ type: git
22− location: git@gitlab.com:twittner/bytestring-conversion.git
23+ location: git://github.com/twittner/bytestring-conversion.git
23
24
24library
25library
25 default-language: Haskell2010
26 default-language: Haskell2010
26 hs-source-dirs: src
27 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
28
30
29 exposed-modules:
31 exposed-modules:
30 Data.ByteString.Conversion
32 Data.ByteString.Conversion
@@ -35,17 +37,12 @@ library
35 Data.ByteString.Conversion.Internal
37 Data.ByteString.Conversion.Internal
36
38
37 build-depends:
39 build-depends:
38− base >= 4.5 && < 5.0
40+ base >= 4.5 && < 5.0
39− , attoparsec >= 0.10 && < 1.0
41+ , attoparsec >= 0.10 && < 1.0
40− , bytestring >= 0.10.2 && < 1.0
42+ , bytestring >= 0.10.4 && < 1.0
41− , case-insensitive >= 1.2 && < 2.0
43+ , 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
44+ , double-conversion >= 2.0 && < 3.0
45+ , text >= 0.11 && < 2.0
49
46
50test-suite bytestring-conversion-tests
47test-suite bytestring-conversion-tests
51 type: exitcode-stdio-1.0
48 type: exitcode-stdio-1.0
@@ -53,6 +50,7 @@ test-suite bytestring-conversion-tests
53 hs-source-dirs: test
50 hs-source-dirs: test
54 main-is: Tests.hs
51 main-is: Tests.hs
55 ghc-options: -Wall -O2 -fwarn-tabs
52 ghc-options: -Wall -O2 -fwarn-tabs
53+ ghc-prof-options: -prof -auto-all
56
54
57 other-modules:
55 other-modules:
58 Properties
56 Properties
src/Data/ByteString/Conversion/To.hs+4−14
@@ -3,7 +3,6 @@
3-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
3-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
4
5{-# LANGUAGE BangPatterns #-}
5{-# LANGUAGE BangPatterns #-}
6−{-# LANGUAGE CPP #-}
7{-# LANGUAGE OverloadedStrings #-}
6{-# LANGUAGE OverloadedStrings #-}
8{-# LANGUAGE FlexibleInstances #-}
7{-# LANGUAGE FlexibleInstances #-}
9
8
@@ -16,11 +15,13 @@ module Data.ByteString.Conversion.To
16
15
17import Data.ByteString (ByteString)
16import Data.ByteString (ByteString)
18import Data.ByteString.Conversion.Internal
17import Data.ByteString.Conversion.Internal
19−import Data.ByteString.Builder
18+import Data.ByteString.Lazy.Builder
20−import Data.ByteString.Builder.Extra hiding (runBuilder)
19+import Data.ByteString.Lazy.Builder.Extras hiding (runBuilder)
21import Data.CaseInsensitive (CI, original)
20import Data.CaseInsensitive (CI, original)
21+import Data.Double.Conversion.Text
22import Data.Int
22import Data.Int
23import Data.List (intersperse)
23import Data.List (intersperse)
24+import Data.Monoid
24import Data.Text (Text)
25import Data.Text (Text)
25import Data.Text.Encoding (encodeUtf8)
26import Data.Text.Encoding (encodeUtf8)
26import Data.Word
27import Data.Word
@@ -31,12 +32,6 @@ import qualified Data.Text as T
31import qualified Data.Text.Lazy as TL
32import qualified Data.Text.Lazy as TL
32import qualified Data.Text.Lazy.Encoding as TL
33import qualified Data.Text.Lazy.Encoding as TL
33
34
34−#ifdef WINDOWS
35−import Blaze.Text.Double
36−#else
37−import Data.Double.Conversion.Text
38−#endif
39−
40class ToByteString a where
35class ToByteString a where
41 builder :: a -> Builder
36 builder :: a -> Builder
42
37
@@ -47,13 +42,8 @@ instance ToByteString Text where builder x = byteString $ encodeUtf8 x
47instance ToByteString TL.Text where builder x = lazyByteString $ TL.encodeUtf8 x
42instance ToByteString TL.Text where builder x = lazyByteString $ TL.encodeUtf8 x
48instance ToByteString Char where builder x = builder $ T.singleton x
43instance ToByteString Char where builder x = builder $ T.singleton x
49instance ToByteString [Char] where builder x = builder $ TL.pack x
44instance 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
54instance ToByteString Float where builder x = builder $ toShortest $ float2Double x
45instance ToByteString Float where builder x = builder $ toShortest $ float2Double x
55instance ToByteString Double where builder x = builder $ toShortest x
46instance ToByteString Double where builder x = builder $ toShortest x
56−#endif
57
47
58instance ToByteString Int where builder x = intDec x
48instance ToByteString Int where builder x = intDec x
59instance ToByteString Int8 where builder x = int8Dec x
49instance ToByteString Int8 where builder x = int8Dec x