Metalang99 1.13.5
Full-blown preprocessor metaprogramming
Loading...
Searching...
No Matches
maybe.h File Reference

An optional value. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ML99_just(x)
 Some value x.
#define ML99_nothing(...)
 No value.
#define ML99_isJust(maybe)
 ML99_true() if maybe contains some value, otherwise ML99_false().
#define ML99_isNothing(maybe)
 The inverse of ML99_isJust.
#define ML99_maybeEq(cmp, maybe, other)
 Tests maybe and other for equality.
#define ML99_maybeUnwrap(maybe)
 Returns the contained value on ML99_just(x) or emits a fatal error on ML99_nothing().
#define ML99_JUST(x)
#define ML99_NOTHING(...)
#define ML99_IS_JUST(maybe)
#define ML99_IS_NOTHING(maybe)

Detailed Description

An optional value.

Macro Definition Documentation

◆ ML99_IS_JUST

#define ML99_IS_JUST ( maybe)
Value:
ML99_PRIV_IS_JUST(maybe)

◆ ML99_IS_NOTHING

#define ML99_IS_NOTHING ( maybe)
Value:
ML99_NOT(ML99_IS_JUST(maybe))

◆ ML99_isJust

#define ML99_isJust ( maybe)
Value:
#define ML99_call(op,...)
Invokes a metafunction with arguments.
Definition lang.h:33
#define ML99_isJust(maybe)
ML99_true() if maybe contains some value, otherwise ML99_false().
Definition maybe.h:40

ML99_true() if maybe contains some value, otherwise ML99_false().

Examples

// 1
// 0
#define v(...)
A value that is pasted as-is; no evaluation occurs on provided arguments.
Definition lang.h:145
An optional value.
#define ML99_nothing(...)
No value.
Definition maybe.h:23
#define ML99_just(x)
Some value x.
Definition maybe.h:18

◆ ML99_isNothing

#define ML99_isNothing ( maybe)
Value:
#define ML99_isNothing(maybe)
The inverse of ML99_isJust.
Definition maybe.h:57

The inverse of ML99_isJust.

Examples

◆ ML99_JUST

#define ML99_JUST ( x)
Value:
ML99_CHOICE(just, x)

◆ ML99_just

#define ML99_just ( x)
Value:

Some value x.

◆ ML99_maybeEq

#define ML99_maybeEq ( cmp,
maybe,
other )
Value:
ML99_call(ML99_maybeEq, cmp, maybe, other)
#define ML99_maybeEq(cmp, maybe, other)
Tests maybe and other for equality.
Definition maybe.h:78

Tests maybe and other for equality.

Examples

#include <metalang99/nat.h>
// 1
// 0
// 0
Natural numbers: [0; 255].
#define ML99_natEq(x, y)
Definition nat.h:112

◆ ML99_maybeUnwrap

#define ML99_maybeUnwrap ( maybe)
Value:
#define ML99_maybeUnwrap(maybe)
Returns the contained value on ML99_just(x) or emits a fatal error on ML99_nothing().
Definition maybe.h:95

Returns the contained value on ML99_just(x) or emits a fatal error on ML99_nothing().

Examples

// 123
// Emits a fatal error.

◆ ML99_NOTHING

#define ML99_NOTHING ( ...)
Value:
ML99_CHOICE(nothing, ~)

◆ ML99_nothing

#define ML99_nothing ( ...)
Value:
#define ML99_callUneval(ident,...)
Invokes a metafunction ident with unevaluated arguments.
Definition lang.h:42

No value.