Configuration problem #1284
Replies: 2 comments 4 replies
-
For me I think this is a more appealling argument in favour of implicits than polymorphism. I do not mind the slightly more verbose APIs of monomorphic functions, and I think there is also value in being able to quickly identify where a function is implement or what data structures are being used purely by looking at function names. I cannot on the other hand see much value in having to pass an instance of |
Beta Was this translation helpful? Give feedback.
-
Hi again! I was wondering @timjs if you knew of other solutions to this problem? Ignoring ad-hoc polymorphism for the time being. I'm aware of other approaches to polymorphism but not this. |
Beta Was this translation helpful? Give feedback.
-
(As a follow up on #1244 and #1272.)
The configuration problem was once stated by Oleg Kiselyov in Functional Pearl: Implicit Configurations. It's best described by an example:
Problem here is that the
mod
argument has to be passed explicitly to every function call. It is similar, but not equivalent, to pass around configuration data using a Reader monad in Haskell/PureScript/Idris, as the modulo problem show above abstracts over the current context.Implicts as used by Scala are a possible solution to this problem. Question is: do we like to address this problem in Gleam, i.e. is it something that happens a lot, or is it a niche and is explicit passing not a big problem?
Beta Was this translation helpful? Give feedback.
All reactions