maybe-d 0.0.1
Provides a Maybe-like data type and helpers.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
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") );
- Registered by Damon Khasel
- 0.0.1 released 10 years ago
- dkhasel/maybe-d
- MIT
- Copyright © 2014, Damon Khasel
- Authors:
- Dependencies:
- none
- Versions:
-
0.0.1 2014-May-25 ~master 2014-May-25 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
207 downloads total
-
- Score:
- 0.3
- Short URL:
- maybe-d.dub.pm