Home > Net >  I am trying to run cabal build, and I get the following error
I am trying to run cabal build, and I get the following error

Time:10-18

Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
 - csound-expression-dynamic-0.3.8 (lib) (requires build)
 - csound-expression-typed-0.2.7 (lib) (requires build)
 - csound-expression-opcodes-0.0.5.1 (lib) (requires build)
 - csound-expression-5.3.4 (lib) (requires build)
 - csound-sampler-0.0.10.0 (lib) (requires build)
 - csound-catalog-0.7.4 (lib) (requires build)
 - solve-0.2.0.0 (exe:solve) (first run)
Starting     csound-expression-dynamic-0.3.8 (lib)
Building     csound-expression-dynamic-0.3.8 (lib)

Failed to build csound-expression-dynamic-0.3.8.
Build log (
C:\Users\Shiro\AppData\Roaming\cabal\logs\ghc-9.0.1\csound-expres_-0.3.8-3e9f98bb37e846ae1dd789bc6c80c4d50504a214.log
):
Preprocessing library for csound-expression-dynamic-0.3.8..
Building library for csound-expression-dynamic-0.3.8..
[ 1 of 15] Compiling Csound.Dynamic.Tfm.DeduceTypes ( src\Csound\Dynamic\Tfm\DeduceTypes.hs, dist\build\Csound\Dynamic\Tfm\DeduceTypes.o )
[ 2 of 15] Compiling Csound.Dynamic.Tfm.UnfoldMultiOuts ( src\Csound\Dynamic\Tfm\UnfoldMultiOuts.hs, dist\build\Csound\Dynamic\Tfm\UnfoldMultiOuts.o )
[ 3 of 15] Compiling Csound.Dynamic.Types.Exp ( src\Csound\Dynamic\Types\Exp.hs, dist\build\Csound\Dynamic\Types\Exp.o )

src\Csound\Dynamic\Types\Exp.hs:202:66: error:
    * No instance for (Data.Functor.Classes.Eq1 RatedExp)
        arising from a use of `=='
    * In the second argument of `(&&)', namely
        `(ratedExpExp re == EmptyExp)'
      In the expression:
        isNothing (ratedExpDepends re) && (ratedExpExp re == EmptyExp)
      In an equation for `isEmptyExp':
          isEmptyExp e
            = isNothing (ratedExpDepends re) && (ratedExpExp re == EmptyExp)
            where
                re = unFix e
    |
202 | isEmptyExp e = isNothing (ratedExpDepends re) && (ratedExpExp re == EmptyExp)
    |                                                                  ^^
cabal.exe: Failed to build csound-expression-dynamic-0.3.8 (which is required
by exe:solve from solve-0.2.0.0). See the build log above for details.

This my first time touching Haskell and Cabal. So, from what I understand, I need solve.exe, which needs csound-expression-dynamic-0.3.8, which needs something else. How do I get it to work?

CodePudding user response:

It seems csound-expression-dynamic is not yet compatible with GHC 9.0.1. Try GHC 8.10.7, which is still the recommended version for general use.

I've opened an issue about this on their GitHub page: https://github.com/spell-music/csound-expression-dynamic/issues/2.

CodePudding user response:

The problem is that ratedExpExp re == EmptyExp was earlier in the file than $(deriveEq1 ''RatedExp) was. GHC 9.0.1's release notes say this:

  • Breaking change: Template Haskell splices now act as separation points between constraint solving passes. It is no longer possible to use an instance of a class before a splice and define that instance after a splice. For example, this code now reports a missing instance for C Bool:

    class C a where foo :: a
    bar :: Bool
    bar = foo
    $(return [])
    instance C Bool where foo = True
    

That can be fixed by moving the isEmptyExp method to after the $(deriveEq1 ''RatedExp) splice. Once you do that, you'll run into another error about a duplicate instance. That can be fixed by by wrapping instance Hashable1 IM.IntMap inside of a #if !MIN_VERSION_hashable(1,3,4), after which it will compile fine on GHC 9.0.1. I opened https://github.com/spell-music/csound-expression-dynamic/pull/3 to make these changes upstream, but until they're accepted, you can make them manually to get it to build.

  • Related