Skip to content

Instantly share code, notes, and snippets.

@dana-ross
Created October 25, 2015 18:00
Show Gist options
  • Save dana-ross/d5dfcf4ac5e5888e4e24 to your computer and use it in GitHub Desktop.
Save dana-ross/d5dfcf4ac5e5888e4e24 to your computer and use it in GitHub Desktop.
Just monad
<?php
class Just {
protected $value;
function __construct( $value ) {
$this->value = $value;
}
public static function of( $value ) {
return new self( $value );
}
public function map( callable $fn ) {
return Just::of( $fn( $this->value ) );
}
public function value() {
return $this->value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment