otakar-smrz/elixir-fm

Haskell: Data.Map.foldWithKey is gone. Use foldrWithKey

tomas-hartman opened this issue · 0 comments

I encounter following error when compiling Haskell code with newer compilers

Data.Map.foldWithKey is gone. Use foldrWithKey.

I am not particularly experienced with Haskell, but if the only change is to replace foldWithKey with foldrWithKey as it suggests, I can open a PR for that.

Full log:

#12 449.9 [107 of 115] Compiling Elixir.Data.Moony ( Elixir/Data/Moony.hs, dist/build/elixir/elixir-tmp/Elixir/Data/Moony.o )
#12 449.9 [108 of 115] Compiling Elixir.Data.Extra ( Elixir/Data/Extra.hs, dist/build/elixir/elixir-tmp/Elixir/Data/Extra.o )
#12 449.9 [109 of 115] Compiling Elixir.Data      ( Elixir/Data.hs, dist/build/elixir/elixir-tmp/Elixir/Data.o )
#12 449.9 [110 of 115] Compiling Elixir.Inflect   ( Elixir/Inflect.hs, dist/build/elixir/elixir-tmp/Elixir/Inflect.o )
#12 449.9 [111 of 115] Compiling Elixir.Lookup    ( Elixir/Lookup.hs, dist/build/elixir/elixir-tmp/Elixir/Lookup.o )
#12 449.9 
#12 449.9 Elixir/Lookup.hs:36:10: warning: [-Wsimplifiable-class-constraints]
#12 449.9     • The constraint ‘Pretty [Clips]’ matches
#12 449.9         instance Pretty a => Pretty [a]
#12 449.9           -- Defined in ‘Text.PrettyPrint.Leijen’
#12 449.9       This makes type inference for inner bindings fragile;
#12 449.9         either use MonoLocalBinds, or simplify it using the instance
#12 449.9     • In the instance declaration for ‘Pretty (String, [Clips])’
#12 449.9    |
#12 449.9 36 | instance Pretty [Clips] => Pretty (String, [Clips]) where
#12 449.9    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 449.9 [112 of 115] Compiling Elixir.Compose   ( Elixir/Compose.hs, dist/build/elixir/elixir-tmp/Elixir/Compose.o )
#12 449.9 [113 of 115] Compiling Elixir.Resolve   ( Elixir/Resolve.hs, dist/build/elixir/elixir-tmp/Elixir/Resolve.o )
#12 449.9 
#12 449.9 Elixir/Resolve.hs:351:39: error:
#12 449.9     • Data.Map.foldWithKey is gone. Use foldrWithKey.
#12 449.9     • In the first argument of ‘(.)’, namely
#12 449.9         ‘Map.foldWithKey
#12 449.9            (\ k x y -> (k, [foldl (flip ((:) . wrap)) [] x]) : y) []’
#12 449.9       In the expression:
#12 449.9         Map.foldWithKey
#12 449.9           (\ k x y -> (k, [foldl (flip ((:) . wrap)) [] x]) : y) []
#12 449.9           . Map.fromListWith (++)
#12 449.9       In the expression:
#12 449.9         (Map.foldWithKey
#12 449.9            (\ k x y -> (k, [foldl (flip ((:) . wrap)) [] x]) : y) []
#12 449.9            . Map.fromListWith (++))
#12 449.9           [(concat d, [Token (l, (n, m)) i t]) |
#12 449.9              (t, h) <- inflect l x,
#12 449.9              i <- h,
#12 449.9              let u = (units . uncurry merge) i,
#12 449.9              d <- y,
#12 449.9              u `q` d]
#12 449.9     |
#12 449.9 351 |                                 z <- (Map.foldWithKey (\ k x y -> (k, [foldl (flip ((:) . wrap)) [] x]) : y) []
#12 449.9     |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 449.9 
#12 449.9 Elixir/Resolve.hs:621:39: error:
#12 449.9     • Data.Map.foldWithKey is gone. Use foldrWithKey.
#12 449.9     • In the first argument of ‘(.)’, namely
#12 449.9         ‘Map.foldWithKey
#12 449.9            (\ k x y -> (k, [foldl (flip ((:) . wrap)) [] x]) : y) []’
#12 449.9       In the expression:
#12 449.9         Map.foldWithKey
#12 449.9           (\ k x y -> (k, [foldl (flip ((:) . wrap)) [] x]) : y) []
#12 449.9           . Map.fromListWith (++)
#12 449.9       In the expression:
#12 449.9         (Map.foldWithKey
#12 449.9            (\ k x y -> (k, [foldl (flip ((:) . wrap)) [] x]) : y) []
#12 449.9            . Map.fromListWith (++))
#12 449.9           [(concat d, [Token (l, (n, m)) i t]) |
#12 449.9              (t, h) <- inflect l x,
#12 449.9              i <- h,
#12 449.9              let f = uncurry merge i,
#12 449.9              let v = units f,
#12 449.9              let u = (units . c) f,
#12 449.9              (d, w) <- y,
#12 449.9              isSubsumed (flip b) approx w v,
#12 449.9              u `q` d]
#12 449.9     |
#12 449.9 621 |                                 z <- (Map.foldWithKey (\ k x y -> (k, [foldl (flip ((:) . wrap)) [] x]) : y) []
#12 449.9     |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#12 449.9 cabal: Failed to build ElixirFM-1.2.2. See the build log above for details.
#12 449.9 
------
executor failed running [/bin/sh -c cabal install]: exit code: 1