Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The redundancy can be alleviated by type inference, but it's also kind of nice. The 'Response' on the left is your expectation about what $r is, while the one on the right is your implementation of that expectation. The separation is very important.

Of course, in this example, it's silly and type inference would be used to ensure that you don't need to write the left side.

The advantage is that before running your code you can suss out much greater degrees of what your code "could possibly mean". The \Closure bit is a start, but it needs to fail prior to running to be statically typed. It also could potentially include much more information like (\Closure[Http\Request -> Http\Response]) and reject even more bad arguments.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: