I *think* I am trying to solve a conceptually similar issue in my elm-irc 
library.

The library exposes a bunch of typical irc/chat commands, such as "send 
message", "join chatroom" and so on. All these commands need some common 
configuration (mainly the IRC server address). I find it overly complex and 
redundant to expose

sendmessage url message = ...
joinchatroom url roomname = ...
...



For now, I opted for a variant of your "2.", where my module exports

commands url = {
  sendmessage url,
  joinchatroom url,
  ...
}



...and the consumer then receives these curried variants.

I am not particularly happy with this solution.


O.



On Thursday, May 26, 2016 at 12:07:01 PM UTC+2, Peter Damoc wrote:
>
> Let's say I have a module that encapsulates a series of widgets and I want 
> to publish this module with elm-package in order to make it available to 
> others. 
>
> Let's say that there is the concept of a `primaryColor` for these widgets. 
>
> How can I have the users change the `primaryColor`? 
>
> I can think of only two ways:
>
> 1. Pass a `Context` record to each widget's view 
>
> 2. Create a function in the module that receives such a Context and 
> returns a master record of all the views in order to avoid passing the 
> context every time. 
>
> What other options are there? 
>
> P.S. There is also the option to just copy the source code of the widget 
> module and modify the default value manually but I want to avoid this. 
>
>
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to