Skip to content

SMP support #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ dist
cabal.sandbox.config
.cabal-sandbox
.stack-work
dist-newstyle
.ghc.environment.*
163 changes: 142 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,150 @@
# This Travis job script has been generated by a script via
#
# runghc make_travis_yml_2.hs '--output' '.travis.yml' 'text-format.cabal'
#
# For more information, see https://github.com/hvr/multi-ghc-travis
#
language: c
sudo: false

env:
- CABALVER=1.18 GHCVER=7.8.4
- CABALVER=1.22 GHCVER=7.10.1
git:
submodules: false # whether to recursively clone submodules

cache:
directories:
- $HOME/.cabal/packages
- $HOME/.cabal/store

before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
# remove files that are regenerated by 'cabal update'
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx

- rm -rfv $HOME/.cabal/packages/head.hackage

matrix:
include:
- 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.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.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.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.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.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.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-7.4.2], sources: [hvr-ghc]}}
- compiler: "ghc-7.2.2"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.2.2], sources: [hvr-ghc]}}
- compiler: "ghc-7.0.4"
# env: TEST=--disable-tests BENCH=--disable-benchmarks
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.0.4], sources: [hvr-ghc]}}

allow_failures:
- compiler: "ghc-8.6.1"

before_install:
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
- travis_retry cabal update
- HC=${CC}
- HCPKG=${HC/ghc/ghc-pkg}
- unset CC
- ROOTDIR=$(pwd)
- mkdir -p $HOME/.local/bin
- "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
- HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
- echo $HCNUMVER

install:
- cabal --version
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- cabal install --only-dependencies --enable-tests
- cabal --version
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
- BENCH=${BENCH---enable-benchmarks}
- TEST=${TEST---enable-tests}
- HADDOCK=${HADDOCK-true}
- UNCONSTRAINED=${UNCONSTRAINED-true}
- NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
- GHCHEAD=${GHCHEAD-false}
- travis_retry cabal update -v
- "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
- rm -fv cabal.project cabal.project.local
# Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
- |
if $GHCHEAD; then
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
echo ' secure: True' >> ${HOME}/.cabal/config
echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config
echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config
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"
- touch cabal.project.local
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- text-format | 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
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
- 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;
# any command which exits with a non-zero exit code causes the build to fail.
script:
- cabal configure --enable-tests -v2
- cabal build
- cabal test

addons:
apt:
sources:
- hvr-ghc
packages:
- ghc-7.8.4
- ghc-7.10.1
- cabal-install-1.18
- cabal-install-1.22
# test that source-distributions can be generated
- (cd "." && cabal sdist)
- mv "."/dist/text-format-*.tar.gz ${DISTDIR}/
- cd ${DISTDIR} || false
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
- "printf 'packages: text-format-*/*.cabal\\n' > cabal.project"
- touch cabal.project.local
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- text-format | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
- cat cabal.project || true
- cat cabal.project.local || true
# this builds all libraries and executables (without tests/benchmarks)
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all

# build & run tests, build benchmarks
- cabal new-build -w ${HC} ${TEST} ${BENCH} all

# cabal check
- (cd text-format-* && cabal check)

# haddock
- rm -rf ./dist-newstyle
- if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi

# Build without installed constraints for packages in global-db
- if $UNCONSTRAINED; then rm -f cabal.project.local; echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi

# REGENDATA ["--output",".travis.yml","text-format.cabal"]
# EOF
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# O.3.2 [Non-maintainer upload]

- Semigroup-Monoid compatibility (GHC-8.4)
2 changes: 1 addition & 1 deletion Data/Text/Buildable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ module Data.Text.Buildable
import Data.Void (Void, absurd)
#endif

import Data.Semigroup ((<>))
import Data.Monoid (mempty)
import Data.Int (Int8, Int16, Int32, Int64)
import Data.Fixed (Fixed, HasResolution, showFixed)
import Data.Ratio (Ratio, denominator, numerator)
import Data.Text.Format.Functions ((<>))
import Data.Text.Format.Int (decimal, hexadecimal)
import Data.Text.Format.Types (Hex(..), Shown(..))
import Data.Text.Lazy.Builder
Expand Down
2 changes: 1 addition & 1 deletion Data/Text/Format.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ module Data.Text.Format
, shortest
) where

import Data.Semigroup ((<>))
import Control.Monad.IO.Class (MonadIO(liftIO))
import Data.Text.Format.Functions ((<>))
import Data.Text.Format.Params (Params(..))
import Data.Text.Format.Types.Internal (Format(..), Only(..), Shown(..))
import Data.Text.Format.Types.Internal (Hex(..))
Expand Down
3 changes: 2 additions & 1 deletion Data/Text/Format/Functions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

module Data.Text.Format.Functions
(
(<>)
(Data.Text.Format.Functions.<>)
, i2d
) where

Expand All @@ -30,6 +30,7 @@ i2d (I# i#) = C# (chr# (ord# '0'# +# i#))
-- left.
(<>) :: Builder -> Builder -> Builder
(<>) = mappend
{-# DEPRECATED (<>) "Use <> from Data.Semigroup" #-}
{-# INLINE (<>) #-}

infixr 4 <>
3 changes: 2 additions & 1 deletion Data/Text/Format/Int.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ module Data.Text.Format.Int

import Data.Int (Int8, Int16, Int32, Int64)
import Data.Monoid (mempty)
import Data.Text.Format.Functions ((<>), i2d)
import Data.Semigroup ((<>))
import Data.Text.Format.Functions (i2d)
import Data.Text.Lazy.Builder
import Data.Word (Word, Word8, Word16, Word32, Word64)
import GHC.Base (quotInt, remInt)
Expand Down
6 changes: 5 additions & 1 deletion Data/Text/Format/Types/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Data.Text.Format.Types.Internal
, Hex(..)
) where

import Data.Semigroup (Semigroup (..))
import Data.Monoid (Monoid(..))
import Data.String (IsString(..))
import Data.Text (Text)
Expand All @@ -46,9 +47,12 @@ import Data.Typeable (Typeable)
newtype Format = Format { fromFormat :: Text }
deriving (Eq, Ord, Typeable, Show)

instance Semigroup Format where
Format a <> Format b = Format (a `mappend` b)

instance Monoid Format where
Format a `mappend` Format b = Format (a `mappend` b)
mempty = Format mempty
mappend = (<>)

instance IsString Format where
fromString = Format . fromString
Expand Down
27 changes: 19 additions & 8 deletions text-format.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: text-format
version: 0.3.1.1
version: 0.3.2
license: BSD3
license-file: LICENSE
homepage: https://github.com/bos/text-format
Expand All @@ -8,16 +8,28 @@ category: Text
author: Bryan O'Sullivan <[email protected]>
maintainer: Bryan O'Sullivan <[email protected]>
stability: experimental
tested-with: GHC == 7.0.3
synopsis: Text formatting
cabal-version: >= 1.8
build-type: Simple
description:
A text formatting library optimized for both ease of use and high
performance.

tested-with:
GHC == 7.0.4
|| == 7.2.2
|| == 7.4.2
|| == 7.6.3
|| == 7.8.4
|| == 7.10.3
|| == 8.0.2
|| == 8.2.2
|| == 8.4.3
|| == 8.6.1

extra-source-files:
README.markdown
CHANGELOG.md
benchmarks/Makefile
benchmarks/*.c
benchmarks/*.hs
Expand All @@ -41,7 +53,8 @@ library

build-depends:
array,
base == 4.*,
base >=4.3 && <4.12,
integer-gmp >= 0.2,
double-conversion >= 0.2.0.0,
ghc-prim,
old-locale,
Expand All @@ -57,11 +70,9 @@ library

cpp-options: -DINTEGER_GMP

if impl(ghc >= 6.11)
build-depends: integer-gmp >= 0.2

if impl(ghc >= 6.9) && impl(ghc < 6.11)
build-depends: integer >= 0.1 && < 0.2
if !impl(ghc >= 8.0)
build-depends:
semigroups >= 0.18.5 && < 0.19

source-repository head
type: git
Expand Down