@@ -1770,19 +1770,21 @@ elabClass info syn doc fc constraints tn ps ds
1770 toExp ns e sc = sc
1770 toExp ns e sc = sc
1772elabInstance :: ElabInfo -> SyntaxInfo ->
1772elabInstance :: ElabInfo -> SyntaxInfo ->
1773+ ElabWhat -> -- phase
1773 FC -> [PTerm] -> -- constraints
1774 FC -> [PTerm] -> -- constraints
1774 Name -> -- the class
1775 Name -> -- the class
1775 [PTerm] -> -- class parameters (i.e. instance)
1776 [PTerm] -> -- class parameters (i.e. instance)
1776 PTerm -> -- full instance type
1777 PTerm -> -- full instance type
1777 Maybe Name -> -- explicit name
1778 Maybe Name -> -- explicit name
1778 [PDecl] -> Idris ()
1779 [PDecl] -> Idris ()
1779−elabInstance info syn fc cs n ps t expn ds
1780+elabInstance info syn what fc cs n ps t expn ds = do
1780− = do i <- getIState
1781+ i <- getIState
1781− (n, ci) <- case lookupCtxtName n (idris_classes i) of
1782+ (n, ci) <- case lookupCtxtName n (idris_classes i) of
1782− [c] -> return c
1783+ [c] -> return c
1783− _ -> ifail $ show fc ++ ":" ++ show n ++ " is not a type class"
1784+ _ -> ifail $ show fc ++ ":" ++ show n ++ " is not a type class"
1784− let constraint = PApp fc (PRef fc n) (map pexp ps)
1785+ let constraint = PApp fc (PRef fc n) (map pexp ps)
1785− let iname = mkiname n ps expn
1786+ let iname = mkiname n ps expn
1787+ when (what /= EDefns) $ do
1786 nty <- elabType' True info syn "" fc [] iname t
1788 nty <- elabType' True info syn "" fc [] iname t
1787 -- if the instance type matches any of the instances we have already,
1789 -- if the instance type matches any of the instances we have already,
1788 -- and it's not a named instance, then it's overlapping, so report an error
1790 -- and it's not a named instance, then it's overlapping, so report an error
@@ -1791,6 +1793,7 @@ elabInstance info syn fc cs n ps t expn ds
1791 (class_instances ci)
1793 (class_instances ci)
1792 addInstance intInst n iname
1794 addInstance intInst n iname
1793 Just _ -> addInstance intInst n iname
1795 Just _ -> addInstance intInst n iname
1796+ when (what /= ETypes) $ do
1794 let ips = zip (class_params ci) ps
1797 let ips = zip (class_params ci) ps
1795 let ns = case n of
1798 let ns = case n of
1796 NS n ns' -> ns'
1799 NS n ns' -> ns'
@@ -2087,9 +2090,8 @@ elabDecl' what info (PClass doc s f cs n ps ds)
2087 = do iLOG $ "Elaborating class " ++ show n
2090 = do iLOG $ "Elaborating class " ++ show n
2088 elabClass info (s { syn_params = [] }) doc f cs n ps ds
2091 elabClass info (s { syn_params = [] }) doc f cs n ps ds
2089elabDecl' what info (PInstance s f cs n ps t expn ds)
2092elabDecl' what info (PInstance s f cs n ps t expn ds)
2091 = do iLOG $ "Elaborating instance " ++ show n
2093 = do iLOG $ "Elaborating instance " ++ show n
2092− elabInstance info s f cs n ps t expn ds
2094+ elabInstance info s what f cs n ps t expn ds
2093elabDecl' what info (PRecord doc s f tyn ty cdoc cn cty)
2095elabDecl' what info (PRecord doc s f tyn ty cdoc cn cty)
2094 | what /= ETypes
2096 | what /= ETypes
2095 = do iLOG $ "Elaborating record " ++ show tyn
2097 = do iLOG $ "Elaborating record " ++ show tyn