aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonmar <unknown>2005-10-10 15:02:55 +0000
committersimonmar <unknown>2005-10-10 15:02:55 +0000
commitf7e520ca93e55be3e6b05f4944e7920eda922d9e (patch)
treec378c024e826ca12b697284458227d9e9692fd27
parent60f69f82eacd8799f7c52a24934d2e87320bd192 (diff)
[haddock @ 2005-10-10 15:02:55 by simonmar]
extractRecSel: ignore non-record constructors (fixes a crash when using datatypes with a mixture of record and non-record style constructors).
-rw-r--r--src/Main.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Main.hs b/src/Main.hs
index deda34ca..0c9cdb0a 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -827,8 +827,8 @@ extractClassDecl _ _ _ d =
extractRecSel :: HsName -> Module -> HsName -> [HsName] -> [HsConDecl]
-> HsDecl
extractRecSel _ _ _ _ [] = error "extractRecSel: selector not found"
-extractRecSel _ _ _ _ (d@(HsConDecl{}):_) =
- error $ "Main.extractRecSel: unexpected (con)decl" ++ show d
+extractRecSel nm mdl t tvs (d@(HsConDecl{}):rest) =
+ extractRecSel nm mdl t tvs rest
extractRecSel nm mdl t tvs (HsRecDecl loc _ _tvs _ fields _mb_doc : rest)
| (HsFieldDecl ns ty mb_doc : _) <- matching_fields
= HsTypeSig loc [nm] (HsTyFun data_ty (unbang ty)) mb_doc