From f7e520ca93e55be3e6b05f4944e7920eda922d9e Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 10 Oct 2005 15:02:55 +0000 Subject: [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). --- src/Main.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3