agrafix / superrecord

Haskell: Supercharged anonymous records
BSD 3-Clause "New" or "Revised" License
83 stars 16 forks source link

Update to GHC 9 and aeson 2 #32

Closed Profpatsch closed 2 years ago

Profpatsch commented 2 years ago

This is a small update I made so we can use superrecord with GHC 9 and aeson 2.

See commit messages, might not be up to standard with this project’s guidelines (e.g. CI needs to be adjusted I guess, and older GHCs might not like the Type change).

Profpatsch commented 2 years ago

Beware that there is a regression in the Variant tests:

Failures:

  test/Spec.hs:151:15:
  1) Variants parses from JSON
superrecord-test: Prelude.undefined
CallStack (from HasCallStack):
  error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
  undefined, called at src/SuperRecord/Variant.hs:126:26 in superrecord-0.5.1.0-inplace:SuperRecord.Variant

We are not using Variants, so I’m ignoring that for now.

Profpatsch commented 2 years ago

Oh, I also think the second commit is not valid, simply replacing every * with Type will make Has not work anymore:

     Rec.Has "firstDay" req Time.Day

leads to the error

• Expected kind ‘[*]’,
    but ‘"firstDay"’ has kind ‘ghc-prim-0.7.0:GHC.Types.Symbol’
…

So I’m guessing it is less generic than *, I guess it has to be kind-polymorphic to work.

Profpatsch commented 2 years ago

Nvm, apparently the Has constraint flipped the second and third argument, which is why I got this error.

Profpatsch commented 2 years ago

Superseded by #35