-XGADTs changes type for program that does not contain GADT

Dear Cafe, the following type-correct program does not contain GADT syntax. When I activate GADT language pragma, it does no longer typecheck. {-# language GADTs, ScopedTypeVariables #-} data M a b dw :: (b -> b -> b) -> M a b -> M a b -> M a b dw f x y = x data Bar a b s = Bar { this :: M a (M b s), that :: M b (M a s) } f :: forall p q s . (s -> s -> s) -> Bar p q s -> Bar p q s -> Bar p q s f g x y = let -- diff :: forall p . M p s -> M p s -> M p s diff a b = dw g a b in Bar { this = dw diff (this x)(this y) , that = dw diff (that x)(that y) } I can fix this by declaring the type for `diff` as indicated in the comment. Otherwise, `diff` is not polymorphic (enough), as the error message shows. This behaviour is consistent over ghc-7.8,7.10,8-rc, so it's unlikely to be a bug. But it does seem to go against the claim of "conservative extension of HM" (Sect 6.6 of the ICFP'06 paper, Sect 4.9 of MS-CIS-05-26) http://research.microsoft.com/en-us/um/people/simonpj/papers/gadt/ - J.W.

Hi.
the following type-correct program does not contain GADT syntax. When I activate GADT language pragma, it does no longer typecheck.
This is because -XGADTs implies -XMonoLocalBinds. See https://ghc.haskell.org/trac/ghc/blog/LetGeneralisationInGhc7 for a longer explanation. Cheers, Andres -- Andres Löh, Haskell Consultant Well-Typed LLP, http://www.well-typed.com Registered in England & Wales, OC335890 250 Ice Wharf, 17 New Wharf Road, London N1 9RF, England

"Implies" is too strong, isn't it? My understanding is -XGADTs turns on -XMonoLocalBinds by default, but you can use -XGADTs with -XNoMonoLocalBinds Tom
El 12 feb 2016, a las 08:05, Andres Löh
escribió: Hi.
the following type-correct program does not contain GADT syntax. When I activate GADT language pragma, it does no longer typecheck.
This is because -XGADTs implies -XMonoLocalBinds. See https://ghc.haskell.org/trac/ghc/blog/LetGeneralisationInGhc7 for a longer explanation.
Cheers, Andres
-- Andres Löh, Haskell Consultant Well-Typed LLP, http://www.well-typed.com
Registered in England & Wales, OC335890 250 Ice Wharf, 17 New Wharf Road, London N1 9RF, England _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
participants (3)
-
amindfv@gmail.com
-
Andres Löh
-
Johannes Waldmann