Skip to content

Commit a0396fa

Browse files
committed
SMP support
1 parent abc3862 commit a0396fa

File tree

6 files changed

+30
-13
lines changed

6 files changed

+30
-13
lines changed

Data/Text/Buildable.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ module Data.Text.Buildable
2020
import Data.Void (Void, absurd)
2121
#endif
2222

23+
import Data.Semigroup ((<>))
2324
import Data.Monoid (mempty)
2425
import Data.Int (Int8, Int16, Int32, Int64)
2526
import Data.Fixed (Fixed, HasResolution, showFixed)
2627
import Data.Ratio (Ratio, denominator, numerator)
27-
import Data.Text.Format.Functions ((<>))
2828
import Data.Text.Format.Int (decimal, hexadecimal)
2929
import Data.Text.Format.Types (Hex(..), Shown(..))
3030
import Data.Text.Lazy.Builder

Data/Text/Format.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ module Data.Text.Format
3535
, shortest
3636
) where
3737

38+
import Data.Semigroup ((<>))
3839
import Control.Monad.IO.Class (MonadIO(liftIO))
39-
import Data.Text.Format.Functions ((<>))
4040
import Data.Text.Format.Params (Params(..))
4141
import Data.Text.Format.Types.Internal (Format(..), Only(..), Shown(..))
4242
import Data.Text.Format.Types.Internal (Hex(..))

Data/Text/Format/Functions.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE MagicHash #-}
23

34
-- |
@@ -13,7 +14,7 @@
1314

1415
module Data.Text.Format.Functions
1516
(
16-
(<>)
17+
(Data.Text.Format.Functions.<>)
1718
, i2d
1819
) where
1920

@@ -30,6 +31,7 @@ i2d (I# i#) = C# (chr# (ord# '0'# +# i#))
3031
-- left.
3132
(<>) :: Builder -> Builder -> Builder
3233
(<>) = mappend
34+
{-# DEPRECATED (<>) "Use <> from Data.Semigroup" #-}
3335
{-# INLINE (<>) #-}
3436

3537
infixr 4 <>

Data/Text/Format/Int.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ module Data.Text.Format.Int
1818

1919
import Data.Int (Int8, Int16, Int32, Int64)
2020
import Data.Monoid (mempty)
21-
import Data.Text.Format.Functions ((<>), i2d)
21+
import Data.Semigroup ((<>))
22+
import Data.Text.Format.Functions (i2d)
2223
import Data.Text.Lazy.Builder
2324
import Data.Word (Word, Word8, Word16, Word32, Word64)
2425
import GHC.Base (quotInt, remInt)

Data/Text/Format/Types/Internal.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module Data.Text.Format.Types.Internal
2020
, Hex(..)
2121
) where
2222

23+
import Data.Semigroup (Semigroup (..))
2324
import Data.Monoid (Monoid(..))
2425
import Data.String (IsString(..))
2526
import Data.Text (Text)
@@ -46,9 +47,12 @@ import Data.Typeable (Typeable)
4647
newtype Format = Format { fromFormat :: Text }
4748
deriving (Eq, Ord, Typeable, Show)
4849

50+
instance Semigroup Format where
51+
Format a <> Format b = Format (a `mappend` b)
52+
4953
instance Monoid Format where
50-
Format a `mappend` Format b = Format (a `mappend` b)
5154
mempty = Format mempty
55+
mappend = (<>)
5256

5357
instance IsString Format where
5458
fromString = Format . fromString

text-format.cabal

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: text-format
2-
version: 0.3.1.1
2+
version: 0.3.2
33
license: BSD3
44
license-file: LICENSE
55
homepage: https://github.com/bos/text-format
@@ -8,14 +8,25 @@ category: Text
88
author: Bryan O'Sullivan <[email protected]>
99
maintainer: Bryan O'Sullivan <[email protected]>
1010
stability: experimental
11-
tested-with: GHC == 7.0.3
1211
synopsis: Text formatting
1312
cabal-version: >= 1.8
1413
build-type: Simple
1514
description:
1615
A text formatting library optimized for both ease of use and high
1716
performance.
1817

18+
tested-with:
19+
GHC == 7.0.4
20+
|| == 7.2.2
21+
|| == 7.4.2
22+
|| == 7.6.3
23+
|| == 7.8.4
24+
|| == 7.10.3
25+
|| == 8.0.2
26+
|| == 8.2.2
27+
|| == 8.4.3
28+
|| == 8.6.1
29+
1930
extra-source-files:
2031
README.markdown
2132
benchmarks/Makefile
@@ -41,7 +52,8 @@ library
4152

4253
build-depends:
4354
array,
44-
base == 4.*,
55+
base >=4.3 && <4.12,
56+
integer-gmp >= 0.2,
4557
double-conversion >= 0.2.0.0,
4658
ghc-prim,
4759
old-locale,
@@ -57,11 +69,9 @@ library
5769

5870
cpp-options: -DINTEGER_GMP
5971

60-
if impl(ghc >= 6.11)
61-
build-depends: integer-gmp >= 0.2
62-
63-
if impl(ghc >= 6.9) && impl(ghc < 6.11)
64-
build-depends: integer >= 0.1 && < 0.2
72+
if !impl(ghc >= 8.0)
73+
build-depends:
74+
semigroups >= 0.18.5 && < 0.19
6575

6676
source-repository head
6777
type: git

0 commit comments

Comments
 (0)