Commit 02a381cc authored by Simon Peyton Jones's avatar Simon Peyton Jones

Test for RULES type-matching

parent 6d82c8e5
......@@ -16,3 +16,4 @@ test('simplrun004', normal, compile_and_run, [''])
test('simplrun005', normal, compile_and_run, [''])
test('simplrun006', expect_broken(149), compile_and_run, [''])
test('simplrun007', normal, compile_and_run, [''])
test('simplrun008', normal, compile_and_run, [''])
{-# OPTIONS -fglasgow-exts -O #-}
module Main where
import Data.Char
{-# NOINLINE f #-}
f :: Int -> String
f x = "NOT FIRED"
{-# NOINLINE neg #-}
neg :: Int -> Int
neg = negate
{-# RULES
"f" forall (c::Char->Int) (x::Char). f (c x) = "RULE FIRED"
#-}
main = do { print (f (ord 'a')) -- Rule should fire
; print (f (neg 1)) } -- Rule should not fire
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment