haskell / aeson

A fast Haskell JSON library
Other
1.25k stars 321 forks source link

Prepare for change of Data.Text.Array to type synonym (Support text-2.1) #1055

Closed TeofilC closed 12 months ago

TeofilC commented 1 year ago

In an upcoming version of text, Array will become a type synonym for Data.Array.Byte.ByteArray, which means that importing its constructors will no longer bring the ByteArray constructor into scope.

This change gives a backwards compatible way to avoid the build failing when that change happens.

Bodigrim commented 1 year ago

text-2.1 is out now: https://hackage.haskell.org/package/text-2.1/docs/Data-Text-Array.html

TeofilC commented 1 year ago

I've added a commit to relax the text bounds to allow 2.1

andreasabel commented 1 year ago

I reported the CI timeout here:

andreasabel commented 1 year ago

@phadej : Would it be possible to release this patch now?

That would help me testing text-2.1 using a Haskell CI constraint set, in projects that also use aeson.
I tried this:

constraint-set text-2.1
  ghc: >= 8.2
  constraints: text ^>= 2.1
  tests: True
  run-tests: True

raw-project
  allow-newer: text

But it fails because allow-newer: aeson:text is causing a build failure of aeson: https://github.com/haskell-hvr/microaeson/actions/runs/6034329194/job/16372500106?pr=14

phadej commented 1 year ago

@phadej : Would it be possible to release this patch now?

I don't see any urgency. GHC-9.8 will come soon (this month, i.e. September) with plenty of major version bumps, also there's tasty-1.5 coming, and maybe something else (I haven't checked if GHC-9.8 changes will cause cascade effect somewhere, as GHC-9.6 did with bifunctors e.g.). I have no time too spend too early on that kind of work.

AFAICT, text-2.1 becomes relevant only when GHC-9.8 is released, so I'll wait until then.

Yes, there are alpha releases so we can test stuff before actual release, but the latest GHC-9.8.1-alpha3 doesn't even have text-2.1 in it, nor bytestring-0.12 (will it even be included?), also Cabal is still at development 3.11 version. So these alpha-previews feel to be quite far away from release-quality, so I don't spend time on testing with them too much. (I would if they included some new feature I'm interested in, but these are not relevant for aeson)

TeofilC commented 1 year ago

Another alternative for testing things before 9.8 is released should be head.hackage. This patch should also be there. Not sure if haskell-ci supports that though

phadej commented 1 year ago

Another alternative for testing things before 9.8 is released should be head.hackage. This patch should also be there. Not sure if haskell-ci supports that though

It does.

Bodigrim commented 1 year ago

(AFAICT GHC 9.8 will ship with bytestring-0.11, and an upgrade to bytestring-0.12 is postponed until GHC 9.10)

phadej commented 1 year ago

(AFAICT GHC 9.8 will ship with bytestring-0.11, and an upgrade to bytestring-0.12 is postponed until GHC 9.10)

That's silly. The most visible breaking change in bytestring-0.12 and text-2.1 are the same one: Data.Array.Byte stuff.

Bodigrim commented 1 year ago

@phadej not me calling the shots on this.

phadej commented 1 year ago

I opened a GHC issue https://gitlab.haskell.org/ghc/ghc/-/issues/23926

phadej commented 1 year ago

@phadej not me calling the shots on this.

@Bodigrim, you say you don't, but you do: https://github.com/haskell/text/issues/532#issuecomment-1658988764

Bodigrim commented 1 year ago

@phadej not me calling the shots on this.

@Bodigrim, you say you don't, but you do: haskell/text#532 (comment)

If GHC developers prefer to stick to an older release for whatever reason, it's entirely up to them. Equally, it's entirely up to me whether to spend my unpaid time on backports and/or get grumpy about unplanned work.

andreasabel commented 1 year ago

@phadej: With the GHC 9.8.1 RC1 out, may I renew my request to release this patch please?

This would make it so much easier to test text-2.1 on various GHCs, see e.g. my recent breakage of a constraint-set at https://github.com/haskell-hvr/http-io-streams/actions/runs/6352652447/job/17255929726 .

New facts are: GHC 9.8 will be released both with bytestring-0.12 and text-2.1, see https://downloads.haskell.org/ghc/9.8.1-alpha4/docs/users_guide/9.8.1-notes.html#included-libraries.

TeofilC commented 12 months ago

Thanks!

phadej commented 12 months ago

https://hackage.haskell.org/package/aeson-2.2.1.0 is on Hackage

andreasabel commented 12 months ago

Great thanks!

Would be excellent if you could you also release attoparsec-aeson-2.2.1.0 to address the issue there:

Building library for attoparsec-aeson-2.2.0.0...
...
[2 of 5] Compiling Data.Aeson.Internal.Text ( src/Data/Aeson/Internal/Text.hs, dist/build/Data/Aeson/Internal/Text.o, dist/build/Data/Aeson/Internal/Text.dyn_o )

src/Data/Aeson/Internal/Text.hs:30:50: error: [GHC-88464]
    Data constructor not in scope:
      ByteArray :: ghc-prim-0.11.0:GHC.Prim.ByteArray# -> Array
    Suggested fix:
      Add ‘ByteArray’ to the import list in the import of
      ‘Data.Text.Array’ (at src/Data/Aeson/Internal/Text.hs:11:1-60).
   |
30 |   let !(SBS.SBS arr) = SBS.toShort bs in T.Text (ByteArray arr) 0 len
   |