-
Notifications
You must be signed in to change notification settings - Fork 33
Aeson-2.x compatibility and fix for new Read(UTCTime) #42
Conversation
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.
63ce108
to
fe3d19b
Compare
Do you mean JSON here, not Yaml? As for why there isn't a There is indeed a record type for |
I guess I meant "processing of Yaml [files, using JSON instances]" You are doing that here, you're just decoding as instance FromJSON Migration where
parseJSON = genericParseJSON options
where
options = -- this is used to say to parse "Depends" for "mDepends", to error on unknown fields, etc
-- Then it's just...
eMigration <- Yaml.decodeFileEither yaml It seems like it's just lost to history why it was done this way (my guess is it had to be with
Yeah, that'll happen. The idiomatic approach for that is to define a new Anyway, I can follow up in a new PR so you can see all this concretely -- now that I know the status quo is not intentional. |
Actually, doing that would resolve both bugs this PR is resolving incidentally and more cleanly. Perhaps I should do that instead? |
I don't have a preference in this case. |
Cool, I opened #43 instead. |
This gets things building and passing with lts-20.05 / GHC-9.2.5
Aeson-2.x compatibility
Relax UTCTime parser
It seems with the newer time package,
reads
is returning more than asingle element tuple,
Checking for a first element with no trailing characters gets the tests
passing again.
Tangential: there seems to be a lot more manual processing of the
Yaml than I'd expect. Why does a Migration file not just have a clear
record type along with a
FromJSON
and then you just decode it(letting aeson handle all error reporting)? Is there some scar tissue and/or
context I'm missing?