Skip to content

Instantly share code, notes, and snippets.

@RobertFischer
Created November 15, 2017 17:29
Show Gist options
  • Save RobertFischer/670637f07e26aad6da0f39e928d8e58c to your computer and use it in GitHub Desktop.
Save RobertFischer/670637f07e26aad6da0f39e928d8e58c to your computer and use it in GitHub Desktop.
The goal is to get a MilestonesMsg created from a GlobalModel instance.
milestoneBtnMsg =
global.selectedCareplan -- Start with the careplan
|> Maybe.andThen .id -- Call .id on it if it's Just; return Nothing if it's Nothing or id is Nothing
|> Maybe.map MilestonesRoute -- Wrap it in a MilestonesRoute if we have a Just
|> Maybe.withDefault DoNothing -- If we have a Nothing, return DoNothing; otherwise, return the value in the Just
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment