Re: [elm-discuss] How to not render an Html Node (from React to Elm)

2016-05-16 Thread Nick H
Or here is a similar approach to what Max suggested. If you do List.concatMap with sub-lists instead of List.filterMap with Maybes, you don't have to wrap each node individually. view model = div [] <| List.concatMap [ [ static nodes that always appear ] , (when model.gif (div [

Re: [elm-discuss] How to not render an Html Node (from React to Elm)

2016-05-16 Thread Nick H
Here is another strategy that came to mind. Instead of returning a value that is sometimes invisible, you could have a modifier that sometimes performs a no-op: appendWhen : Bool -> Node -> List Node -> List Node appendWhen condition node nodes = if condition then nodes ++ [node] else

Re: [elm-discuss] How to not render an Html Node (from React to Elm)

2016-05-16 Thread Max Goldstein
Perhaps use List.filterMap to drop Nothing? But all of the nonconditional nodes must be prefaced with Just <| which is annoying. -- 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, s

Re: [elm-discuss] How to not render an Html Node (from React to Elm)

2016-05-16 Thread Joaquín Oltra
Using style or a class name maybe? Is that hidden the attribute hidden on the div or something else? For now I've created a helper for that specific case resulting

Re: [elm-discuss] How to not render an Html Node (from React to Elm)

2016-05-16 Thread Fedor Nezhivoi
One possible solution may be to hide element based on condition: view model = div [ class "App" ] [ div [ class "Error", hidden (String.isEmpty model.error) ] [ text model.error ] , div [ class "Gif", hidden (String.isEmpty model.gif) ] [ input [ type' "text", readonly True

[elm-discuss] How to not render an Html Node (from React to Elm)

2016-05-16 Thread Joaquín Oltra
Hi! I'm porting a simple React webapp to Elm, and there is a pattern for not rendering a component that I'm not sure how to do cleanly with elm. The pattern is: data ? : null In a render method, like in here: https://github.com/joakin/gimme-gif/blob/415ff83611ab64ba10eb4f0cddccc12d1192815d/b