Use HashMap.lookupDefault

Summary: This is a small stylystic improvement.

Reviewed By: patapizza

Differential Revision: D4713463

fbshipit-source-id: 47720d3
This commit is contained in:
Bartosz Nitka 2017-03-15 07:57:36 -07:00 committed by Facebook Github Bot
parent 1edf62f347
commit 1a251d8e42

View File

@ -45,7 +45,7 @@ import Duckling.Types
makeReftime :: HashMap Text TimeZoneSeries -> Text -> UTCTime -> DucklingTime makeReftime :: HashMap Text TimeZoneSeries -> Text -> UTCTime -> DucklingTime
makeReftime series tz utcTime = DucklingTime $ ZoneSeriesTime ducklingTime tzs makeReftime series tz utcTime = DucklingTime $ ZoneSeriesTime ducklingTime tzs
where where
tzs = fromMaybe (TimeZoneSeries utc []) $ HashMap.lookup tz series tzs = HashMap.lookupDefault (TimeZoneSeries utc []) tz series
ducklingTime = toUTC $ utcToLocalTime' tzs utcTime ducklingTime = toUTC $ utcToLocalTime' tzs utcTime
-- | Builds a `DucklingTime` for timezone `tz` at current time. -- | Builds a `DucklingTime` for timezone `tz` at current time.