I've added this as a GHC test too! (typecheck/should_compile/tc187)
| -----Original Message----- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Iavor | Diatchki | Sent: 19 February 2005 01:19 | To: [email protected] | Subject: [Hugs-bugs] Bug with fun-deps | | Hello, | | I seem to have run into a problem involving functional dependencies. | Below is an excerpt of a program I was writing that illustrates the bug. | | > data N0 | > newtype Succ n = Succ n | | > class Plus a b c | a b -> c | > instance Plus N0 n n | > instance Plus a b c => Plus (Succ a) b (Succ c) | | > ( # ) :: Plus x y z => x -> y -> z | > ( # ) = undefined | | > class BitRep t n | t -> n where | > toBits :: t -> n | | > instance BitRep Bool (Succ N0) | | > instance BitRep (Bool,Bool,Bool) (Succ (Succ (Succ N0))) where | > toBits (x,y,z) = | | The program works with the line below, but if I remove it | I get a type error --- Hugs complains that it cannot solve | the constraint: | | Plus (Succ N0) (Succ N0) (Succ (Succ N0)) | | > toBits' where toBits' = | | > toBits x | > # toBits y | > # toBits z | | The program works with GHC in either form, and it looks like | Hugs should be able to solve the constraint using the instances above. | | -Iavor | _______________________________________________ | Hugs-Bugs mailing list | [email protected] | http://www.haskell.org/mailman/listinfo/hugs-bugs _______________________________________________ Hugs-Bugs mailing list [email protected] http://www.haskell.org/mailman/listinfo/hugs-bugs
