Dependency Injection → Implicit Parameters | Reader Monad
zhao-huang opened this issue · 3 comments
Hi, thanks for your contribution!
I think the reader monad example can be a usefull addition!
Regarding the implicit parameters I've still some questions.
Looking at the given example:
sortBy :: (a -> a -> Bool) -> [a] -> [a]
sort :: (?cmp :: a -> a -> Bool) => [a] -> [a]
sort = sortBy ?cmp
It look's quite like an ordinary partial application, but with a dynamically type cmp function.
As I have already covered partial application as the most straight forward implementation of CI in functional languages, I'm not sure what additional benefit is gained by the usage of implicit parameters?
Hi, this guide is really handy!
As for the benefits of implicit parameters, since I haven't used them in practice, I can't clearly explain what benefits they offer.
There are some thread and post where people debate the use of implicit parameters:
Reddit: Who Still Uses ReaderT
At this comment, Edward Kmett argues that it can bring benefits when used properly.
Hi again,
I've just added a short section on Reader Monad and implicit parameters which links to "Who still uses ReaderT" and "What's wrong with implicitParams"
Thanks again for your contribution, That's really appreciated!