First one as goto option for splitting view functions out.

Second one if viewCheckbox is a standalone reusable triplet with internal 
state and Msg types (much less often).

This talk from Ossi gives great insight on different ways to organize your 
code 
https://www.youtube.com/watch?v=vpc80c5iC6k&list=PLglJM3BYAMPH2zuz1nbKHQyeawE4SN0Cd&index=2
I found it very useful

On Wednesday, September 21, 2016 at 8:16:33 PM UTC+2, Nick H wrote:
>
> I prefer the former style. It's less verbose, and it means my Main module 
> is the only one that needs to import Html.App. Also, with the latter style, 
> your helper is going to have something like "Html.Events.onCheck identity", 
> which seems a little silly.
>
> That's just my preference though. I think either one seems fine, as long 
> as you're consistent :-)
>
> On Wed, Sep 21, 2016 at 10:19 AM, Mark Hamburg <mhamb...@gmail.com 
> <javascript:>> wrote:
>
>> When writing a view function (or helper function that generates part of 
>> the view hierarchy), is it better to take a function mapping values or 
>> messages to parent messages or to use Html.App.map for this? In other 
>> words, is it better to write:
>>
>> viewCheckbox SetMyCheckboxState "My Checkbox" model.myCheckboxState
>>
>> viewCheckbox : (Bool -> msg) -> String -> Bool -> Html msg
>>
>>
>> or to write:
>>
>> Html.App.map SetMyCheckboxState
>>     <| viewCheckbox "My Checkbox" model.myCheckboxState
>>
>> viewCheckbox : String -> Bool -> Html Bool
>>
>>
>> Mark
>>
>> -- 
>> 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...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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