Skip to content

Commit

Permalink
Be safe out there
Browse files Browse the repository at this point in the history
  • Loading branch information
The1Penguin committed Jun 26, 2024
1 parent 59d3d28 commit 65dce81
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Model/Linsen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,19 @@ parse day =
>=> (.: "root")
>=> (.: "children")
>=> (\v' ->
(case v' !? 1 of
Nothing -> fail "failed to index into food"
Just v -> pure v) >>=
withObject "Parse day" (
(.: "children")
>=> (\case
Nothing -> fail "Failed to index into food"
Nothing -> fail "Failed to index into richtext"
Just v -> pure v) . headMay
>=> (.: "text")
>=> pure . (== pure day) . parseTime defaultTimeLocale "%d-%m-%Y"
>=> \case
True -> pure v'
False -> pure [])
(v' !! 1))
False -> pure []))
>=> menuParser . (\v' -> if length v' >= 9 then v' else mempty)
)
)
Expand Down

0 comments on commit 65dce81

Please sign in to comment.