Comment

Comment by allover

(Ellie is really cool, apologies for the meta comment, but):

It's a shame that all that hits me in the face with Elm code examples lately is awkward style conventions. Why do they have to be so user hostile?

Trailing brace on the next line even for this?

    type alias Model =
    { counter : Int
    }
Instead of:

    type alias Model = { counter: Int }
Comma first, when trailing comma is so much more intuitive, why this?

    Html.program
        { view = view
        , update = update
        , subscriptions = \_ -> Sub.none
        , init = ( model, Cmd.none )
        }
instead of:

    Html.program {
        view = view,
        update = update,
        subscriptions = \_ -> Sub.none,
        init = ( model, Cmd.none ),
    }
(... which makes for better diffs too). And weird bracket soup for DOM:

    div []
        [ div [] [ button [ onClick Increment ] [ text "+" ] ]
        , div [] [ text <| toString model.counter ]
        , div [] [ button [ onClick Decrement ] [ text "-" ] ]
        ]
... when it's going to be translated to DOM anyway, why not?

    <div>
        <div><button onClick={increment}>+</button></div>
        <div>{toString model.counter}</div>
        <div><button onClick={decrement}>-</button></div>
    </div>
This is needlessly distracting from all the things that are nice about Elm.
parent allover 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton