summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_run/cgrun054.hs
blob: dd4d7c8e17be5b50a47e41584e2bceec99971ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Main where

data Y = X1 | X2 | X3 | X4 | X5 | X6 | X7 | X8
        deriving( Show )

data X = WithY Y
         | A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8

foo :: X -> Y
foo A1 = X1
foo A2 = X2
foo A3 = X3
foo A4 = X4
foo A5 = X5
foo A6 = X6
foo A7 = X7
foo A8 = X8
foo (WithY _) = X1

bar :: X -> Y
bar (WithY x) = x
bar y = foobar (foo y)  -- The WithY case can't occur, and in an
                        -- earlier version that confused the code generator

{-# NOINLINE foobar #-}
foobar x = x


main = print (map bar [WithY X2, A4, A5])