hindent icon indicating copy to clipboard operation
hindent copied to clipboard

Unable to install with GHC 8.6.5 cabal: 2.4.1.0 "Not in scope: data constructor `ClassA'" because of haskell-src-exts 1.22 update

Open yeputons opened this issue 5 years ago • 1 comments

Problem

Description of problem here.

  • [x] I checked the issue tracker for existing issues about this problem.
  • [x] I'm using the latest version of hindent.

I'm running Haskell Platform Core 8.6.5 x64 on Windows (ghc 8.6.5, cabal 2.4.1.0) and cabal install hindent fails to build Hindent (as well as v2-install). I've deleted irrelevant username for the log:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>cabal install hindent
Warning: The install command is a part of the legacy v1 style of cabal usage.

Please switch to using either the new project style and the new-install
command or the legacy v1-install alias as new-style projects will become the
default in the next version of cabal-install. Please file a bug if you cannot
replicate a working v1- use case with the new-style commands.

For more information, see: https://wiki.haskell.org/Cabal/NewBuild

Resolving dependencies...
Starting     dlist-0.8.0.7
Starting     base-orphans-0.8.1
Starting     exceptions-0.10.4
Starting     hashable-1.3.0.0
Starting     colour-2.3.5
Starting     integer-logarithms-1.0.3
Starting     base-compat-0.11.0
Building     base-orphans-0.8.1
Building     integer-logarithms-1.0.3
Building     hashable-1.3.0.0
Building     colour-2.3.5
Building     dlist-0.8.0.7
Building     exceptions-0.10.4
Building     base-compat-0.11.0
Completed    base-orphans-0.8.1
Starting     mintty-0.1.2
Completed    dlist-0.8.0.7
Starting     monad-loops-0.4.3
Starting     haskell-src-exts-1.23.0
Completed    integer-logarithms-1.0.3
Starting     primitive-0.7.0.0
Completed    hashable-1.3.0.0
Starting     random-1.1
Building     mintty-0.1.2
Completed    exceptions-0.10.4
Starting     split-0.2.3.3
Building     monad-loops-0.4.3
Completed    colour-2.3.5
Starting     tagged-0.8.6
Building     haskell-src-exts-1.23.0
Building     primitive-0.7.0.0
Completed    mintty-0.1.2
Starting     th-abstraction-0.3.1.0
Building     random-1.1
Completed    monad-loops-0.4.3
Building     split-0.2.3.3
Starting     transformers-compat-0.6.5
Building     tagged-0.8.6
Building     th-abstraction-0.3.1.0
Completed    split-0.2.3.3
Starting     unix-compat-0.5.2
Building     transformers-compat-0.6.5
Completed    random-1.1
Starting     unliftio-core-0.1.2.0
Completed    tagged-0.8.6
Starting     utf8-string-1.0.1.1
Building     unix-compat-0.5.2
Completed    transformers-compat-0.6.5
Starting     time-compat-1.9.2.2
Building     unliftio-core-0.1.2.0
Completed    base-compat-0.11.0
Starting     unordered-containers-0.2.10.0
Building     utf8-string-1.0.1.1
Completed    th-abstraction-0.3.1.0
Starting     ansi-terminal-0.10.2
Completed    primitive-0.7.0.0
Starting     uuid-types-1.0.3
Completed    unliftio-core-0.1.2.0
Starting     temporary-1.3
Building     time-compat-1.9.2.2
Building     unordered-containers-0.2.10.0
Building     ansi-terminal-0.10.2
Building     uuid-types-1.0.3
Completed    utf8-string-1.0.1.1
Starting     vector-0.12.0.3
Building     temporary-1.3
Completed    unix-compat-0.5.2
Starting     scientific-0.3.6.2
Completed    temporary-1.3
Building     vector-0.12.0.3
Starting     resourcet-1.2.2
Completed    uuid-types-1.0.3
Completed    time-compat-1.9.2.2
Building     scientific-0.3.6.2
Building     resourcet-1.2.2
Completed    ansi-terminal-0.10.2
Starting     ansi-wl-pprint-0.6.9
Completed    resourcet-1.2.2
Building     ansi-wl-pprint-0.6.9
Completed    unordered-containers-0.2.10.0
Completed    scientific-0.3.6.2
Starting     attoparsec-0.13.2.3
Completed    ansi-wl-pprint-0.6.9
Starting     optparse-applicative-0.15.1.0
Building     attoparsec-0.13.2.3
Building     optparse-applicative-0.15.1.0
Completed    optparse-applicative-0.15.1.0
Completed    attoparsec-0.13.2.3
Completed    vector-0.12.0.3
Starting     vector-algorithms-0.8.0.3
Starting     aeson-1.4.6.0
Building     vector-algorithms-0.8.0.3
Building     aeson-1.4.6.0
Completed    vector-algorithms-0.8.0.3
Starting     mono-traversable-1.0.15.1
Building     mono-traversable-1.0.15.1
Completed    haskell-src-exts-1.23.0
Completed    mono-traversable-1.0.15.1
Starting     conduit-1.3.1.2
Building     conduit-1.3.1.2
Completed    conduit-1.3.1.2
Starting     libyaml-0.1.1.1
Building     libyaml-0.1.1.1
Completed    libyaml-0.1.1.1
Completed    aeson-1.4.6.0
Starting     path-0.7.0
Starting     yaml-0.11.2.0
Building     path-0.7.0
Building     yaml-0.11.2.0
Completed    path-0.7.0
Starting     path-io-1.6.0
Building     path-io-1.6.0
Completed    yaml-0.11.2.0
Completed    path-io-1.6.0
Starting     hindent-5.3.1
Building     hindent-5.3.1
Failed to install hindent-5.3.1
Build log ( C:\Users\<USERNAME-DELETED>\AppData\Roaming\cabal\logs\ghc-8.6.5\hindent-5.3.
1-8jIRznd7CPo4me3Y31kLV1.log ):
Preprocessing library for hindent-5.3.1..
Building library for hindent-5.3.1..
[1 of 5] Compiling HIndent.CabalFile ( src\HIndent\CabalFile.hs, dist\build\HInd
ent\CabalFile.o )
[2 of 5] Compiling HIndent.CodeBlock ( src\HIndent\CodeBlock.hs, dist\build\HInd
ent\CodeBlock.o )

src\HIndent\CodeBlock.hs:10:1: warning: [-Wunused-imports]
    The import of `Data.Monoid' is redundant
      except perhaps to import instances from `Data.Monoid'
    To import instances alone, use: import Data.Monoid()
   |
10 | import Data.Monoid
   | ^^^^^^^^^^^^^^^^^^
[3 of 5] Compiling HIndent.Types    ( src\HIndent\Types.hs, dist\build\HIndent\T
ypes.o )
[4 of 5] Compiling HIndent.Pretty   ( src\HIndent\Pretty.hs, dist\build\HIndent\
Pretty.o )

src\HIndent\Pretty.hs:982:7: error:
    Not in scope: data constructor `ClassA'
    |
982 |       ClassA _ name types -> spaced (pretty name : map pretty types)
    |       ^^^^^^

src\HIndent\Pretty.hs:983:9: error:
    Not in scope: data constructor `InfixA'
    Perhaps you meant one of these:
      `InfixApp' (imported from Language.Haskell.Exts.Syntax),
      variable `P.infix_' (imported from Language.Haskell.Exts)
    |
983 |       i@InfixA {} -> pretty' i
    |         ^^^^^^

src\HIndent\Pretty.hs:988:7: error:
    Not in scope: data constructor `EqualP'
    Perhaps you meant `P.Equals' (imported from Language.Haskell.Exts)
    |
988 |       EqualP _ a b -> do
    |       ^^^^^^

src\HIndent\Pretty.hs:993:7: error:
    Not in scope: data constructor `AppA'
    Perhaps you meant `App' (imported from Language.Haskell.Exts.Syntax)
    |
993 |       AppA _ name tys ->
    |       ^^^^

src\HIndent\Pretty.hs:995:7: error:
    Not in scope: data constructor `WildCardA'
    Perhaps you meant `PWildCard' (imported from Language.Haskell.Exts.Syntax)
    |
995 |       WildCardA _ name ->
    |       ^^^^^^^^^
cabal: Leaving directory 'F:\Temp\cabal-tmp-9288\hindent-5.3.1'
cabal: Error: some packages failed to install:
hindent-5.3.1-8jIRznd7CPo4me3Y31kLV1 failed during the building phase. The
exception was:
ExitFailure 1


C:\Windows\system32>

This happens because hindent lists haskell-src-exts >= 1.20 as a dependency, but version 1.22 changed Asst and PAsst types (see https://github.com/haskell-suite/haskell-src-exts/pull/441) and even mentions the latter as a breaking change in CHANGELOG.

I'm not sure whether it's better to require exact haskell-src-exts version or to update hindent code.

yeputons avatar Jan 20 '20 11:01 yeputons

Same here.

PS C:\Windows\system32> cabal --version
cabal-install version 2.4.1.0
compiled using version 2.4.1.0 of the Cabal library
PS C:\Windows\system32> ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
PS C:\Windows\system32> cabal install hindent
Warning: The install command is a part of the legacy v1 style of cabal usage.

Please switch to using either the new project style and the new-install
command or the legacy v1-install alias as new-style projects will become the
default in the next version of cabal-install. Please file a bug if you cannot
replicate a working v1- use case with the new-style commands.

For more information, see: https://wiki.haskell.org/Cabal/NewBuild

Resolving dependencies...
Starting     hindent-5.3.1
Building     hindent-5.3.1
Failed to install hindent-5.3.1
Build log ( C:\Users\vladas\AppData\Roaming\cabal\logs\ghc-8.6.5\hindent-5.3.1-2OQryfeJryZ96OYCbQylYl.log ):
Preprocessing library for hindent-5.3.1..
Building library for hindent-5.3.1..
[1 of 5] Compiling HIndent.CabalFile ( src\HIndent\CabalFile.hs, dist\build\HIndent\CabalFile.o )
[2 of 5] Compiling HIndent.CodeBlock ( src\HIndent\CodeBlock.hs, dist\build\HIndent\CodeBlock.o )

src\HIndent\CodeBlock.hs:10:1: warning: [-Wunused-imports]
    The import of `Data.Monoid' is redundant
      except perhaps to import instances from `Data.Monoid'
    To import instances alone, use: import Data.Monoid()
   |
10 | import Data.Monoid
   | ^^^^^^^^^^^^^^^^^^
[3 of 5] Compiling HIndent.Types    ( src\HIndent\Types.hs, dist\build\HIndent\Types.o )
[4 of 5] Compiling HIndent.Pretty   ( src\HIndent\Pretty.hs, dist\build\HIndent\Pretty.o )

src\HIndent\Pretty.hs:982:7: error:
    Not in scope: data constructor `ClassA'
    |
982 |       ClassA _ name types -> spaced (pretty name : map pretty types)
    |       ^^^^^^

src\HIndent\Pretty.hs:983:9: error:
    Not in scope: data constructor `InfixA'
    Perhaps you meant one of these:
      `InfixApp' (imported from Language.Haskell.Exts.Syntax),
      variable `P.infix_' (imported from Language.Haskell.Exts)
    |
983 |       i@InfixA {} -> pretty' i
    |         ^^^^^^

src\HIndent\Pretty.hs:988:7: error:
    Not in scope: data constructor `EqualP'
    Perhaps you meant `P.Equals' (imported from Language.Haskell.Exts)
    |
988 |       EqualP _ a b -> do
    |       ^^^^^^

src\HIndent\Pretty.hs:993:7: error:
    Not in scope: data constructor `AppA'
    Perhaps you meant `App' (imported from Language.Haskell.Exts.Syntax)
    |
993 |       AppA _ name tys ->
    |       ^^^^

src\HIndent\Pretty.hs:995:7: error:
    Not in scope: data constructor `WildCardA'
    Perhaps you meant `PWildCard' (imported from Language.Haskell.Exts.Syntax)
    |
995 |       WildCardA _ name ->
    |       ^^^^^^^^^
cabal: Leaving directory 'C:\Users\vladas\AppData\Local\Temp\cabal-tmp-1292\hindent-5.3.1'
cabal.exe: Error: some packages failed to install:
hindent-5.3.1-2OQryfeJryZ96OYCbQylYl failed during the building phase. The
exception was:
ExitFailure 1

VladasZ avatar Mar 03 '20 12:03 VladasZ

Closing because we no longer use haskell-src-exts.

toku-sa-n avatar Jan 10 '23 00:01 toku-sa-n