When we have TypeSynonymInstances without FlexibleInstances we should still
insist on a H98-style instance head, after looking through the synonym.
This patch also make FlexibleInstances imply TypeSynonymInstances. Anything
else is a bit awkward, and not very useful.
, (Opt_LiberalTypeSynonyms, turnOn, Opt_ExplicitForAll)
, (Opt_ExistentialQuantification, turnOn, Opt_ExplicitForAll)
, (Opt_PolymorphicComponents, turnOn, Opt_ExplicitForAll)
+ , (Opt_FlexibleInstances, turnOn, Opt_TypeSynonymInstances)
, (Opt_RebindableSyntax, turnOff, Opt_ImplicitPrelude) -- NB: turn off!
-- Used in Haskell-98 mode, for the argument types of an instance head
-- These must be a constructor applied to type variable arguments
tcInstHeadTyAppAllTyVars ty
+ | Just ty' <- tcView ty -- Look through synonyms
+ = tcInstHeadTyAppAllTyVars ty'
+ | otherwise
= case ty of
TyConApp _ tys -> ok tys
FunTy arg res -> ok [arg, res]
</row>
<row>
<entry><option>-XFlexibleInstances</option></entry>
- <entry>Enable <link linkend="instance-rules">flexible instances</link>.</entry>
- <entry>dynamic</entry>
+ <entry>Enable <link linkend="instance-rules">flexible instances</link>.
+ Implies <option>-XTypeSynonymInstances</option> </entry>
+ <entry>dynamic</entry>
<entry><option>-XNoFlexibleInstances</option></entry>
</row>
<row>