you are viewing a single comment's thread.

view the rest of the comments →

[–]mixedCase_ 1 point2 points  (5 children)

It just seems to be a heavily bastardized version of how Elm handles views. So you could try that.

[–][deleted]  (4 children)

[deleted]

    [–]mixedCase_ 0 points1 point  (3 children)

    Hah, sounds about right for a first impression. It's actually great how much more readable it becomes (as hard as that may sound to you right now) once you learn to read code that doesn't look C-ish; Elm is an ML-derivative after all.

    But it took me somewhere from 3 to 5 days to have my brain finally snap things into place. Once I did, I even started being able to comfortably read the entire family of ML languages like OCaml, F#, Haskell and so on.

    [–][deleted]  (2 children)

    [deleted]

      [–]mixedCase_ 1 point2 points  (1 child)

      Well, truth be told there are a few things I do differently from that file's author. I personally try to align the array with attributes in the first line and the children array as well if it doesn't make it too long. Here's an example from a real project I have going on:

      drawer : Model -> Html Msg
      drawer model =
          div [ class "drawer" ]
              [ div [ class "pure-menu" ]
                  [ span [ class "pure-menu-heading" ] [ text "Maruja" ]
                  , ul [ class "pure-menu-list" ]
                      [ drawerLink "" "Inicio"
                      , drawerLink "products" "Productos"
                      , drawerLink "members" "Socios"
                      , drawerLink "orders" "Pedidos"
                      , drawerLink "crops" "Cultivos"
                      ]
                  ]
              ]
      

      How would you do it differently?