maybe-d 0.0.1

Provides a Maybe-like data type and helpers.


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

maybe-d

Simple syntactic sugar for a Maybe-like experience. Maybe(T) is just one small step toward a world without null.

Example usage:


import maybe.d;

Maybe!string maybeReturnsString( bool shouldReturnString )
{
    if( shouldReturnString )
    {
        return just!string("foo");
    }
    else
    {
        return nothing!string;
    }
}

// prints "the string is foo"
writeln( "the string is " ~ maybeReturnsString(true).getOrElse("bar") );

// prints "the string is bar"
writeln( "the string is " ~ maybeReturnsString(false).getOrElse("bar") );

Authors:
dkhasel
Dependencies:
none
Versions:
0.0.1 2014-May-25
~master 2014-May-25
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 201 downloads total