Skip to content

Instantly share code, notes, and snippets.

@rippinrobr
Last active July 18, 2018 22:30
Show Gist options
  • Save rippinrobr/9a5943928288cfa65476d3f13e0b8a22 to your computer and use it in GitHub Desktop.
Save rippinrobr/9a5943928288cfa65476d3f13e0b8a22 to your computer and use it in GitHub Desktop.
The init function - creates the model with default values and uses it as part of the command that retrieves the categores
-- init does what you might think it does, it initializes the applicaiton.
-- In this app, I need to fetch the list of tags when the page loads so
-- the user has some navigation to work with so I make the call to the
-- httpCommand function.
init : ( Model, Cmd Msg )
init =
let model = { categories = []
, errorMsg = Nothing
, selectedTag = "All"
, summaries = []
}
in
( model, getCategoriesCommand)
.......... some other code ..........
main : Program Never Model Msg
main =
program
{ init = init
, view = view
, update = update
, subscriptions = \_ -> Sub.none
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment