summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonpj <unknown>2003-02-14 13:01:32 +0000
committersimonpj <unknown>2003-02-14 13:01:32 +0000
commit9d3463add032cf170615d3fe9fe4f3e7a1d99ff5 (patch)
treee978966ccab79496bea87683046d2200e0bd9c8d
parent21934a0a7bb582b57d737164699548eae0399fb7 (diff)
downloadhaskell-9d3463add032cf170615d3fe9fe4f3e7a1d99ff5.tar.gz
[project @ 2003-02-14 13:01:32 by simonpj]
Fix for deriving of records with leading underscore, and corresponding lex
-rw-r--r--ghc/compiler/typecheck/TcGenDeriv.lhs6
1 files changed, 4 insertions, 2 deletions
diff --git a/ghc/compiler/typecheck/TcGenDeriv.lhs b/ghc/compiler/typecheck/TcGenDeriv.lhs
index ac6abdf56b..bafa008514 100644
--- a/ghc/compiler/typecheck/TcGenDeriv.lhs
+++ b/ghc/compiler/typecheck/TcGenDeriv.lhs
@@ -854,10 +854,11 @@ gen_Read_binds get_fixity tycon
BindStmt (VarPat a) (mkHsVarApps reset_RDR [readPrec_RDR]) loc]
-- When reading field labels we might encounter
- -- a = 3
+ -- a = 3
+ -- _a = 3
-- or (#) = 4
-- Note the parens!
- read_lbl lbl | isAlpha (head lbl_str)
+ read_lbl lbl | is_id_start (head lbl_str)
= [bindLex (ident_pat lbl_lit)]
| otherwise
= [read_punc "(",
@@ -866,6 +867,7 @@ gen_Read_binds get_fixity tycon
where
lbl_str = occNameUserString (getOccName (fieldLabelName lbl))
lbl_lit = mkHsString lbl_str
+ is_id_start c = isAlpha c || c == '_'
\end{code}