summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/spec002.hs
blob: 915f32960f05011fe1c864531ef48dc4bdf2a65a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# OPTIONS_GHC -O2 #-}

-- Ths one fooled the rule-matching in GHC.Core.Opt.SpecConstr, and gave a CoreLint error

module Foo where

type Token = (Int, Int, Lex, String)

data Lex = Llbrace

laLayout :: Int -> [Int] -> [Token] -> [Token]

laLayout l (s:ss) (t1@(l1, n1, w1, c1) :
                   t2@(l2, n2, w2, c2) : ts)
   | n1 < s    = laLayout l2 (n2:s:ss) ts
   | n1 == s   = []   -- Otherwise laLayout is bottom!
   | otherwise = laLayout l ss (t1:t2:ts)