haskell-nix / hnix

A Haskell re-implementation of the Nix expression language
https://hackage.haskell.org/package/hnix
BSD 3-Clause "New" or "Revised" License
741 stars 114 forks source link

Compatibility with GHC 9.2 #1076

Closed sjakobi closed 1 year ago

sjakobi commented 1 year ago

For hnix-0.16, I'm already getting pretty far with this build command:

$ cabal install hnix -w ghc-9.2 --constraint 'hnix >= 0.14' --allow-newer=hnix:template-haskell,hnix:base,hnix:relude,hnix:hnix-store-core,hnix:hnix-store-remote
Failed to build hnix-0.16.0.
Build log (
/home/simon/.cabal/logs/ghc-9.2.3/hnix-0.16.0-592f1775adaf6de9d608abdcc54ff03686a1a417c5b9ee9527030aec8e7c879f.log
):
Configuring library for hnix-0.16.0..
Preprocessing library for hnix-0.16.0..
Building library for hnix-0.16.0..
[ 1 of 52] Compiling Nix.Utils        ( src/Nix/Utils.hs, dist/build/Nix/Utils.o, dist/build/Nix/Utils.dyn_o )
[ 2 of 52] Compiling Nix.Prelude      ( src/Nix/Prelude.hs, dist/build/Nix/Prelude.o, dist/build/Nix/Prelude.dyn_o )
[ 3 of 52] Compiling Nix.Unused       ( src/Nix/Unused.hs, dist/build/Nix/Unused.o, dist/build/Nix/Unused.dyn_o )
[ 4 of 52] Compiling Nix.Thunk        ( src/Nix/Thunk.hs, dist/build/Nix/Thunk.o, dist/build/Nix/Thunk.dyn_o )
[ 5 of 52] Compiling Nix.Thunk.Basic  ( src/Nix/Thunk/Basic.hs, dist/build/Nix/Thunk/Basic.o, dist/build/Nix/Thunk/Basic.dyn_o )
[ 6 of 52] Compiling Nix.Options      ( src/Nix/Options.hs, dist/build/Nix/Options.o, dist/build/Nix/Options.dyn_o )
[ 7 of 52] Compiling Nix.Fresh        ( src/Nix/Fresh.hs, dist/build/Nix/Fresh.o, dist/build/Nix/Fresh.dyn_o )
[ 8 of 52] Compiling Nix.Frames       ( src/Nix/Frames.hs, dist/build/Nix/Frames.o, dist/build/Nix/Frames.dyn_o )
[ 9 of 52] Compiling Nix.Atoms        ( src/Nix/Atoms.hs, dist/build/Nix/Atoms.o, dist/build/Nix/Atoms.dyn_o )
[10 of 52] Compiling Nix.Expr.Types   ( src/Nix/Expr/Types.hs, dist/build/Nix/Expr/Types.o, dist/build/Nix/Expr/Types.dyn_o )

src/Nix/Expr/Types.hs:733:14: warning: [-Wincomplete-uni-patterns]
    Pattern match(es) are non-exhaustive
    In a lambda abstraction:
        Patterns of type ‘[VarName]’ not matched: []
    |
733 |             (\ (j : js) ->
    |              ^^^^^^^^^^^^^...
[11 of 52] Compiling Nix.Type.Type    ( src/Nix/Type/Type.hs, dist/build/Nix/Type/Type.o, dist/build/Nix/Type/Type.dyn_o )
[12 of 52] Compiling Nix.Type.Env     ( src/Nix/Type/Env.hs, dist/build/Nix/Type/Env.o, dist/build/Nix/Type/Env.dyn_o )
[13 of 52] Compiling Nix.Type.Assumption ( src/Nix/Type/Assumption.hs, dist/build/Nix/Type/Assumption.o, dist/build/Nix/Type/Assumption.dyn_o )
[14 of 52] Compiling Nix.String       ( src/Nix/String.hs, dist/build/Nix/String.o, dist/build/Nix/String.dyn_o )
[15 of 52] Compiling Nix.Scope        ( src/Nix/Scope.hs, dist/build/Nix/Scope.o, dist/build/Nix/Scope.dyn_o )
[16 of 52] Compiling Nix.Expr.Types.Annotated ( src/Nix/Expr/Types/Annotated.hs, dist/build/Nix/Expr/Types/Annotated.o, dist/build/Nix/Expr/Types/Annotated.dyn_o )
[17 of 52] Compiling Nix.Context      ( src/Nix/Context.hs, dist/build/Nix/Context.o, dist/build/Nix/Context.dyn_o )
[18 of 52] Compiling Nix.Cache        ( src/Nix/Cache.hs, dist/build/Nix/Cache.o, dist/build/Nix/Cache.dyn_o )
[19 of 52] Compiling Nix.Expr.Strings ( src/Nix/Expr/Strings.hs, dist/build/Nix/Expr/Strings.o, dist/build/Nix/Expr/Strings.dyn_o )

src/Nix/Expr/Strings.hs:48:5: warning: [-Wincomplete-uni-patterns]
    Pattern match(es) are non-exhaustive
    In a pattern binding: Patterns of type ‘[Text]’ not matched: []
   |
48 |     (l : ls) = T.split (== '\n') t
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[20 of 52] Compiling Nix.Expr.Shorthands ( src/Nix/Expr/Shorthands.hs, dist/build/Nix/Expr/Shorthands.o, dist/build/Nix/Expr/Shorthands.dyn_o )
[21 of 52] Compiling Nix.Expr         ( src/Nix/Expr.hs, dist/build/Nix/Expr.o, dist/build/Nix/Expr.dyn_o )
[22 of 52] Compiling Nix.Utils.Fix1   ( src/Nix/Utils/Fix1.hs, dist/build/Nix/Utils/Fix1.o, dist/build/Nix/Utils/Fix1.dyn_o )
[23 of 52] Compiling Nix.Render       ( src/Nix/Render.hs, dist/build/Nix/Render.o, dist/build/Nix/Render.dyn_o )
[24 of 52] Compiling Nix.Parser       ( src/Nix/Parser.hs, dist/build/Nix/Parser.o, dist/build/Nix/Parser.dyn_o )
[25 of 52] Compiling Nix.TH           ( src/Nix/TH.hs, dist/build/Nix/TH.o, dist/build/Nix/TH.dyn_o )
[26 of 52] Compiling Nix.Value        ( src/Nix/Value.hs, dist/build/Nix/Value.o, dist/build/Nix/Value.dyn_o )
[27 of 52] Compiling Nix.Cited        ( src/Nix/Cited.hs, dist/build/Nix/Cited.o, dist/build/Nix/Cited.dyn_o )
[28 of 52] Compiling Nix.Normal       ( src/Nix/Normal.hs, dist/build/Nix/Normal.o, dist/build/Nix/Normal.dyn_o )

src/Nix/Normal.hs:168:3: warning: [-Wincomplete-uni-patterns]
    Pattern match(es) are non-exhaustive
    In a pattern binding:
        Patterns of type ‘Free (NValue' t f m) t’ not matched: Pure _
    |
168 |   Free (NValue' cyc) = opaqueVal
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[29 of 52] Compiling Nix.Pretty       ( src/Nix/Pretty.hs, dist/build/Nix/Pretty.o, dist/build/Nix/Pretty.dyn_o )
[30 of 52] Compiling Nix.Value.Equal  ( src/Nix/Value/Equal.hs, dist/build/Nix/Value/Equal.o, dist/build/Nix/Value/Equal.dyn_o )
[31 of 52] Compiling Nix.Value.Monad  ( src/Nix/Value/Monad.hs, dist/build/Nix/Value/Monad.o, dist/build/Nix/Value/Monad.dyn_o )
[32 of 52] Compiling Nix.Var          ( src/Nix/Var.hs, dist/build/Nix/Var.o, dist/build/Nix/Var.dyn_o )
[33 of 52] Compiling Nix.XML          ( src/Nix/XML.hs, dist/build/Nix/XML.o, dist/build/Nix/XML.dyn_o )
[34 of 52] Compiling Paths_hnix       ( dist/build/autogen/Paths_hnix.hs, dist/build/Paths_hnix.o, dist/build/Paths_hnix.dyn_o )
[35 of 52] Compiling Nix.Options.Parser ( src/Nix/Options/Parser.hs, dist/build/Nix/Options/Parser.o, dist/build/Nix/Options/Parser.dyn_o )
[36 of 52] Compiling Nix.Effects      ( src/Nix/Effects.hs, dist/build/Nix/Effects.o, dist/build/Nix/Effects.dyn_o )

src/Nix/Effects.hs:401:42: error:
    • Couldn't match expected type: RepairFlag
                                    -> Store.Remote.MonadStore Store.StorePath
                  with actual type: ExceptT
                                      String
                                      (StateT
                                         (Maybe Data.ByteString.Lazy.Internal.ByteString,
                                          [Store.Remote.Logger])
                                         (ReaderT Store.Remote.StoreConfig IO))
                                      Store.StorePath
    • The function ‘Store.Remote.addToStore’
      is applied to five value arguments,
        but its type ‘Store.StorePathName
                      -> System.Nix.Internal.Nar.Streamer.NarSource
                           Store.Remote.MonadStore
                      -> Bool
                      -> System.Nix.Store.Remote.RepairFlag
                      -> ExceptT
                           String
                           (StateT
                              (Maybe Data.ByteString.Lazy.Internal.ByteString,
                               [Store.Remote.Logger])
                              (ReaderT Store.Remote.StoreConfig IO))
                           Store.StorePath’
        has only four
      In the second argument of ‘($)’, namely
        ‘Store.Remote.addToStore
           @Hash.SHA256 pathName (coerce path) recursive (const False) repair’
      In a stmt of a 'do' block:
        res <- Store.Remote.runStore
                 $ Store.Remote.addToStore
                     @Hash.SHA256 pathName (coerce path) recursive (const False) repair
    |
401 |           res <- Store.Remote.runStore $ Store.Remote.addToStore @Hash.SHA256 pathName (coerce path) recursive (const False) repair
    |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Nix/Effects.hs:401:113: error:
    • Couldn't match type ‘b0 -> Bool’ with ‘Bool’
      Expected: System.Nix.Store.Remote.RepairFlag
        Actual: b0 -> Bool
    • Probable cause: ‘const’ is applied to too few arguments
      In the fifth argument of ‘Store.Remote.addToStore’, namely
        ‘(const False)’
      In the second argument of ‘($)’, namely
        ‘Store.Remote.addToStore
           @Hash.SHA256 pathName (coerce path) recursive (const False) repair’
      In a stmt of a 'do' block:
        res <- Store.Remote.runStore
                 $ Store.Remote.addToStore
                     @Hash.SHA256 pathName (coerce path) recursive (const False) repair
    |
401 |           res <- Store.Remote.runStore $ Store.Remote.addToStore @Hash.SHA256 pathName (coerce path) recursive (const False) repair
    |                                                                                                                 ^^^^^^^^^^^
Error: cabal: Failed to build hnix-0.16.0

So the main thing that seems to be missing is a compatibility fix for hnix-store-remote-0.6.

sjakobi commented 1 year ago

Fixed by #1081.