Skip to content

Instantly share code, notes, and snippets.

@datashaman
Last active May 8, 2019 05:07
Show Gist options
  • Save datashaman/49e9c78bc0b2479856514f2526bfc7e5 to your computer and use it in GitHub Desktop.
Save datashaman/49e9c78bc0b2479856514f2526bfc7e5 to your computer and use it in GitHub Desktop.
Datashaman\Logic\fromMaybe Example
<?php
<<<CONFIG
packages:
- "datashaman/logic: dev-master"
CONFIG;
#
# This is a Melody script. http://melody.sensiolabs.org/
#
use function Datashaman\Logic\fromMaybe;
use function Datashaman\Logic\mkMaybe;
use function Datashaman\Logic\repr;
echo repr(fromMaybe("", mkMaybe('Hello World'))) . PHP_EOL;
echo repr(fromMaybe("", mkMaybe(null))) . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment