Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Relax UTCTime parser
Browse files Browse the repository at this point in the history
It seems with the newer time package, `reads` is returning more than a
single element tuple,

```
λ> t = "2009-04-15 10:02:06 UTC"
λ> reads @UTCTime t
[(2009-04-15 10:02:06 UTC,""),(2009-04-15 10:02:06 UTC," UTC")]
```

Checking for a first element with no trailing characters gets the tests
passing again.
  • Loading branch information
pbrisbin committed Jan 3, 2023
1 parent 88a1a08 commit fe3d19b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Database/Schema/Migrations/Filesystem.hs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ fieldProcessors = [ ("Created", setTimestamp )
setTimestamp :: FieldProcessor
setTimestamp value m = do
ts <- case readTimestamp value of
((t, ""):_) -> Right t
[(t, _)] -> return t
_ -> fail "expected one valid parse"
return $ m { mTimestamp = Just ts }
Expand Down

0 comments on commit fe3d19b

Please sign in to comment.