Commit eba954f6 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Add test for Trac #1221

parent 80094627
......@@ -163,3 +163,4 @@ test('tcfail174', normal, compile_fail, [''])
test('tcfail175', normal, compile_fail, [''])
test('tcfail176', normal, compile_fail, [''])
test('tcfail177', normal, compile_fail, [''])
test('tcfail178', normal, compile_fail, [''])
-- See Trac #1221
module ShouldFail where
a :: Num a => (Bool -> [a]) -> [a]
a x = x True ++ [1]
y :: b -> ()
y = const ()
-- Typechecks ok
b = a (const [2])
-- This one had an uninformative error message
c = a y
-- More informative
d = a ()
tcfail178.hs:15:6:
Couldn't match expected type `[a]' against inferred type `()'
Expected type: Bool -> [a]
Inferred type: Bool -> ()
In the first argument of `a', namely `y'
In the expression: a y
tcfail178.hs:18:6:
Couldn't match expected type `Bool -> [a]'
against inferred type `()'
In the first argument of `a', namely `()'
In the expression: a ()
In the definition of `d': d = a ()
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