Hi, The following program is accepted by GHC 7 with -XRank2Types: class C a where f :: a -> a newtype R = R (forall a . C a => a) instance C R where f (R x) = R $ f x main = return () jhc 0.8 gives the following error: [1 of 1] Main (...............jhci: user error ( What: failure Why: Signature too Weak: [] does not imply [Main.C Main.v11] Where: on line 7 in j.hs in the explicitly typed Instance@.iMain.f.Main.R (Main.R Main.6_x) = Main.R Jhc.Basics.$ Main.f Main.6_x {- on line 7 -} Compilation of module: Main) Is this difference in behaviour intended, and how can I make something like that compile? -- Roman I. Cheplyaka :: http://ro-che.info/
On Wed, Feb 8, 2012 at 2:55 PM, Roman Cheplyaka
The following program is accepted by GHC 7 with -XRank2Types:
class C a where f :: a -> a
newtype R = R (forall a . C a => a)
instance C R where f (R x) = R $ f x
main = return ()
jhc 0.8 gives the following error:
[1 of 1] Main (...............jhci: user error ( What: failure Why: Signature too Weak: [] does not imply [Main.C Main.v11] Where: on line 7 in j.hs in the explicitly typed Instance@.iMain.f.Main.R (Main.R Main.6_x) = Main.R Jhc.Basics.$ Main.f Main.6_x {- on line 7 -} Compilation of module: Main)
Is this difference in behaviour intended, and how can I make something like that compile?
I believe that jhc is being too restrictive here and it should accept the program. thanks for the report. I strengthened the checking of class constraints signifiantly in this version and probably introduced this bug. John
participants (2)
-
John Meacham -
Roman Cheplyaka