You could define emptyLine somewhere in your code and just do Maybe.withDefault
emptyLine (Dict.get name model.lines)
Oh yes, that's great! Adopted!
Thanks for the others pointers. I obviously still have quite a lot to discover in
the language and its ecosystem! (although I was already aware
Hi Matt,
Thanks for your nice answer!
As for Dicts, I would say double check to make sure you don't
actually want a record. Basically if you know all the fields at
compile time...you probably want a record, not a dict.
I may have an habit of using dicts too often... (in python, almost
Hi Matthieu,
Welcome to elm! I too have a background in Python and here are some things
I've learned as I've written projects in elm.
You're right it is more verbose in a lot of cases. What you get in a lot
of cases is that it's very clear what's going on while in python there can
be a
Thanks Ian for your suggestions!
As for pulling the common code into another function, my threshold is probably
still the python one ;-)
But I finally adopted your solution with the helper function defined in a let
expression. That's already much better than my initial code!
let
Little suggestions on your no-string-interpolation example:
(String.pad 2 '0' <| toString (hour date)) ++ ":" ++ (String.pad 2 '0' <|
toString (minute date))
1. You could try
http://package.elm-lang.org/packages/mgold/elm-date-format/1.1.4/ if you're
not opposed to using a third party