Clean up old Free implementation
authorwidmogrod <widmogrod@gmail.com>
Tue, 19 Dec 2017 17:54:58 +0000 (18:54 +0100)
committerwidmogrod <widmogrod@gmail.com>
Tue, 19 Dec 2017 17:54:58 +0000 (18:54 +0100)
README.md
composer.json
test/Monad/FreeTest.php [deleted file]

index cf92a70..77b3388 100644 (file)
--- a/README.md
+++ b/README.md
@@ -244,7 +244,6 @@ Free monad enables you to do exactly that, and more:
 
 #### Echo program
 Example Free Monad example of `echo program` can be found here:
-- See source code [FreeMonadTest.php](/example/FreeMonadTest.php) - example based on first implementation of Free
 - See source code [Free2MonadTest.php](/example/Free2MonadTest.php) - example based on second implementation of Free, based on [Haskell implementation](https://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Free-Class.html)
 
 #### DSL for `BDD` tests
index fb8e0d5..8bfd133 100644 (file)
@@ -32,6 +32,7 @@
     "files": [
       "src/Functional/functions.php",
       "src/Functional/miscellaneous.php",
+      "src/Functional/listt.php",
       "src/Functional/predicates.php",
       "src/Functional/strings.php",
       "src/Functional/monoid.php",
@@ -39,7 +40,6 @@
       "src/Monad/Control/functions.php",
       "src/Monad/Either/functions.php",
       "src/Monad/Maybe/functions.php",
-      "src/Monad/Free/functions.php",
       "src/Monad/Free2/functions.php",
       "src/Monad/IO/functions.php",
       "src/Monad/IO/errors.php",
diff --git a/test/Monad/FreeTest.php b/test/Monad/FreeTest.php
deleted file mode 100644 (file)
index 46a74a3..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-namespace test\Monad;
-
-use Widmogrod\FantasyLand\Functor;
-use Widmogrod\Helpful\FunctorLaws;
-use Widmogrod\Helpful\MonadLaws;
-use function Widmogrod\Monad\Free\liftF;
-use Widmogrod\Monad\Free\MonadFree;
-use Widmogrod\Monad\Free\Pure;
-use const Widmogrod\Functional\identity;
-use Widmogrod\Monad\Identity;
-
-class FreeTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @dataProvider provideFunctorTestData
-     */
-    public function test_it_should_obey_functor_laws(
-        callable $f,
-        callable $g,
-        Functor $x
-    ) {
-        FunctorLaws::test(
-            function (MonadFree $a, MonadFree $b, $message) {
-                $this->assertEquals(
-                    $a->runFree(identity),
-                    $b->runFree(identity),
-                    $message
-                );
-            },
-            $f,
-            $g,
-            $x
-        );
-    }
-
-    public function provideFunctorTestData()
-    {
-        return [
-            'Pure' => [
-                '$f' => function ($x) {
-                    return $x + 1;
-                },
-                '$g' => function ($x) {
-                    return $x + 5;
-                },
-                '$x' => Pure::of(1),
-            ],
-            'Free' => [
-                '$f' => function ($x) {
-                    return $x + 1;
-                },
-                '$g' => function ($x) {
-                    return $x + 5;
-                },
-                '$x' => liftF(Identity::of(1)),
-            ],
-        ];
-    }
-
-    /**
-     * @dataProvider provideMonadTestData
-     */
-    public function test_it_should_obey_monad_laws($f, $g, $x)
-    {
-        MonadLaws::test(
-            function (MonadFree $f, MonadFree $g, $message) {
-                $this->assertEquals(
-                    $f->runFree(identity),
-                    $g->runFree(identity),
-                    $message
-                );
-            },
-            function ($x) {
-                return Pure::of($x);
-            },
-            $f,
-            $g,
-            $x
-        );
-    }
-
-    public function provideMonadTestData()
-    {
-        $addOne = function ($x) {
-            return liftF(Identity::of(
-                $x + 1
-            ));
-        };
-        $addTwo = function ($x) {
-            return liftF(Identity::of(
-                $x + 2
-            ));
-        };
-
-        return [
-            'Identity' => [
-                '$f' => $addOne,
-                '$g' => $addTwo,
-                '$x' => 10,
-            ],
-        ];
-    }
-}