23 ms·
Haskell has implicit parameters[1]. [1]: https://www.haskell.org/hugs/pages/users_guide/implicit-parameters.html https://www.haskell.org/hugs/pages/users_guide
by emmab 5y ago
Haskell has implicit parameters[1].
[1]: https://www.haskell.org/hugs/pages/users_guide/implicit-parameters.html https://www.haskell.org/hugs/pages/users_guide/implicit-para...
- Athas 5y agoWhile this is true, it should be noted that: * Implicit parameters are a language extension, not part of standard Haskell (although extensions are so ubiquitously used that this does not matter much). * Implicit parameters are rarely used[0]. I would not be surprised if most experienced Haskell programmers have never used them, and while they may know they exist, they might not even remember the syntax or semantics. I belong to that category myself. In Haskell, type classes tend to be used for what other languages might do with implicit parameters. [0]: https://gist.github.com/atondwal/ee869b951b5cf9b6653f7deda0b7dbd8 https://gist.github.com/atondwal/ee869b951b5cf9b6653f7deda0b...
- eru 5y agoIn more orthodox Haskell, you can use eg the 'Reader Monad' with a suitable datastructure (or combination of Applicatives) where other languages would use dynamically scoped variables.
- gpderetta 5y agoNice! I was wondering if implicit parameters were equivalent to dynamic scoping. It seems to be the case. more on the topic: http://blog.ezyang.com/2020/08/dynamic-scoping-is-an-effect-implicit-parameters-are-a-coeffect/ http://blog.ezyang.com/2020/08/dynamic-scoping-is-an-effect-...