@@ -44,6 +44,7 @@ elabType info syn fc opts n ty' = {- let ty' = piBind (params info) ty_in
45 ty' <- implicit syn n ty'
45 ty' <- implicit syn n ty'
46 let ty = addImpl i ty'
46 let ty = addImpl i ty'
47+ logLvl 3 $ show n ++ " pre-type " ++ showImp True ty'
47 logLvl 2 $ show n ++ " type " ++ showImp True ty
48 logLvl 2 $ show n ++ " type " ++ showImp True ty
48 ((ty', defer, is), log) <- tclift $ elaborate ctxt n (Set (UVal 0)) []
49 ((ty', defer, is), log) <- tclift $ elaborate ctxt n (Set (UVal 0)) []
49 (erun fc (build i info False n ty))
50 (erun fc (build i info False n ty))
@@ -112,6 +113,8 @@ elabRecord info syn fc tyn ty cn cty
112 isNonImp (PExp _ _ _, a) = Just a
113 isNonImp (PExp _ _ _, a) = Just a
113 isNonImp _ = Nothing
114 isNonImp _ = Nothing
116+ getImplB k (PPi (Imp l s) n Placeholder sc)
115 getImplB k (PPi (Imp l s) n ty sc)
118 getImplB k (PPi (Imp l s) n ty sc)
116 = getImplB (\x -> k (PPi (Imp l s) n ty x)) sc
119 = getImplB (\x -> k (PPi (Imp l s) n ty x)) sc
117 getImplB k (PPi _ n ty sc)
120 getImplB k (PPi _ n ty sc)
@@ -635,7 +638,16 @@ elabInstance info syn fc cs n ps t ds
635 iLOG ("Defaults inserted: " ++ show ds' ++ "\n" ++ show ci)
638 iLOG ("Defaults inserted: " ++ show ds' ++ "\n" ++ show ci)
636 mapM_ (warnMissing ds' ns) (map fst (class_methods ci))
639 mapM_ (warnMissing ds' ns) (map fst (class_methods ci))
637 let wb = map mkTyDecl mtys ++ map (decorateid (decorate ns)) ds'
640 let wb = map mkTyDecl mtys ++ map (decorateid (decorate ns)) ds'
641+ logLvl 3 $ "Method types " ++ showSep "\n" (map (showDeclImp True . mkTyDecl) mtys)
642+ -- get the implicit parameters that need passing through to the where block
643+ wparams <- mapM (\p -> case p of
644+ PApp _ _ args -> getWParams args
646+ logLvl 3 $ "Instance is " ++ show ps ++ " implicits " ++
647+ show (concat (nub wparams))
648+ let lhs = case concat (nub wparams) of
638− let lhs = PRef fc iname
649+ [] -> PRef fc iname
650+ as -> PApp fc (PRef fc iname) as
639 let rhs = PApp fc (PRef fc (instanceName ci))
651 let rhs = PApp fc (PRef fc (instanceName ci))
640 (map (pexp . mkMethApp) mtys)
652 (map (pexp . mkMethApp) mtys)
641 let idecl = PClauses fc [Inlinable, TCGen] iname
653 let idecl = PClauses fc [Inlinable, TCGen] iname
@@ -659,6 +671,16 @@ elabInstance info syn fc cs n ps t ds
659 papp fc f [] = f
671 papp fc f [] = f
660 papp fc f as = PApp fc f as
672 papp fc f as = PApp fc f as
674+ getWParams [] = return []
676+ | PRef _ n <- getTm p
677+ = do ps' <- getWParams ps
679+ case lookupP Nothing n ctxt of
680+ [] -> return (pimp n (PRef fc n) : ps')
682+ getWParams (_ : ps) = getWParams ps
662 decorate ns (UN n) = NS (UN ('!':n)) ns
684 decorate ns (UN n) = NS (UN ('!':n)) ns
663 decorate ns (NS (UN n) s) = NS (UN ('!':n)) ns
685 decorate ns (NS (UN n) s) = NS (UN ('!':n)) ns
@@ -761,6 +783,7 @@ elabDecl' info (PDirective i) = i
762elabCaseBlock info d@(PClauses f o n ps)
784elabCaseBlock info d@(PClauses f o n ps)
763 = do addIBC (IBCDef n)
785 = do addIBC (IBCDef n)
786+-- iputStrLn $ "CASE BLOCK: " ++ show (n, d)
764 elabDecl' info d
787 elabDecl' info d
766-- elabDecl' info (PImport i) = loadModule i
789-- elabDecl' info (PImport i) = loadModule i