Skip to content
dkhaselPublic

About

Provides a Maybe-like data type and helpers, in the key of D.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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") );

About

Provides a Maybe-like data type and helpers, in the key of D.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages