summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T2497.hs
blob: 55c390dbedac8618e2a8656a817d2c498cc5f66b (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
{-# OPTIONS_GHC -fwarn-unused-binds #-}

module ShouldCompile() where

foo x = x
{-# NOINLINE [1] foo #-}

-- Trac #2497; test should compile without language
--             pragmas to switch on the forall
{-# RULES "id" forall (x :: a). foo x = x #-}



-- Trac #2213; eq should not be reported as unused

eq,beq :: Eq a => a -> a -> Bool
{-# NOINLINE [0] eq #-}
-- The pragma and [~1] in the RULE are to prevent an infinite loop
-- in the simplifier, where the RULE fires infinitely in its
-- own RHS
eq = (==)    -- Used
beq = (==)   -- Unused

{-# RULES
    "rule 1" [~1] forall x y. x == y = y `eq` x
  #-}