Bugs with fundeps
Marcin 'Qrczak' Kowalczyk
qrczak@knm.org.pl
21 Dec 2000 18:36:32 GMT
The following program is accepted and prints [102]:
------------------------------------------------------------------------
class Foo a b | a -> b where
foo :: a -> b
instance Foo [a] (Maybe a) where
foo [] = Nothing
foo (x:_) = Just x
instance Foo (Maybe a) [a] where
foo Nothing = []
foo (Just x) = [x]
test3:: [a] -> [b]
test3 = foo . foo
main:: IO ()
main = print (test3 "foo" :: [Int])
------------------------------------------------------------------------
The following module causes a panic:
basicTypes/Var.lhs:185: Non-exhaustive patterns in function readMutTyVar
------------------------------------------------------------------------
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
------------------------------------------------------------------------
--
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK