@@ -2089,19 +2089,19 @@ elabInstance info syn what fc cs n ps t expn ds = do
2090 -- Bring variables in instance head into scope
2090 -- Bring variables in instance head into scope
2091 ist <- getIState
2091 ist <- getIState
2092− let headVars = mapMaybe (\p -> case p of
2092+ let headVars = nub $ mapMaybe (\p -> case p of
2093− PRef _ n ->
2093+ PRef _ n ->
2094− case lookupTy n (tt_ctxt ist) of
2094+ case lookupTy n (tt_ctxt ist) of
2095− [] -> Just n
2095+ [] -> Just n
2096− _ -> Nothing
2096+ _ -> Nothing
2097− _ -> Nothing) ps
2097+ _ -> Nothing) ps
2098-- let lhs = PRef fc iname
2098-- let lhs = PRef fc iname
2099 let lhs = PApp fc (PRef fc iname)
2099 let lhs = PApp fc (PRef fc iname)
2100 (map (\n -> pimp n (PRef fc n) True) headVars)
2100 (map (\n -> pimp n (PRef fc n) True) headVars)
2101 let rhs = PApp fc (PRef fc (instanceName ci))
2101 let rhs = PApp fc (PRef fc (instanceName ci))
2102 (map (pexp . mkMethApp) mtys)
2102 (map (pexp . mkMethApp) mtys)
2104− logLvl 5 $ "Instance LHS " ++ show lhs
2104+ logLvl 5 $ "Instance LHS " ++ show lhs ++ " " ++ show headVars
2105 logLvl 5 $ "Instance RHS " ++ show rhs
2105 logLvl 5 $ "Instance RHS " ++ show rhs
2107 let idecls = [PClauses fc [Dictionary] iname
2107 let idecls = [PClauses fc [Dictionary] iname