How do I get the current time in Elm?

后端 未结 8 1333
庸人自扰
庸人自扰 2020-12-03 01:15

I\'m running elm-repl to play around with the language.

I\'d like to see what the current time is. How would I do that? It doesn\'t appear to be possible with the c

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 02:15

    To resolve my own question, I've created a variant of StartApp that includes a timestamp on each action.
    So the update function has signature:
    update : action -> Time -> model -> (model, Effects action)

    The Gist is here. https://gist.github.com/z5h/41ca436679591b6c3e51

提交回复
热议问题