top | item 28916296

(no title)

emmab | 4 years ago

Haskell has implicit parameters[1].

[1]: https://www.haskell.org/hugs/pages/users_guide/implicit-para...

discuss

order

Athas|4 years ago

While 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/ee869b951b5cf9b6653f7deda0b...

eru|4 years ago

In 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.