haskell-hvr / cassava

A CSV parsing and encoding library optimized for ease of use and high performance
http://hackage.haskell.org/package/cassava
BSD 3-Clause "New" or "Revised" License
222 stars 105 forks source link

Build failure with semigroups-0.18 #172

Open phadej opened 5 years ago

phadej commented 5 years ago
% cabal new-build --constraint=semigroups==0.18 -w ghc-7.10.3 
Resolving dependencies...
Build profile: -w ghc-7.10.3 -O1
In order, the following will be built (use -v for more details):
 - cassava-0.5.1.0 (lib) (first run)
Configuring library for cassava-0.5.1.0..
Preprocessing library for cassava-0.5.1.0..
Building library for cassava-0.5.1.0..
[ 1 of 10] Compiling Data.Csv.Util    ( Data/Csv/Util.hs, /code/other-haskell/cassava/dist-newstyle/build/x86_64-linux/ghc-7.10.3/cassava-0.5.1.0/build/Data/Csv/Util.o )
[ 2 of 10] Compiling Data.Csv.Conversion.Internal ( Data/Csv/Conversion/Internal.hs, /code/other-haskell/cassava/dist-newstyle/build/x86_64-linux/ghc-7.10.3/cassava-0.5.1.0/build/Data/Csv/Conversion/Internal.o )
[ 3 of 10] Compiling Data.Csv.Types   ( Data/Csv/Types.hs, /code/other-haskell/cassava/dist-newstyle/build/x86_64-linux/ghc-7.10.3/cassava-0.5.1.0/build/Data/Csv/Types.o )
[ 4 of 10] Compiling Data.Csv.Parser  ( Data/Csv/Parser.hs, /code/other-haskell/cassava/dist-newstyle/build/x86_64-linux/ghc-7.10.3/cassava-0.5.1.0/build/Data/Csv/Parser.o )
[ 5 of 10] Compiling Data.Csv.Conversion ( Data/Csv/Conversion.hs, /code/other-haskell/cassava/dist-newstyle/build/x86_64-linux/ghc-7.10.3/cassava-0.5.1.0/build/Data/Csv/Conversion.o )
[ 6 of 10] Compiling Data.Csv.Encoding ( Data/Csv/Encoding.hs, /code/other-haskell/cassava/dist-newstyle/build/x86_64-linux/ghc-7.10.3/cassava-0.5.1.0/build/Data/Csv/Encoding.o )
[ 7 of 10] Compiling Data.Csv.Builder ( Data/Csv/Builder.hs, /code/other-haskell/cassava/dist-newstyle/build/x86_64-linux/ghc-7.10.3/cassava-0.5.1.0/build/Data/Csv/Builder.o )
[ 8 of 10] Compiling Data.Csv.Incremental ( Data/Csv/Incremental.hs, /code/other-haskell/cassava/dist-newstyle/build/x86_64-linux/ghc-7.10.3/cassava-0.5.1.0/build/Data/Csv/Incremental.o )

Data/Csv/Incremental.hs:336:51:
    Could not deduce (Semigroup Builder.Builder)
      arising from a use of ‘<>’
    from the context (ToRecord a)
      bound by the type signature for
                 encodeRecord :: ToRecord a => a -> Builder a
      at Data/Csv/Incremental.hs:334:17-44
    In the expression:
      Encoding.encodeRecord qtng delim (toRecord r) <> recordSep useCrLf
    In the second argument of ‘($)’, namely
      ‘\ qtng delim useCrLf
         -> Encoding.encodeRecord qtng delim (toRecord r)
            <> recordSep useCrLf’
    In the expression:
      Builder
      $ \ qtng delim useCrLf
          -> Encoding.encodeRecord qtng delim (toRecord r)
             <> recordSep useCrLf

According to changelog you need semigroups-0.18.2: http://hackage.haskell.org/package/semigroups-0.19/changelog


Also https://github.com/bos/aeson/pull/701 is related, So I'd recommend adding:

  if impl(ghc >= 8.0)
    build-depends: bytestring >= 0.10.8.1

This is somewhat band-aid solution for:

Data/Aeson/Encoding/Builder.hs:87:21: error: • No instance for (Semigroup Builder) arising from a use of ‘<>’

But there aren't better solution: we don't include anything from semigroups on ghc >= 8.0; so semigroups couldn't even in theory provide that instance.

Also a lot of older aeson releases are "broken" because of this, if one downgrades bytestring. Usually no-one does that, except weird automatic QA tools.

hvr commented 5 years ago

...at least cassava-0.5.2 shouldn't be affected by this anymore... but I'll leave this open until we have fixed this completely