Skip to content

Instantly share code, notes, and snippets.

@StevenXL
Created April 8, 2020 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StevenXL/c9b6671287437a9eca40b29f70089b46 to your computer and use it in GitHub Desktop.
Save StevenXL/c9b6671287437a9eca40b29f70089b46 to your computer and use it in GitHub Desktop.
Elm - Simulating Maybe.map6
Maybe.map5
(\year month day hour minute ->
{ year = year
, month = month
, day = day
, hour = hour
, minute = minute
, second = 0
}
)
(parseIsoYear str)
(parseIsoMonth str)
(parseIsoDay str)
(parseIsoHour str)
(parseIsoMinute str)
|> Maybe.andThen
(\val ->
case parseIsoSecond str of
Just seconds ->
Just { val | second = seconds }
Nothing ->
Nothing
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment