[Haskell-cafe] Is there a way to query the availability of an extension? Or could we?

David Feuer david.feuer at gmail.com
Tue May 17 21:19:45 UTC 2016

We have __GLASGOW_HASKELL__ to tell us what GHC version we're running
(if we're running GHC), and Cabal sets up MIN_VERSION_blah macros and
(when applicable) the __HADDOCK_VERSION__ macro. But what if we're
running some other compiler? It seems rather painful to have to write
code that enables or disables various extensions based on what version
N of compiler C happens to support. Not to mention that this is even a
pain when just dealing with GHC, since it involves digging through
release notes or waiting to see how Travis throws up.

Is there some better way? If not, could we add one?


could tell us if the ScopedTypeVariables extension is available. Then
instead of saying "We need ScopedTypeVariables" when we can
(painfully) do without, we can just use it precisely when we have it.

More information about the Haskell-Cafe mailing list