hoppy-generator-0.3.2: C++ FFI generator - Code generator

Safe HaskellNone
LanguageHaskell2010

Foreign.Hoppy.Generator.Version

Contents

Description

Utilities for conditional compilation of parts of interfaces.

This module provides wrappers around Maybe and catMaybes so that you can write code such as:

myClass =
  makeClass ...
  [ ...ctors... ] $
  collect
  [ just $ mkMethod "foo" ...
  , test (apiVersion >= [1, 2]) $ mkMethod "bar" ...
  , test featureBaz $ mkMethod "baz" ...
  ]

Synopsis

General filtering

type Filtered = Maybe Source #

Placeholder Maybe-like type that may be more general in the future.

collect :: [Filtered a] -> [a] Source #

Filters a list of Filtered values down to the elements that are actually present.

none :: Filtered a Source #

A Filtered value that is always absent.

just :: a -> Filtered a Source #

Returns a Filtered value that is always present.

test :: Bool -> a -> Filtered a Source #

Returns a Filtered value that is only present if the boolean is true.

C++ Standard version

defaultCppVersion :: CppVersion Source #

The CppVersion chosen when one is not explicitly requested. This is Cpp2011.

activeCppVersion :: CppVersion Source #

The active version of the C++ standard. This looks to the HOPPY_CPP_STD environment variable, and accepts the values c++98, c++11, and c++14, which map to the corresponding CppVersion values. If a value other than these is set, then a warning is printed and the default is used. If no value is set, the default is used.

This uses unsafePerformIO internally and won't cope with a changing environment.