InstDecl(..), ConDecl(..), BangType(..),
PendingSplice, splitHsInstDeclTy,
placeHolderType, tyClDeclNames,
- collectHsBinders, collectPatBinders, collectPatsBinders,
+ collectHsBinders, collectPatBinders,
+ collectMonoBinders, collectPatsBinders,
hsTyVarName, hsConArgs
)
import qualified OccName( varName, tcName )
import Module ( Module, mkModule, moduleUserString )
-import Id ( Id, idType )
+import Id ( Id, idType, mkLocalId )
import Name ( mkExternalName )
import OccName ( mkOccFS )
import NameEnv
; let ss = mkGenSyms (collectMonoBinders binds)
; binds1 <- addBinds ss (rep_monobind binds)
; decls1 <- coreList decQTyConName binds1
- ; i <- repInst cxt1 inst_ty1
- (wrapNonGenSyms ss decls1)
+ ; decls2 <- wrapNongenSyms ss decls1
-- wrapNonGenSyms: do not clone the class op names!
-- They must be called 'op' etc, not 'op34'
+ ; i <- repInst cxt1 inst_ty1 decls2
; return (loc, i)}
where
(tvs, cxt, cls, tys) = splitHsInstDeclTy ty
-- Generate a fresh name for a locally bound entity
mkGenSym :: Name -> GenSymBind
+-- Does not need to be monadic, becuase we can use the
+-- existing name. For example:
+-- [| \x_77 -> x_77 + x_77 |]
+-- desugars to
+-- do { x_77 <- genSym "x"; .... }
+-- We use the same x_77 in the desugared program, but with the type Bndr
+-- instead of Int
+
mkGenSym nm = (nm, mkLocalId nm stringTy)
-- Ditto for a list of names