Commit 35dc8da5 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Two more tests

parent 7595ff96
......@@ -146,3 +146,5 @@ test('tcfail158', normal, compile_fail, [''])
test('tcfail159', normal, compile_fail, [''])
test('tcfail160', normal, compile_fail, [''])
test('tcfail161', normal, compile_fail, [''])
test('tcfail162', normal, compile_fail, [''])
test('tcfail163', normal, compile_fail, [''])
{-# OPTIONS -fffi -fglasgow-exts #-}
-- Kind error messsage should not contain bangs
module ShouldFail where
import Foreign.ForeignPtr
data Foo = Foo {-# UNPACK #-} !(ForeignPtr)
tcfail162.hs:9:15:
`ForeignPtr' is not applied to enough type arguments
Expected kind `?', but `ForeignPtr' has kind `* -> *'
In the data type declaration for `Foo'
{-# OPTIONS -fglasgow-exts -fgenerics #-}
-- Derivable type class with a higher-rank method
-- Currently this does not work, but it crashed GHC 6.5, so
-- this tests that the error message is civilised.
module Foo where
import Data.Generics
class ChurchEncode k where
match :: k
-> z
-> (forall a b z. a -> b -> z) {- product -}
-> (forall a z. a -> z) {- left -}
-> (forall a z. a -> z) {- right -}
-> z
match {| Unit |} Unit unit prod left right = unit
match {| a :*: b |} (x :*: y) unit prod left right = prod x y
match {| a :+: b |} (Inl l) unit prod left right = left l
match {| a :+: b |} (Inr r) unit prod left right = right r
instance ChurchEncode Bool
tcfail163.hs:11:0:
Generic method type is too complex
match :: forall k.
(ChurchEncode k) =>
forall z.
k
-> z
-> (forall a b z. a -> b -> z)
-> (forall a z. a -> z)
-> (forall a z. a -> z)
-> z
You can only use type variables, arrows, lists, and tuples
When checking the class method:
match :: k
-> z
-> (forall a b z. a -> b -> z)
-> (forall a z. a -> z)
-> (forall a z. a -> z)
-> z
In the class declaration for `ChurchEncode'
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