@@ -7,6 +7,7 @@ import Idris.ElabDecls
8import Core.CoreParser
8import Core.CoreParser
9import Core.TT
9import Core.TT
11import Text.ParserCombinators.Parsec
12import Text.ParserCombinators.Parsec
12import Text.ParserCombinators.Parsec.Expr
13import Text.ParserCombinators.Parsec.Expr
@@ -486,6 +487,11 @@ pPattern syn = do fc <- pfc
486 clause <- pClause syn
487 clause <- pClause syn
487 return (PClauses fc (MN 2 "_") [clause]) -- collect together later
488 return (PClauses fc (MN 2 "_") [clause]) -- collect together later
490+whereSyn :: Name -> SyntaxInfo -> [PTerm] -> SyntaxInfo
491+whereSyn n syn args = let ns = concatMap allNamesIn args
493+ syn { no_imp = nub (ni ++ ns) }
489pClause :: SyntaxInfo -> IParser PClause
495pClause :: SyntaxInfo -> IParser PClause
490pClause syn
496pClause syn
491 = try (do n <- pfName
497 = try (do n <- pfName
@@ -495,7 +501,10 @@ pClause syn
495 wargs <- many (pWExpr syn)
501 wargs <- many (pWExpr syn)
496 lchar '='
502 lchar '='
497 rhs <- pExpr syn
503 rhs <- pExpr syn
505+ let ctxt = tt_ctxt ist
506+ let wsyn = whereSyn n syn (map getTm iargs ++ args ++ wargs)
498− wheres <- choice [pWhereblock syn, do lchar ';'; return []]
507+ wheres <- choice [pWhereblock wsyn, do lchar ';'; return []]
499 return $ PClause n (PApp fc (PRef fc n)
508 return $ PClause n (PApp fc (PRef fc n)
500 (iargs ++ map PExp args)) wargs rhs wheres)
509 (iargs ++ map PExp args)) wargs rhs wheres)
501 <|> try (do n <- pfName
510 <|> try (do n <- pfName