Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building against GHC 9 / Lens 5 #1694

Merged
merged 2 commits into from Mar 7, 2023
Merged

Fix building against GHC 9 / Lens 5 #1694

merged 2 commits into from Mar 7, 2023

Commits on Mar 6, 2023

  1. Fix building against GHC 9 / Lens 5

    It looks like something in the GHC 9 / Lens 5 combination yields
    unexpected results when using view on Lens', with GHC complaining that
    it's passed a Lens' instead of a Getting (which should still be
    compatible).  Commenting out the signatures of Ganeti.Network.poolLens,
    Ganeti.Network.poolArrayLens and Ganeti.Utils.MultiMap.multiMapL makes
    Ganeti build again, so I'd keep this ugly hack until we figure out
    what's actually wrong.
    
    Signed-off-by: Apollon Oikonomopoulos <apoikos@dmesg.gr>
    apoikos committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    b1350ba View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2023

  1. Reorder Arbitrary instance definitions

    Citing the GHC 9.0.1 changelog[1]:
    
      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
        ```
    
    In other words, code order matters in Template Haskell files, which
    breaks the Haskell test build with GHC >= 9.0.1. Fix this by reordering
    various Arbitrary instances so that they are defined before being used.
    
    Also the Arbitrary instance for IAllocatorParams was silently acting as
    a generic instance for (Container JSValue), providing instances for
    DiskParams, HypervisorState and DiskState as well. Change the Arbitrary
    instance declaration to Arbitrary (Container JSValue) to better reflect
    its generic purpose.
    
    [1] https://downloads.haskell.org/ghc/9.0.1/docs/html/users_guide/9.0.1-notes.html#highlights
    
    Signed-off-by: Apollon Oikonomopoulos <apoikos@dmesg.gr>
    apoikos committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    c295246 View commit details
    Browse the repository at this point in the history