
Show HN: Functors, Applicative Functors and Monads in PHP - widmogrod
https://github.com/widmogrod/php-functional
======
adaml_623
Maybe some comments in the examples would help explain what the code is
capable of and what it is intended to do. If you're going to do this in PHP
then make more PHP examples.

------
txvHN
why don't you guys just use functional languages if you need functional
features, instead of hacking stuff into languages born with different
purposes?

~~~
widmogrod
Well if fun factor is not good enough answer, then maybe this will work:

\- Using something and understanding it, are two different thing. Through
implementing things in a language that I'm familiar with, is easier for me to
grasp concept behind it and __understand __it.

\- Create a bridge between foreign concepts. If someone knows only PHP and
will grasp FP concept in PHP, then it will be easier for him learn new
language.

\- Sometimes switching to another language in your daily (commercial) work is
not easy as it sounds.

\- OOP and FP can do awesome things when used together.

~~~
xomateix
+1

Out of curiosity, just a quick question (disclaimer: it's been a while since
I've been doing any PHP - I think it was 5.3)...

Although the language had some OO capabilities, I wouldn't have defined PHP as
an OO language but more of a procedural/imperative language.

Has it changed lately? I mean, are there new libraries, frameworks and so that
are more OO?

Thanks :)

~~~
kieranajp
It's come on leaps and bounds in the past few versions IMO. Partly because of
new language features (proper namespaces (enabling easy autoloading), traits
etc) and partly because of the community pushing decent standards [0], [1].

It's also worth pointing out that since 5.3 the Laravel framework [2] has been
created and in its latest iteration it draws a lot of inspiration from ASP.NET
MVC and Rails (the former resonates with me coming from .NET land; though I've
not much experience with the latter), making it a great framework for rapid
prototyping. Its coding style encourages a lot of good practices and it's
become very much the go-to PHP MVC framework, at least for me.

A good resource for reading up on 'modern' PHP is PHP the "Right" Way [3] -
there's also a (very recently released) O'Reilly book on Modern PHP [4]
written by the creator of a popular micro framework [5] - I've not had chance
to read it yet (and I'm sure I'm not its target audience) but I have enough
faith in the author to know it'll be a worthwhile resource.

Having said all of this, it is still PHP and you will still be working with
some of the old quirks. I've just grown somewhat fond of them :)

    
    
      [0]: http://www.php-fig.org/
      [1]: https://getcomposer.org/
      [2]: http://laravel.com/
      [3]: http://www.phptherightway.com/
      [4]: http://shop.oreilly.com/product/0636920033868.do
      [5]: http://www.slimframework.com/

------
wetmore
Very cool.

