Skip to content
Snippets Groups Projects
Commit 97b47d27 authored by Joachim Breitner's avatar Joachim Breitner
Browse files

Add test case for #7611

basically using the machinery from the test case of #2110.
parent a72d798c
No related branches found
No related tags found
No related merge requests found
{-# LANGUAGE MagicHash #-}
import GHC.Exts
newtype Age = Age Int
myMap f [] = []
myMap f (x:xs) = f x : myMap f xs
{-# RULES "map id2" myMap (\x -> x) = id #-}
mapId = myMap id
mapIdApp x = myMap id x
mapLamId = myMap (\x -> x)
mapLamIdApp x = myMap (\x -> x) x
same :: a -> a -> IO ()
same x y = case reallyUnsafePtrEquality# x y of
1# -> putStrLn "yes"
_ -> putStrLn "no"
main = do
let l = [1,2,3]
same (mapId l) l
same (mapIdApp l) l
same (mapLamId l) l
same (mapLamIdApp l) l
yes
yes
yes
yes
......@@ -72,3 +72,4 @@ test('T9390', normal, compile_and_run, [''])
test('T10830', extra_run_opts('+RTS -K100k -RTS'), compile_and_run, [''])
test('T11172', normal, compile_and_run, [''])
test('T11731', normal, compile_and_run, ['-fspec-constr'])
test('T7611', normal, compile_and_run, [''])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment