Skip to content

Commit a5e3e87

Browse files
committed
run ./regen.sh
1 parent 2be28d5 commit a5e3e87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2434
-2031
lines changed

contrib/containers

Submodule containers updated 64 files

contrib/vector

Submodule vector updated 80 files

strict-containers/include/containers.h

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,19 @@
1212
#include "MachDeps.h"
1313
#endif
1414

15-
/*
16-
* Define INSTANCE_TYPEABLE[0-2]
17-
*/
18-
#if __GLASGOW_HASKELL__ >= 707
19-
#define INSTANCE_TYPEABLE0(tycon) deriving instance Typeable tycon
20-
#define INSTANCE_TYPEABLE1(tycon) deriving instance Typeable tycon
21-
#define INSTANCE_TYPEABLE2(tycon) deriving instance Typeable tycon
22-
#elif defined(__GLASGOW_HASKELL__)
23-
#define INSTANCE_TYPEABLE0(tycon) deriving instance Typeable tycon
24-
#define INSTANCE_TYPEABLE1(tycon) deriving instance Typeable1 tycon
25-
#define INSTANCE_TYPEABLE2(tycon) deriving instance Typeable2 tycon
26-
#else
27-
#define INSTANCE_TYPEABLE0(tycon)
28-
#define INSTANCE_TYPEABLE1(tycon)
29-
#define INSTANCE_TYPEABLE2(tycon)
30-
#endif
31-
32-
#if __GLASGOW_HASKELL__ >= 800
15+
#ifdef __GLASGOW_HASKELL__
3316
#define DEFINE_PATTERN_SYNONYMS 1
3417
#endif
3518

3619
#ifdef __GLASGOW_HASKELL__
3720
# define USE_ST_MONAD 1
21+
#ifndef WORDS_BIGENDIAN
22+
/*
23+
* Unboxed arrays are broken on big-endian architectures.
24+
* See https://gitlab.haskell.org/ghc/ghc/-/issues/16998
25+
*/
3826
# define USE_UNBOXED_ARRAYS 1
3927
#endif
28+
#endif
4029

4130
#endif

strict-containers/include/vector.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#define PHASE_FUSED [1]
2+
#define PHASE_INNER [0]
3+
4+
#define INLINE_FUSED INLINE PHASE_FUSED
5+
#define INLINE_INNER INLINE PHASE_INNER
6+
7+
#define PHASE_STREAM Please use "PHASE_FUSED" instead
8+
#define INLINE_STREAM Please use "INLINE_FUSED" instead

strict-containers/src/Data/Strict/ContainersUtils/Autogen/BitQueue.hs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,9 @@ module Data.Strict.ContainersUtils.Autogen.BitQueue
4444
, toListQ
4545
) where
4646

47-
#if !MIN_VERSION_base(4,8,0)
48-
import Data.Word (Word)
49-
#endif
5047
import Data.Strict.ContainersUtils.Autogen.BitUtil (shiftLL, shiftRL, wordSize)
5148
import Data.Bits ((.|.), (.&.), testBit)
52-
#if MIN_VERSION_base(4,8,0)
5349
import Data.Bits (countTrailingZeros)
54-
#else
55-
import Data.Bits (popCount)
56-
#endif
57-
58-
#if !MIN_VERSION_base(4,8,0)
59-
countTrailingZeros :: Word -> Int
60-
countTrailingZeros x = popCount ((x .&. (-x)) - 1)
61-
{-# INLINE countTrailingZeros #-}
62-
#endif
6350

6451
-- A bit queue builder. We represent a double word using two words
6552
-- because we don't currently have access to proper double words.
@@ -109,7 +96,7 @@ buildQ (BQB hi lo) = BQ (BQB hi' lo') where
10996
lo' = (lo1 `shiftRL` zeros) .|. (hi1 `shiftLL` (wordSize - zeros))
11097
hi' = hi1 `shiftRL` zeros
11198

112-
-- Test if the queue is empty, which occurs when theres
99+
-- Test if the queue is empty, which occurs when there's
113100
-- nothing left but a guard bit in the least significant
114101
-- place.
115102
nullQ :: BitQueue -> Bool

strict-containers/src/Data/Strict/ContainersUtils/Autogen/BitUtil.hs

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,10 @@ module Data.Strict.ContainersUtils.Autogen.BitUtil
3838
, wordSize
3939
) where
4040

41-
#if !MIN_VERSION_base(4,8,0)
42-
import Data.Bits ((.|.), xor)
43-
#endif
4441
import Data.Bits (popCount, unsafeShiftL, unsafeShiftR
45-
#if MIN_VERSION_base(4,8,0)
46-
, countLeadingZeros
47-
#endif
42+
, countLeadingZeros, finiteBitSize
4843
)
49-
#if MIN_VERSION_base(4,7,0)
50-
import Data.Bits (finiteBitSize)
51-
#else
52-
import Data.Bits (bitSize)
53-
#endif
5444

55-
#if !MIN_VERSION_base (4,8,0)
56-
import Data.Word (Word)
57-
#endif
5845

5946
{----------------------------------------------------------------------
6047
[bitcount] as posted by David F. Place to haskell-cafe on April 11, 2006,
@@ -78,21 +65,7 @@ bitcount a x = a + popCount x
7865

7966
-- | Return a word where only the highest bit is set.
8067
highestBitMask :: Word -> Word
81-
#if MIN_VERSION_base(4,8,0)
8268
highestBitMask w = shiftLL 1 (wordSize - 1 - countLeadingZeros w)
83-
#else
84-
highestBitMask x1 = let x2 = x1 .|. x1 `shiftRL` 1
85-
x3 = x2 .|. x2 `shiftRL` 2
86-
x4 = x3 .|. x3 `shiftRL` 4
87-
x5 = x4 .|. x4 `shiftRL` 8
88-
x6 = x5 .|. x5 `shiftRL` 16
89-
#if !(defined(__GLASGOW_HASKELL__) && WORD_SIZE_IN_BITS==32)
90-
x7 = x6 .|. x6 `shiftRL` 32
91-
in x7 `xor` (x7 `shiftRL` 1)
92-
#else
93-
in x6 `xor` (x6 `shiftRL` 1)
94-
#endif
95-
#endif
9669
{-# INLINE highestBitMask #-}
9770

9871
-- Right and left logical shifts.
@@ -102,8 +75,4 @@ shiftLL = unsafeShiftL
10275

10376
{-# INLINE wordSize #-}
10477
wordSize :: Int
105-
#if MIN_VERSION_base(4,7,0)
10678
wordSize = finiteBitSize (0 :: Word)
107-
#else
108-
wordSize = bitSize (0 :: Word)
109-
#endif

strict-containers/src/Data/Strict/ContainersUtils/Autogen/Coercions.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
module Data.Strict.ContainersUtils.Autogen.Coercions where
77

8-
#if __GLASGOW_HASKELL__ >= 708
8+
#ifdef __GLASGOW_HASKELL__
99
import Data.Coerce
1010
#endif
1111

1212
infixl 8 .#
13-
#if __GLASGOW_HASKELL__ >= 708
13+
#ifdef __GLASGOW_HASKELL__
1414
(.#) :: Coercible b a => (b -> c) -> (a -> b) -> a -> c
1515
(.#) f _ = coerce f
1616
#else
@@ -34,7 +34,7 @@ infix 9 .^#
3434
-- @
3535
-- foldl f b . fmap g = foldl (f .^# g) b
3636
-- @
37-
#if __GLASGOW_HASKELL__ >= 708
37+
#ifdef __GLASGOW_HASKELL__
3838
(.^#) :: Coercible c b => (a -> c -> d) -> (b -> c) -> (a -> b -> d)
3939
(.^#) f _ = coerce f
4040
#else

strict-containers/src/Data/Strict/ContainersUtils/Autogen/PtrEquality.hs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ module Data.Strict.ContainersUtils.Autogen.PtrEquality (ptrEq, hetPtrEq) where
1111
#ifdef __GLASGOW_HASKELL__
1212
import GHC.Exts ( reallyUnsafePtrEquality# )
1313
import Unsafe.Coerce ( unsafeCoerce )
14-
#if __GLASGOW_HASKELL__ < 707
15-
import GHC.Exts ( (==#) )
16-
#else
17-
import GHC.Exts ( isTrue# )
18-
#endif
14+
import GHC.Exts ( Int#, isTrue# )
1915
#endif
2016

2117
-- | Checks if two pointers are equal. Yes means yes;
@@ -30,13 +26,8 @@ ptrEq :: a -> a -> Bool
3026
hetPtrEq :: a -> b -> Bool
3127

3228
#ifdef __GLASGOW_HASKELL__
33-
#if __GLASGOW_HASKELL__ < 707
34-
ptrEq x y = reallyUnsafePtrEquality# x y ==# 1#
35-
hetPtrEq x y = unsafeCoerce reallyUnsafePtrEquality# x y ==# 1#
36-
#else
3729
ptrEq x y = isTrue# (reallyUnsafePtrEquality# x y)
38-
hetPtrEq x y = isTrue# (unsafeCoerce reallyUnsafePtrEquality# x y)
39-
#endif
30+
hetPtrEq x y = isTrue# (unsafeCoerce (reallyUnsafePtrEquality# :: x -> x -> Int#) x y)
4031

4132
#else
4233
-- Not GHC

strict-containers/src/Data/Strict/ContainersUtils/Autogen/State.hs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55
-- | A clone of Control.Monad.State.Strict.
66
module Data.Strict.ContainersUtils.Autogen.State where
77

8-
import Prelude hiding (
9-
#if MIN_VERSION_base(4,8,0)
10-
Applicative
11-
#endif
12-
)
13-
14-
import Control.Monad (ap)
8+
import Control.Monad (ap, liftM2)
159
import Control.Applicative (Applicative(..), liftA)
1610

1711
newtype State s a = State {runState :: s -> (s, a)}
@@ -30,6 +24,11 @@ instance Applicative (State s) where
3024
{-# INLINE pure #-}
3125
pure x = State $ \ s -> (s, x)
3226
(<*>) = ap
27+
m *> n = State $ \s -> case runState m s of
28+
(s', _) -> runState n s'
29+
#if MIN_VERSION_base(4,10,0)
30+
liftA2 = liftM2
31+
#endif
3332

3433
execState :: State s a -> s -> a
3534
execState m x = snd (runState m x)

0 commit comments

Comments
 (0)