Skip to content
Merged
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
7 changes: 0 additions & 7 deletions cbits/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
#include <string.h>
#include <sys/types.h>

/* Changed name to disambiguate from _hs_text_memcmp,
which could be present in system-wide headers from installed ghc package */
int _hs_text_memcmp2(const void *arr1, size_t off1, const void *arr2, size_t off2, size_t len)
{
return memcmp(arr1 + off1, arr2 + off2, len);
}

ssize_t _hs_text_memchr(const void *arr, size_t off, size_t len, uint8_t byte)
{
const void *ptr = memchr(arr + off, byte, len);
Expand Down
14 changes: 2 additions & 12 deletions src/Data/Text/Array.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UnliftedFFITypes #-}

{-# OPTIONS_GHC -fno-warn-unused-matches #-}
{- HLINT ignore "Redundant guard" -}

-- |
-- Module : Data.Text.Array
-- Copyright : (c) 2009, 2010, 2011 Bryan O'Sullivan
Expand Down Expand Up @@ -61,9 +61,6 @@ module Data.Text.Array
#if defined(ASSERTS)
import GHC.Stack (HasCallStack)
#endif
#if !MIN_VERSION_base(4,11,0)
import Foreign.C.Types (CInt(..))
#endif
import GHC.Exts hiding (toList)
import GHC.ST (ST(..), runST)
import GHC.Word (Word8(..))
Expand Down Expand Up @@ -350,12 +347,5 @@ compareInternal
-> Int
compareInternal (ByteArray src1#) (I# off1#) (ByteArray src2#) (I# off2#) (I# count#) = i
where
#if MIN_VERSION_base(4,11,0)
i = I# (compareByteArrays# src1# off1# src2# off2# count#)
#else
i = fromIntegral (memcmp src1# off1# src2# off2# count#)

foreign import ccall unsafe "_hs_text_memcmp2" memcmp
:: ByteArray# -> Int# -> ByteArray# -> Int# -> Int# -> CInt
#endif
{-# INLINE compareInternal #-}
3 changes: 0 additions & 3 deletions src/Data/Text/Internal/Builder.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ module Data.Text.Internal.Builder

import Control.Monad.ST (ST, runST)
import Data.Monoid (Monoid(..))
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup (Semigroup(..))
#endif
import Data.Text.Internal (Text(..), safe)
import Data.Text.Internal.Lazy (smallChunkSize)
import Data.Text.Unsafe (inlineInterleaveST)
Expand Down
12 changes: 1 addition & 11 deletions src/Data/Text/Internal/Builder/Functions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,10 @@ module Data.Text.Internal.Builder.Functions
, i2d
) where

import Data.Monoid (mappend)
import Data.Text.Lazy.Builder (Builder)
import GHC.Base (chr#,ord#,(+#),Int(I#),Char(C#))
import Prelude ()
import Prelude ((<>))

-- | Unsafe conversion for decimal digits.
{-# INLINE i2d #-}
i2d :: Int -> Char
i2d (I# i#) = C# (chr# (ord# '0'# +# i#))

-- | The normal 'mappend' function with right associativity instead of
-- left.
(<>) :: Builder -> Builder -> Builder
(<>) = mappend
{-# INLINE (<>) #-}

infixr 4 <>
3 changes: 0 additions & 3 deletions src/Data/Text/Internal/Encoding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ import Control.Exception (assert)
#endif
import Data.Bits ((.&.), shiftL, shiftR)
import Data.ByteString (ByteString)
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup (Semigroup(..))
#endif
import Data.Word (Word32, Word8)
import Foreign.Storable (pokeElemOff)
import Data.Text.Encoding.Error (OnDecodeError)
Expand Down
4 changes: 0 additions & 4 deletions src/Data/Text/Internal/StrictBuilder.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeSynonymInstances #-}
Expand Down Expand Up @@ -32,9 +31,6 @@ import Control.Monad.ST.Unsafe (unsafeIOToST, unsafeSTToIO)
import Data.Functor (void)
import Data.Word (Word8)
import Data.ByteString (ByteString)
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup (Semigroup(..))
#endif
import Data.Text.Internal (Text(..), empty, safe)
import Data.Text.Internal.ByteStringCompat (withBS)
import Data.Text.Internal.Encoding.Utf8 (utf8Length)
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Text/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ import GHC.Stack (HasCallStack)
import qualified Language.Haskell.TH.Lift as TH
#else
import qualified Language.Haskell.TH.Syntax as TH
#if __GLASGOW_HASKELL__ < 900
import qualified Language.Haskell.TH.Lib as TH
#endif
#endif
import Text.Printf (PrintfArg, formatArg, formatString)

-- $fusion
Expand Down
8 changes: 2 additions & 6 deletions src/Data/Text/Lazy/Builder/Int.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE BangPatterns, CPP, MagicHash, RankNTypes, ScopedTypeVariables,
UnboxedTuples #-}
{-# LANGUAGE BangPatterns, RankNTypes, ScopedTypeVariables #-}
{-# LANGUAGE Trustworthy #-}

-- Module: Data.Text.Lazy.Builder.Int
Expand All @@ -20,16 +19,13 @@ module Data.Text.Lazy.Builder.Int
import Data.Int (Int8, Int16, Int32, Int64)
import Data.Monoid (mempty)
import qualified Data.ByteString.Unsafe as B
import Data.Text.Internal.Builder.Functions ((<>), i2d)
import Data.Text.Internal.Builder.Functions (i2d)
import Data.Text.Internal.Builder
import Data.Text.Internal.Builder.Int.Digits (digits)
import Data.Text.Array
import Data.Word (Word, Word8, Word16, Word32, Word64)
import GHC.Base (quotInt, remInt)
import Control.Monad.ST
#if MIN_VERSION_base(4,11,0)
import Prelude hiding ((<>))
#endif

decimal :: Integral a => a -> Builder
{-# RULES "decimal/Int8" decimal = boundedDecimal :: Int8 -> Builder #-}
Expand Down
8 changes: 3 additions & 5 deletions src/Data/Text/Lazy/Builder/RealFloat.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{-# LANGUAGE CPP, OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Trustworthy #-}

{-# OPTIONS_GHC -Wno-unrecognised-warning-flags #-}
{-# OPTIONS_GHC -Wno-x-partial #-}
{- HLINT ignore "Use guards" -}

-- |
-- Module: Data.Text.Lazy.Builder.RealFloat
Expand All @@ -20,14 +21,11 @@ module Data.Text.Lazy.Builder.RealFloat

import Data.Array.Base (unsafeAt)
import Data.Array.IArray
import Data.Text.Internal.Builder.Functions ((<>), i2d)
import Data.Text.Internal.Builder.Functions (i2d)
import Data.Text.Lazy.Builder.Int (decimal)
import Data.Text.Internal.Builder.RealFloat.Functions (roundTo)
import Data.Text.Lazy.Builder
import qualified Data.Text as T
#if MIN_VERSION_base(4,11,0)
import Prelude hiding ((<>))
#endif

-- | Control the rendering of floating point numbers.
data FPFormat = Exponent
Expand Down
5 changes: 1 addition & 4 deletions tests/Tests/Properties/Transcoding.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- | Tests for encoding and decoding

{-# LANGUAGE CPP, OverloadedStrings, ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}
{-# OPTIONS_GHC -Wno-unrecognised-warning-flags #-}
{-# OPTIONS_GHC -Wno-x-partial #-}
Expand All @@ -14,9 +14,6 @@ import Data.Bits ((.&.), shiftR)
import Data.Char (chr, ord)
import Data.Functor (void)
import Data.Maybe (isNothing)
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup ((<>))
#endif
import Data.Word (Word8)
import Test.QuickCheck hiding ((.&.))
import Test.Tasty (TestTree, testGroup)
Expand Down
Loading