Commit eebf8d87 authored by Simon Marlow's avatar Simon Marlow
Browse files

Add test for T6084

parent 52b96a7c
{-# LANGUAGE MagicHash, BangPatterns #-}
module Main where
import GHC.Exts
{-# NOINLINE f #-}
f :: (Int# -> Float# -> Double# -> String) -> String
f g = g 3# 4.0# 6.9## ++ " World!"
{-# NOINLINE p #-}
p :: Int# -> Float# -> Double# -> String
p i j k = "Hello"
{-# NOINLINE q #-}
q :: Int# -> Int# -> Float# -> Double# -> String
q _ i j k = "Hello"
{-# NOINLINE r #-}
r :: Int# -> Float# -> Double# -> String
r i = let !(I# z) = length [I# 1# .. I# i] in \j k -> p z j k
-- ghc won't eta-expand around the length, because it has unknown cost
main = do
putStrLn (f p) -- fast call
putStrLn (f r) -- slow call: function but wrong arity
let g = last [q 1#]
putStrLn (f g) -- slow call: thunk
Hello World!
Hello World!
Hello World!
......@@ -115,3 +115,4 @@ test('T7600', normal, compile_and_run, [''])
test('T8103', only_ways(['normal']), compile_and_run, [''])
test('T7953', reqlib('random'), compile_and_run, [''])
test('T8256',normal, compile_and_run, [''])
test('T6084',normal, compile_and_run, ['-O2'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment