summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T7360.hs
blob: 4da49041f8b85840eda13364a6befbf39483cb98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- Both these functions should successfully simplify
-- using the combine-identical-alternatives optimisation

module T7360 where

import GHC.List as L

data Foo = Foo1 | Foo2 | Foo3 !Int

fun1 :: Foo -> ()
{-# NOINLINE fun1 #-}
fun1 x = case x of
               Foo1 -> ()
               Foo2 -> ()
               Foo3 {} -> ()

fun2 x = (fun1 Foo1,  -- Keep -ddump-simpl output
                      -- in a predictable order
         case x of
          [] -> L.length x
          (_:_) -> L.length x)