On Monday, October 17, 2016 at 6:07:45 PM UTC-6, Mario T. Lanza wrote:
>
> 1) due-dates: installing and activating this plugin causes a due date 
> field to be added to the Todo model.  The interface still provides only the 
> text input field for providing the next "What needs to be done?" entry.  In 
> the list portion of the view a due date column appears.  When the user 
> types in an @ followed by a date (e.g. @2016-11-01) the value is parsed out 
> of the text and included in the due date field in the list below.
>

Given that the plugin data has to reside somewhere, I'd probably add a set 
of plugin storages to the record, one for each possible plugin that may be 
enabled (you cannot generically store data in Elm due to lack of various 
features like HKT's, HPT's, polymorphic variants, etc...  Everything in elm 
is designed to be visible not hidden, thus you have to know all types ahead 
of time).  Each plugin data storage could easily be an option so it is 
either Nothing or Just depending on if enabled or disabled (since you said 
you do not care about storing it somewhere).

For the view you could go two ways, either just test for validity of each 
and display data depending in the view, very hard-coded, but also very 
Elm'y, or you could generate a set of record hooks depending on the plugin 
states and pass those around the view to call the right hooks at the right 
time, this is more generic and multiple plugins could be supported with 
ease, but you still have to store the model of each individually without a 
few more language features.
 

On Monday, October 17, 2016 at 6:07:45 PM UTC-6, Mario T. Lanza wrote: 

> 2) tags: installing and activating this plugin causes a tags field to be 
> added to the Todo model.  The interface still provides only the text input 
> field for providing the next "What needs to be done?" entry.  In the list 
> portion of the view a tags column appears.  When the user types in a # 
> followed by a contiguous word or group of words (e.g. #finance #2016-taxes) 
> the values are parsed out of the text and included in the tags field in the 
> list below. 
>
 
>
When a plugin is deactivated the columns are simply dropped from the model. 
>  I am not worried about persistence. 
> <https://groups.google.com/forum/#!topic/elm-dev/wymnXbZy5wA>
>

Basically doing what I suggested above should work, verbose and explicit, 
but it works and is obvious to readers of the code too.

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to