Commit 72aac89b authored by simonpj's avatar simonpj
Browse files

[project @ 2001-02-22 13:16:48 by simonpj]

Add more tests
parent 34924211
{-# OPTIONS -fglasgow-exts #-}
-- !!! Functional dependencies
-- This one gave another fail in tcReadMutVar
module M1 where
class HasFoo a foo | a -> foo where
foo :: a -> foo
instance HasFoo Int Int where
foo = id
instance HasFoo a b => HasFoo [a] b where
foo = foo . head
test:: [[Int]] -> Int
test = foo
{-# OPTIONS -fglasgow-exts #-}
-- !!! An instance decl with a context containing a free type variable
-- The interest here is that there's a "b" in the instance decl
-- context that isn't mentioned in the instance head.
module ShouldCompile where
class HasConverter a b | a -> b where
convert :: a -> b
data Foo a = MkFoo a
instance (HasConverter a b,Show b) => Show (Foo a) where
show (MkFoo value) = show (convert value)
{-# OPTIONS -fglasgow-exts #-}
-- !!! Functional dependencies and existentials
-- Hugs (February 2000) doesn't like it. It says
-- Variable "e" in constraint is not locally bound
module ShouldCompile where
class Collection c e | c -> e where
empty :: c
put :: c -> e -> c
data SomeCollection e = forall c . Collection c e => MakeSomeCollection c
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