DEV Community

Discussion on: Modelling a save button in Elm

yadalis profile image
Suresh Yadali

Wonderful. Understood your explanation and totally make sense now :).
Thank you very much for taking the time to help me out. I am getting my head around it quite nicely on Elm language. Elm rocks!!!

Also, I have a different version of CHANGE function since I am not sure what I would gain by passing a function and a blog, so tried the below function and it works, but not sure if I am missing any Elm standards here, but just a different approach.

buildUpdatedBlog : doc -> MaybeSaved doc -> MaybeSaved doc
buildUpdatedBlog newBlog (MaybeSaved lastSaved current) =
MaybeSaved lastSaved newBlog

here is the latest ellie link, ellie-app.com/3jHs2wFCmhXa1, any suggestions would be great.

Hope to see you at Elm Conf 2018.

Thread Thread
jwoudenberg profile image
Jasper Woudenberg Author

Looking great!

Also, I have a different version of CHANGE function since I am not sure what I would gain by passing a function and a blog.

Yeah, that's a good simplification!

The version of change in the post only comes in handy when you want to make a change that somehow depends on the previous value. Because the onInput handler for our text area always gives us the entire text of the blog we're not really interested in the old value of the blog. But if your blog app will for example have separate inputs for the blog title and the blog body the version of change in my post will come in handy.

Hope to see you at Elm Conf 2018.

I have to miss it unfortunately, I won't be in the US. Hope you enjoy it!