summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T21261_pedantic.hs
blob: b63d90558b0242d9d30d0cfe13c00aaf4cc91611 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# OPTIONS_GHC -fpedantic-bottoms #-} -- This flag must inhibit eta reduction based on demands

module T21261_pedantic where

-- README: See T21261. These examples absolutely should not eta reduce with
-- -fpedantic-bottoms.

f1 :: (Int -> Int -> Int) -> Int
f1 c = c 1 `seq` c 2 3
{-# NOINLINE f1 #-}
no2 :: (Int -> Int -> Int) -> Int
no2 c = f1 (\x y -> c x y)

f2 :: (Int -> Int -> Int) -> Maybe Int
f2 c = Just (c 1 `seq` c 3 4)
{-# NOINLINE f2 #-}
no2_lazy :: (Int -> Int -> Int) -> Maybe Int
no2_lazy c = f2 (\x y -> c x y)