Skip to content

Commit

Permalink
added prelude
Browse files Browse the repository at this point in the history
  • Loading branch information
loganhenson committed Jan 18, 2016
1 parent 8b8dff5 commit f47439b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 45 deletions.
93 changes: 48 additions & 45 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/Vector/Algebra/Lib/Prelude.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Vector\Algebra\Lib;

class Prelude
{
public static function usingAll()
{
return [
'compose' => Lambda::using('compose'),
'map' => Functor::using('fmap'),
'extract' => Functor::using('extract'),
'bind' => Monad::using('bind')
];
}
}
24 changes: 24 additions & 0 deletions src/Vector/Algebra/Lib/__tests__/PreludeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Vector\Algebra\Lib\__tests__;

use Closure;
use Vector\Algebra\Lib\Prelude;

class PreludeTest extends \PHPUnit_Framework_TestCase
{
public function testPrelude()
{
extract(Prelude::usingAll());

/** @var closure $map */
/** @var closure $bind */
/** @var closure $extract */
/** @var closure $compose */

$this->assertInstanceOf('closure', $map);
$this->assertInstanceOf('closure', $bind);
$this->assertInstanceOf('closure', $extract);
$this->assertInstanceOf('closure', $compose);
}
}

0 comments on commit f47439b

Please sign in to comment.