#1527: parsing error message that could be improved
-------------------------+--------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: lowest | Milestone:
Component: Compiler | Version: 6.6.1
Severity: minor | Resolution:
Keywords: parser | Difficulty: Unknown
Os: Unknown | Testcase:
Architecture: Unknown |
-------------------------+--------------------------------------------------
Old description:
> This is just barely a bug. The following code uses do notation and gets
> a left arrow in the wrong direction:
>
> tcRho (TupleE exps) (Check exp_ty)
> = do { tys <- unTupleType exp_ty
> ; checkTuple (text "term" <+> ppr (TupleE exps)) exps tys
> ; exps' -> mapM (uncurry checkRho) (zip exps tys)
> ; return $ ftuple exps'
> }
>
> The error message is: TxPgm.hs:323:44: Parse error in pattern
>
> The suggestion of 'pattern' is surprising here, and so is the position of
> the error message. I know parsing is a black art, and I don't know what
> technology GHC is using, but if this message could be improved that would
> be a Good Thing.
>
> Norman
New description:
This is just barely a bug. The following code uses do notation and gets a
left arrow in the wrong direction:
{{{
tcRho (TupleE exps) (Check exp_ty)
= do { tys <- unTupleType exp_ty
; checkTuple (text "term" <+> ppr (TupleE exps)) exps tys
; exps' -> mapM (uncurry checkRho) (zip exps tys)
; return $ ftuple exps'
}
}}}
The error message is: TxPgm.hs:323:44: Parse error in pattern
The suggestion of 'pattern' is surprising here, and so is the position of
the error message. I know parsing is a black art, and I don't know what
technology GHC is using, but if this message could be improved that would
be a Good Thing.
Norman
Comment (by Isaac Dupree):
Well, exps' is supposed to be a pattern there, so mentioning "pattern"
makes sense to me... given the possibilities, it might be more accurate to
say "parse error in pattern or expression" ("... or let", to be
comprehensive about do-notation possibilities).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1527>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs