summaryrefslogtreecommitdiff
path: root/testsuite/tests/stranal/should_compile/T19766.hs
blob: 1062c57cc1c585f845dd0ab777430860e4fe555b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# OPTIONS_GHC -O #-}

module T19766 where

data T a b = T !a !b

data HasT = A (T Int Int) | B (T Int Int)

getT :: HasT -> T Int Int
getT (A t) = t
getT (B t) = t

f :: HasT -> [Int]
f ht = case getT ht of t@(T _ _) -> reverse $ reverse $ reverse $ reverse $ reverse $ reverse $ lookupGRE t 15 [1,2,3,4]
{-# NOINLINE f #-}

lookupGRE :: T Int a -> Int -> [Int] -> [Int]
lookupGRE ~(T n _) !k xs = [ x | x <- xs, x+k == n ]
{-# NOINLINE lookupGRE #-}