 +    case tag of
 +      0 -> UserTyVar <$> get bh
 +      1 -> KindedTyVar <$> get bh <*> get bh
-+      _ -> panic "Binary HsTyVarBndr.get: unknown tag"
++      _ -> getPanic "HsTyVarBndr"
 +
 +instance (Binary a, Binary b) => Binary (HsConDetails a b) where
 +  put_ bh c = case c of

+    case tag of
+      0 -> HsAppInfix <$> get bh
+      1 -> HsAppPrefix <$> get bh
+      _ -> panic "Binary HsAppType.get: unknown tag"
+
+deriving instance Binary (HsWildCardInfo GhcSe)
+
+instance Binary a => Binary (HsWildCardBndrs GhcSe a) where
+  put_ bh w = case w of
+    HsWC a b -> putByte bh 0 >> put_ bh a >> put_ bh b
+  get bh = do
+    tag <- getByte bh
+    case tag of
+      0 -> HsWC <$> get bh <*> get bh
+      _ -> panic "Binary HsWildCardBndrs.get: unknown tag"
+
+instance Binary a => Binary (HsImplicitBndrs GhcSe a) where
+  put_ bh b = case b of
+    HsIB a b c -> putByte bh 0 >> put_ bh a >> put_ bh b >> put_ bh c
+  get bh = do
+    tag <- getByte bh
+    case tag of
+      0 -> HsIB <$> get bh <*> get bh <*> get bh
+      _ -> panic "Binary HsImplicitBndrs.get: unknown tag"
+
+instance Binary Promoted where
+  put_ bh p = putByte bh (case p of

+    Orig mod occn -> do
+      -- TODO: introduce some caching here, to avoid doing the
+      --       searchPackageId dance too often.
+
+      {- liftIO . putStrLn $
+        "/!!!\\ Processing name: module=" ++ moduleNameString (moduleName mod) ++
+        ", occname = " ++ occNameString occn -}
+      currentMod <- liftRn getModule
+      {- liftIO . putStrLn $
+        "Current module (" ++ moduleNameString (moduleName currentMod) ++ ") is in: " ++
+        unitIdString (moduleUnitId currentMod) -}
+
+      if samePackages currentMod mod
+        then let newMod = mod { moduleUnitId = moduleUnitId currentMod } in
+               -- liftIO $ putStrLn ("using the current module's unit id for name coming from: " ++ moduleNameString (moduleName mod)) >>
+               pure (Orig newMod occn)
+        else do mnewmod <- liftRn (findEquivalentModule mod)
+                case mnewmod of
+                  Nothing   -> {- liftIO (putStrLn "keeping old name")
+                            >> -} pure (Orig mod occn)
+                  Just mod' -> {- liftIO (putStrLn "using new unitid!")
+                            >> -} pure (Orig mod' occn)
+
+    _             -> pure n
+
+    where samePackages mod1 mod2 = fromMaybe False $ do -- maybe monad
+            let str1 = unitIdString (moduleUnitId mod1)
+                str2 = unitIdString (moduleUnitId mod2)
+            (pkg1, ver1, _mhash1) <- parseUnitId' str1
