The base-feature-macros package

[ Tags: bsd3, development, library ] [ Propose Tags ]

This provides a set of feature macros describing features of base in a semantic way.

See <base-feature-macros.h> for the set of currently provided macros.

In order to use the CPP header provided by this package, add this package as a dependency to your .cabal file, i.e.

build-depends: base-feature-macros: >= 0.1 && < 0.2

while making sure that the version specified as lower bound defines the feature-macros your code tests for. This is particularly important as CPP will implicitly treat undefined CPP macros as having the value 0. See also GNU CPP/CC's -Wundef warning to detect such errors; or starting with GHC 8.2, -Wcpp-undef can be used:

if impl(ghc >= 8.2)
    ghc-options: -Wcpp-undef

Then in your code, you can include and use the <base-feature-macros.h> header like so

module M where

#include <base-feature-macros.h>

import Data.Foldable (Foldable (..))
import Prelude       hiding (foldr, foldr1)
import Data.Monoid hiding ((<>))

This package is inspired by the blogpost "Make macros mean something – readable backwards compatibility with CPP".


Versions 0.1,
Change log
Dependencies base (>=4.3 && <4.11) [details]
License BSD3
Author Herbert Valerio Riedel
Category Development
Bug tracker
Source repository head: git clone
Uploaded Mon Jun 5 22:09:36 UTC 2017 by HerbertValerioRiedel
Distributions NixOS:
Downloads 129 total (7 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2017-06-05 [all 2 reports]
Hackage Matrix CI


Maintainer's Corner

For package maintainers and hackage trustees