@@ -660,11 +660,13 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
660660 i <- getIState
661661 inf <- isTyInferred fname
662662
663− -- Check if we have "with" patterns outside of "with" block
664− when (isOutsideWith lhs_in && (not $ null withs)) $
663+ -- Check if we have extra "with" patterns
664+ when (not $ null withs) $
665665 ierror (At (fromMaybe NoFC $ highestFC lhs_in_as)
666666 (Elaborating "left hand side of " fname Nothing
667− (Msg "unexpected patterns outside of \"with\" block")))
667+ (Msg $ if isOutsideWith lhs_in
668+ then "unexpected patterns outside of \"with\" block"
669+ else "unexpected extra \"with\" patterns")))
668670
669671 -- get the parameters first, to pass through to any where block
670672 let fn_ty = case lookupTy fname ctxt of