-# PHP Functional [](https://travis-ci.org/widmogrod/php-functional)
+# PHP Functional
+[](https://travis-ci.org/widmogrod/php-functional)
+[](https://codeclimate.com/github/codeclimate/codeclimate/coverage)
## Introduction
Functional programing is a fascinating concept.
## Development
-This repository follows [semantic versioning concept](http://semver.org/).
-If you want to contribute, just follow [GitHub workflow](https://guides.github.com/introduction/flow/) and open a pull request.
+This repository follows [semantic versioning concept](http://semver.org/).
+If you want to contribute, just follow [GitHub workflow](https://guides.github.com/introduction/flow/) and open a pull request.
More information about changes you can find in [change log](/CHANGELOG.md)
## Use Cases
You can find more use cases and examples in the [example directory](/example/).
-> **NOTE:** Don't be confused when browsing thought examples you will see phrase like "list functor" and in this library you will see ` Widmogrod\Primitive\Listt`.
+> **NOTE:** Don't be confused when browsing thought examples you will see phrase like "list functor" and in this library you will see ` Widmogrod\Primitive\Listt`.
Monad is Functor and Applicative. You could say that Monad implements Functor and Applicative.
### List Functor
```
### List Applicative Functor
-Apply function on list of values and as a result, receive list of all possible combinations
+Apply function on list of values and as a result, receive list of all possible combinations
of applying function from the left list to a value in the right one.
``` haskell
### Free Monad in PHP
Imagine that you first write business logic and don't care about implementation details like:
- - how and from where get user discounts
+ - how and from where get user discounts
- how and where save products in basket
- and more ...
-
+
When your business logic is complete, then you can concentrate on those details.
-Free monad enables you to do exactly that, and more:
+Free monad enables you to do exactly that, and more:
- Write business logic first
-- Write your own DLS (domain specific language)
+- Write your own DLS (domain specific language)
- Decouple implementation from interpretation.
Example Free Monad example of `echo program` can be found here:
]);
// performs operation, before that nothings happens from above code.
-$do->run();
+$do->run();
```
Example output: