@@ -134,7 +134,10 @@ loadSource lidr f
134134 -- Now add all the declarations to the context
135135 v <- verbose
136136 when v $ iputStrLn $ "Type checking " ++ f
137− elabDecls toplevel ds
137+ -- we totality check after every Mutual block, so if
138+ -- anything is a single definition, wrap it in a
139+ -- mutual block on its own
140+ elabDecls toplevel (map toMutual ds)
138141 i <- getIState
139142 -- simplify every definition do give the totality checker
140143 -- a better chance
@@ -144,8 +147,8 @@ loadSource lidr f
144147 -- build size change graph from simplified definitions
145148 iLOG "Totality checking"
146149 i <- getIState
147− mapM_ buildSCG (idris_totcheck i)
148− mapM_ checkDeclTotality (idris_totcheck i)
150+-- mapM_ buildSCG (idris_totcheck i)
151+-- mapM_ checkDeclTotality (idris_totcheck i)
149152 iLOG ("Finished " ++ f)
150153 ibcsd <- valIBCSubDir i
151154 iLOG "Universe checking"
@@ -166,6 +169,14 @@ loadSource lidr f
166169 namespaces [] ds = ds
167170 namespaces (x:xs) ds = [PNamespace x (namespaces xs ds)]
168171
172+ toMutual m@(PMutual _ d) = m
173+ toMutual x = let r = PMutual (FC "single mutual" 0) [x] in
174+ case x of
175+ PClauses _ _ _ _ -> r
176+ PClass _ _ _ _ _ _ _ -> r
177+ PInstance _ _ _ _ _ _ _ _ -> r
178+ _ -> x
179+
169180addHides :: [(Name, Maybe Accessibility)] -> Idris ()
170181addHides xs = do i <- getIState
171182 let defh = default_access i