Commit 623e5fbb authored by simonpj's avatar simonpj
Browse files

[project @ 2004-01-05 09:35:39 by simonpj]

Buglet in desugaring instance declarations
parent 8c92ca4a
...@@ -213,20 +213,24 @@ repTyClD (L loc d) = do { dsWarn (loc, hang msg 4 (ppr d)) ; ...@@ -213,20 +213,24 @@ repTyClD (L loc d) = do { dsWarn (loc, hang msg 4 (ppr d)) ;
where where
msg = ptext SLIT("Cannot desugar this Template Haskell declaration:") msg = ptext SLIT("Cannot desugar this Template Haskell declaration:")
repInstD' (L loc (InstDecl ty binds _)) repInstD' (L loc (InstDecl ty binds _)) -- Ignore user pragmas for now
-- Ignore user pragmas for now = do { i <- addTyVarBinds tvs $ \tv_bndrs ->
= do { cxt1 <- repContext cxt -- We must bring the type variables into scope, so their occurrences
; inst_ty1 <- repPred (HsClassP cls tys) -- don't fail, even though the binders don't appear in the resulting
; ss <- mkGenSyms (collectHsBindBinders binds) -- data structure
; binds1 <- addBinds ss (rep_binds binds) do { cxt1 <- repContext cxt
; decls1 <- coreList decQTyConName binds1 ; inst_ty1 <- repPred (HsClassP cls tys)
; decls2 <- wrapNongenSyms ss decls1 ; ss <- mkGenSyms (collectHsBindBinders binds)
-- wrapNonGenSyms: do not clone the class op names! ; binds1 <- addBinds ss (rep_binds binds)
-- They must be called 'op' etc, not 'op34' ; decls1 <- coreList decQTyConName binds1
; i <- repInst cxt1 inst_ty1 decls2 ; decls2 <- wrapNongenSyms ss decls1
-- wrapNonGenSyms: do not clone the class op names!
-- They must be called 'op' etc, not 'op34'
; repInst cxt1 inst_ty1 decls2 }
; return (loc, i)} ; return (loc, i)}
where where
(_, cxt, cls, tys) = splitHsInstDeclTy (unLoc ty) (tvs, cxt, cls, tys) = splitHsInstDeclTy (unLoc ty)
------------------------------------------------------- -------------------------------------------------------
-- Constructors -- Constructors
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment