GHC extensions

Ryan Scott at
Thu Apr 19 12:45:03 UTC 2018

Hi Peter,

> What does exactly happen if an extension is needed for a certain language element, but it is not present?

Generally, these manifest as runtime checks of the form (xopt
LangExt.TheLanguageExtensionName dflags). For an example, see [1],
where GHC checks if the TypeFamilyDependencies extension is enabled,
and if not, subsequently throws an error.

> Does the type checker still continue its business after encountering such an error; or does it stop, and dump its the error messages?

It depends. Sometimes, GHC uses the addErrTc function to add an error
but not cause an outright failure, continuing until there is a fatal
error. The failWithTc function, on the other hand, adds an error and
causes GHC to exit, reporting all errors it's collected up to that
point. (The example in [1] does this.)

Ryan S.

More information about the ghc-devs mailing list