@@ -7,6 +7,7 @@ import Idris.ElabDecls
77
88import Core.CoreParser
99import Core.TT
10+import Core.Evaluate
1011
1112import Text.ParserCombinators.Parsec
1213import Text.ParserCombinators.Parsec.Expr
@@ -486,6 +487,11 @@ pPattern syn = do fc <- pfc
486487 clause <- pClause syn
487488 return (PClauses fc (MN 2 "_") [clause]) -- collect together later
488489
490+whereSyn :: Name -> SyntaxInfo -> [PTerm] -> SyntaxInfo
491+whereSyn n syn args = let ns = concatMap allNamesIn args
492+ ni = no_imp syn in
493+ syn { no_imp = nub (ni ++ ns) }
494+
489495pClause :: SyntaxInfo -> IParser PClause
490496pClause syn
491497 = try (do n <- pfName
@@ -495,7 +501,10 @@ pClause syn
495501 wargs <- many (pWExpr syn)
496502 lchar '='
497503 rhs <- pExpr syn
498− wheres <- choice [pWhereblock syn, do lchar ';'; return []]
504+ ist <- getState
505+ let ctxt = tt_ctxt ist
506+ let wsyn = whereSyn n syn (map getTm iargs ++ args ++ wargs)
507+ wheres <- choice [pWhereblock wsyn, do lchar ';'; return []]
499508 return $ PClause n (PApp fc (PRef fc n)
500509 (iargs ++ map PExp args)) wargs rhs wheres)
501510 <|> try (do n <- pfName