GHC extensions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GHC extensions

Peter Podlovics
Hi everyone,

I have a question about handling missing extension errors in modules. What does exactly happen if an extension is needed for a certain language element, but it is not present? I couldn't find the code segment where error messages are handled, and since there are no immediate program interrupts at their creation site (e.g.: at TcValidity.checkValidType), I can only assume that there is some tricky laziness in action here.

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

Thanks in advance,
Peter

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: GHC extensions

Ryan Scott
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.
-----
[1] http://git.haskell.org/ghc.git/blob/5d76846405240c051b00cddcda9d8d02c880968e:/compiler/typecheck/TcTyClsDecls.hs#l1097
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs