summaryrefslogtreecommitdiff
path: root/standalone/android/haskell-patches/primitive_fix-build-with-new-ghc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'standalone/android/haskell-patches/primitive_fix-build-with-new-ghc.patch')
-rw-r--r--standalone/android/haskell-patches/primitive_fix-build-with-new-ghc.patch96
1 files changed, 96 insertions, 0 deletions
diff --git a/standalone/android/haskell-patches/primitive_fix-build-with-new-ghc.patch b/standalone/android/haskell-patches/primitive_fix-build-with-new-ghc.patch
new file mode 100644
index 000000000..3f12965c1
--- /dev/null
+++ b/standalone/android/haskell-patches/primitive_fix-build-with-new-ghc.patch
@@ -0,0 +1,96 @@
+From 2b1ee45058b0d6db90f77e4859d01d1e8434906c Mon Sep 17 00:00:00 2001
+From: foo <foo@bar>
+Date: Sat, 21 Sep 2013 23:11:51 +0000
+Subject: [PATCH] fix build with new ghc
+
+---
+ Data/Primitive/Array.hs | 2 +-
+ Data/Primitive/ByteArray.hs | 2 +-
+ Data/Primitive/MutVar.hs | 4 ++--
+ Data/Primitive/Types.hs | 13 +++++++------
+ 4 files changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/Data/Primitive/Array.hs b/Data/Primitive/Array.hs
+index b82dcac..b28abea 100644
+--- a/Data/Primitive/Array.hs
++++ b/Data/Primitive/Array.hs
+@@ -106,7 +106,7 @@ unsafeThawArray (Array arr#)
+ sameMutableArray :: MutableArray s a -> MutableArray s a -> Bool
+ {-# INLINE sameMutableArray #-}
+ sameMutableArray (MutableArray arr#) (MutableArray brr#)
+- = sameMutableArray# arr# brr#
++ = tagToEnum# (sameMutableArray# arr# brr#)
+
+ -- | Copy a slice of an immutable array to a mutable array.
+ copyArray :: PrimMonad m
+diff --git a/Data/Primitive/ByteArray.hs b/Data/Primitive/ByteArray.hs
+index 2a47254..3a1ed6e 100644
+--- a/Data/Primitive/ByteArray.hs
++++ b/Data/Primitive/ByteArray.hs
+@@ -99,7 +99,7 @@ mutableByteArrayContents (MutableByteArray arr#)
+ sameMutableByteArray :: MutableByteArray s -> MutableByteArray s -> Bool
+ {-# INLINE sameMutableByteArray #-}
+ sameMutableByteArray (MutableByteArray arr#) (MutableByteArray brr#)
+- = sameMutableByteArray# arr# brr#
++ = tagToEnum# (sameMutableByteArray# arr# brr#)
+
+ -- | Convert a mutable byte array to an immutable one without copying. The
+ -- array should not be modified after the conversion.
+diff --git a/Data/Primitive/MutVar.hs b/Data/Primitive/MutVar.hs
+index 9745ec7..eb654c9 100644
+--- a/Data/Primitive/MutVar.hs
++++ b/Data/Primitive/MutVar.hs
+@@ -23,7 +23,7 @@ module Data.Primitive.MutVar (
+ ) where
+
+ import Control.Monad.Primitive ( PrimMonad(..), primitive_ )
+-import GHC.Prim ( MutVar#, sameMutVar#, newMutVar#,
++import GHC.Prim ( MutVar#, sameMutVar#, newMutVar#, tagToEnum#,
+ readMutVar#, writeMutVar#, atomicModifyMutVar# )
+ import Data.Typeable ( Typeable )
+
+@@ -33,7 +33,7 @@ data MutVar s a = MutVar (MutVar# s a)
+ deriving ( Typeable )
+
+ instance Eq (MutVar s a) where
+- MutVar mva# == MutVar mvb# = sameMutVar# mva# mvb#
++ MutVar mva# == MutVar mvb# = tagToEnum# (sameMutVar# mva# mvb#)
+
+ -- | Create a new 'MutVar' with the specified initial value
+ newMutVar :: PrimMonad m => a -> m (MutVar (PrimState m) a)
+diff --git a/Data/Primitive/Types.hs b/Data/Primitive/Types.hs
+index 7568f0c..d961e97 100644
+--- a/Data/Primitive/Types.hs
++++ b/Data/Primitive/Types.hs
+@@ -20,6 +20,7 @@ module Data.Primitive.Types (
+ import Control.Monad.Primitive
+ import Data.Primitive.MachDeps
+ import Data.Primitive.Internal.Operations
++import GHC.Prim (tagToEnum#)
+
+ import GHC.Base (
+ unsafeCoerce#,
+@@ -48,14 +49,14 @@ import Data.Primitive.Internal.Compat ( mkNoRepType )
+ data Addr = Addr Addr# deriving ( Typeable )
+
+ instance Eq Addr where
+- Addr a# == Addr b# = eqAddr# a# b#
+- Addr a# /= Addr b# = neAddr# a# b#
++ Addr a# == Addr b# = tagToEnum# (eqAddr# a# b#)
++ Addr a# /= Addr b# = tagToEnum# (neAddr# a# b#)
+
+ instance Ord Addr where
+- Addr a# > Addr b# = gtAddr# a# b#
+- Addr a# >= Addr b# = geAddr# a# b#
+- Addr a# < Addr b# = ltAddr# a# b#
+- Addr a# <= Addr b# = leAddr# a# b#
++ Addr a# > Addr b# = tagToEnum# (gtAddr# a# b#)
++ Addr a# >= Addr b# = tagToEnum# (geAddr# a# b#)
++ Addr a# < Addr b# = tagToEnum# (ltAddr# a# b#)
++ Addr a# <= Addr b# = tagToEnum# (leAddr# a# b#)
+
+ instance Data Addr where
+ toConstr _ = error "toConstr"
+--
+1.7.10.4
+