Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
apoikos committed Mar 7, 2023
1 parent 4f8d61e commit 5e30bad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Ganeti/Network.hs
Expand Up @@ -87,11 +87,11 @@ data PoolPart = PoolInstances | PoolExt
addressPoolIso :: Iso' AddressPool BA.BitArray
addressPoolIso = iso apReservations AddressPool

poolLens :: PoolPart -> Lens' Network (Maybe AddressPool)
--poolLens :: PoolPart -> Lens' Network (Maybe AddressPool)
poolLens PoolInstances = networkReservationsL
poolLens PoolExt = networkExtReservationsL

poolArrayLens :: PoolPart -> Lens' Network (Maybe BA.BitArray)
--poolArrayLens :: PoolPart -> Lens' Network (Maybe BA.BitArray)
poolArrayLens part = poolLens part . mapping addressPoolIso

netIpv4NumHosts :: Network -> Integer
Expand Down
2 changes: 1 addition & 1 deletion src/Ganeti/Utils/MultiMap.hs
Expand Up @@ -91,7 +91,7 @@ multiMap :: (Ord k, Ord v) => M.Map k (S.Set v) -> MultiMap k v
multiMap = MultiMap . M.filter (not . S.null)

-- | A 'Lens' that allows to access a set under a given key in a multi-map.
multiMapL :: (Ord k, Ord v) => k -> Lens' (MultiMap k v) (S.Set v)
--multiMapL :: (Ord k, Ord v) => k -> Lens' (MultiMap k v) (S.Set v)
multiMapL k f = fmap MultiMap
. at k (fmap (mfilter (not . S.null) . Just)
. f . fromMaybe S.empty)
Expand Down

0 comments on commit 5e30bad

Please sign in to comment.