File tree Expand file tree Collapse file tree 1 file changed +2
-15
lines changed
containers/src/Utils/Containers/Internal Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change 6
6
{-# OPTIONS_HADDOCK hide #-}
7
7
8
8
-- | Really unsafe pointer equality
9
- module Utils.Containers.Internal.PtrEquality (ptrEq , hetPtrEq ) where
9
+ module Utils.Containers.Internal.PtrEquality (ptrEq ) where
10
10
11
11
#ifdef __GLASGOW_HASKELL__
12
- import GHC.Exts ( reallyUnsafePtrEquality # )
13
- import Unsafe.Coerce ( unsafeCoerce )
14
- import GHC.Exts ( Int #, isTrue # )
12
+ import GHC.Exts ( isTrue #, reallyUnsafePtrEquality # )
15
13
#endif
16
14
17
15
-- | Checks if two pointers are equal. Yes means yes;
18
16
-- no means maybe. The values should be forced to at least
19
17
-- WHNF before comparison to get moderately reliable results.
20
18
ptrEq :: a -> a -> Bool
21
19
22
- -- | Checks if two pointers are equal, without requiring
23
- -- them to have the same type. The values should be forced
24
- -- to at least WHNF before comparison to get moderately
25
- -- reliable results.
26
- hetPtrEq :: a -> b -> Bool
27
-
28
20
#ifdef __GLASGOW_HASKELL__
29
21
ptrEq x y = isTrue# (reallyUnsafePtrEquality# x y)
30
- hetPtrEq x y = isTrue# (unsafeCoerce (reallyUnsafePtrEquality# :: x -> x -> Int # ) x y)
31
-
32
22
#else
33
23
-- Not GHC
34
24
ptrEq _ _ = False
35
- hetPtrEq _ _ = False
36
25
#endif
37
26
38
27
{-# INLINE ptrEq #-}
39
- {-# INLINE hetPtrEq #-}
40
28
41
29
infix 4 `ptrEq`
42
- infix 4 `hetPtrEq`
You can’t perform that action at this time.
0 commit comments