- let
- (n, arg_pats)
- = case lpat of
- VarPatIn x -> (x, lpats)
- ConPatIn x [] -> (x, lpats)
- ConOpPatIn x op y -> (op, x:y:lpats)
- _ -> -- sorry about the weedy msg; the parser missed this one
- pprError "ERROR: an illegal `application' of a pattern to another one:"
- (ppInterleave ppSP (map (ppr PprForUser) (lpat:lpats)))
- in
+ (case lpat of
+ VarPatIn x -> returnUgn (x, lpats)
+ ConPatIn x [] -> returnUgn (x, lpats)
+ ConOpPatIn x op y -> returnUgn (op, x:y:lpats)
+ _ -> getSrcLocUgn `thenUgn` \ loc ->
+ let
+ err = addErrLoc loc "Illegal pattern `application'"
+ (\sty -> ppInterleave ppSP (map (ppr sty) (lpat:lpats)))
+ msg = ppShow 100 (err PprForUser)
+ in
+ ioToUgnM (hPutStr stderr msg) `thenUgn` \ _ ->
+ ioToUgnM (ghcExit 1) `thenUgn` \ _ ->
+ returnUgn (error "ReadPrefix")
+
+ ) `thenUgn` \ (n, arg_pats) ->