summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml55
-rw-r--r--CHANGELOG.markdown6
-rw-r--r--bytes.cabal16
-rw-r--r--src/Data/Bytes/Serial.hs9
4 files changed, 61 insertions, 25 deletions
diff --git a/.travis.yml b/.travis.yml
index 11fee8f..14231cf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
# This Travis job script has been generated by a script via
#
-# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-installed' 'cabal.project'
+# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--ghc-head' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-unconstrained' 'cabal.project'
#
# For more information, see https://github.com/hvr/multi-ghc-travis
#
@@ -36,33 +36,37 @@ before_cache:
matrix:
include:
- - compiler: "ghc-7.4.2"
+ - compiler: "ghc-8.6.1"
+ env: GHCHEAD=true
+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}}
+ - compiler: "ghc-8.4.3"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.0,ghc-7.4.2], sources: [hvr-ghc]}}
- - compiler: "ghc-7.6.3"
+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
+ - compiler: "ghc-8.2.2"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.0,ghc-7.6.3], sources: [hvr-ghc]}}
- - compiler: "ghc-7.8.4"
+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}}
+ - compiler: "ghc-8.0.2"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.0,ghc-7.8.4], sources: [hvr-ghc]}}
+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.0.2], sources: [hvr-ghc]}}
- compiler: "ghc-7.10.3"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.0,ghc-7.10.3], sources: [hvr-ghc]}}
- - compiler: "ghc-8.0.2"
+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.10.3], sources: [hvr-ghc]}}
+ - compiler: "ghc-7.8.4"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.0,ghc-8.0.2], sources: [hvr-ghc]}}
- - compiler: "ghc-8.2.2"
+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}}
+ - compiler: "ghc-7.6.3"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}
- - compiler: "ghc-8.4.1"
+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.6.3], sources: [hvr-ghc]}}
+ - compiler: "ghc-7.4.2"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.1], sources: [hvr-ghc]}}
+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.4.2], sources: [hvr-ghc]}}
- compiler: "ghc-head"
env: GHCHEAD=true
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}}
allow_failures:
- compiler: "ghc-head"
+ - compiler: "ghc-8.6.1"
before_install:
- HC=${CC}
@@ -80,7 +84,8 @@ install:
- BENCH=${BENCH---enable-benchmarks}
- TEST=${TEST---enable-tests}
- HADDOCK=${HADDOCK-true}
- - INSTALLED=${INSTALLED-true}
+ - UNCONSTRAINED=${UNCONSTRAINED-true}
+ - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
- GHCHEAD=${GHCHEAD-false}
- travis_retry cabal update -v
- "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
@@ -88,7 +93,8 @@ install:
# Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
- |
if $GHCHEAD; then
- sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config
+ sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config
+ for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" ${HOME}/.cabal/config; done
echo 'repository head.hackage' >> ${HOME}/.cabal/config
echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config
@@ -98,17 +104,22 @@ install:
echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config
echo ' key-threshold: 3' >> ${HOME}/.cabal.config
+ grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
+
cabal new-update head.hackage -v
fi
- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
- "printf 'packages: \".\"\\n' > cabal.project"
- - cat cabal.project
+ - touch cabal.project.local
+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
+ - cat cabal.project || true
+ - cat cabal.project.local || true
- if [ -f "./configure.ac" ]; then
(cd "." && autoreconf -i);
fi
- rm -f cabal.project.freeze
- cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
- - rm -rf "."/.ghc.environment.* "."/dist
+ - rm -rf .ghc.environment.* "."/dist
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# Here starts the actual work to be performed for the package under test;
@@ -120,8 +131,10 @@ script:
- cd ${DISTDIR} || false
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
- "printf 'packages: bytes-*/*.cabal\\n' > cabal.project"
- - cat cabal.project
-
+ - touch cabal.project.local
+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
+ - cat cabal.project || true
+ - cat cabal.project.local || true
# build & run tests, build benchmarks
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
@@ -134,5 +147,5 @@ script:
- rm -rf ./dist-newstyle
- if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
-# REGENDATA ["-o",".travis.yml","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-installed","cabal.project"]
+# REGENDATA ["-o",".travis.yml","--ghc-head","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-unconstrained","cabal.project"]
# EOF
diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
index aaa0ddb..673b312 100644
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -1,4 +1,8 @@
-0.15.4 [2018-04-05]
+0.15.5 [2018.07.03]
+-------------------
+* Add `Serial(1)` instances for `NonEmpty`.
+
+0.15.4 [2018.04.05]
-------------------
* Use a significantly simpler `Setup.hs` script.
diff --git a/bytes.cabal b/bytes.cabal
index c659470..38a6a85 100644
--- a/bytes.cabal
+++ b/bytes.cabal
@@ -1,6 +1,6 @@
name: bytes
category: Data, Serialization
-version: 0.15.4
+version: 0.15.5
license: BSD3
cabal-version: >= 1.8
license-file: LICENSE
@@ -11,7 +11,14 @@ homepage: https://github.com/ekmett/bytes
bug-reports: https://github.com/ekmett/bytes/issues
copyright: Copyright (C) 2013-2015 Edward A. Kmett
build-type: Custom
-tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1
+tested-with: GHC == 7.4.2
+ , GHC == 7.6.3
+ , GHC == 7.8.4
+ , GHC == 7.10.3
+ , GHC == 8.0.2
+ , GHC == 8.2.2
+ , GHC == 8.4.3
+ , GHC == 8.6.1
synopsis: Sharing code for serialization between binary and cereal
description: Sharing code for serialization between binary and cereal.
@@ -66,6 +73,9 @@ library
if impl(ghc >= 7.4 && < 7.6)
build-depends: ghc-prim
+ if impl(ghc < 8.0)
+ build-depends: semigroups >= 0.5 && < 1
+
exposed-modules:
Data.Bytes.Get
Data.Bytes.Put
@@ -90,5 +100,5 @@ test-suite doctests
base,
bytes,
directory >= 1.0,
- doctest >= 0.11.1 && <0.16,
+ doctest >= 0.11.1 && <0.17,
filepath >= 1.2
diff --git a/src/Data/Bytes/Serial.hs b/src/Data/Bytes/Serial.hs
index fb521d7..a669f15 100644
--- a/src/Data/Bytes/Serial.hs
+++ b/src/Data/Bytes/Serial.hs
@@ -68,6 +68,7 @@ import Data.Functor.Reverse as Functor
import Data.Hashable (Hashable)
import qualified Data.HashMap.Lazy as HMap
import qualified Data.HashSet as HSet
+import qualified Data.List.NonEmpty as NEL
import Data.Time
import Data.Time.Clock.TAI
import qualified Data.IntMap as IMap
@@ -346,6 +347,10 @@ instance Serial a => Serial (Seq.Seq a) where
serialize = serializeWith serialize
deserialize = deserializeWith deserialize
+instance Serial a => Serial (NEL.NonEmpty a) where
+ serialize = serializeWith serialize
+ deserialize = deserializeWith deserialize
+
instance (Serial a, Ord a) => Serial (Set.Set a) where
serialize = serialize . Set.toAscList
deserialize = Set.fromList `liftM` deserialize
@@ -705,6 +710,10 @@ instance Serial1 Seq.Seq where
serializeWith pv = serializeWith pv . F.toList
deserializeWith gv = Seq.fromList `liftM` deserializeWith gv
+instance Serial1 NEL.NonEmpty where
+ serializeWith pv = serializeWith pv . F.toList
+ deserializeWith gv = NEL.fromList `liftM` deserializeWith gv
+
{-
instance Serial1 Set.Set where
serializeWith pv = serializeWith pv . Set.toAscList