summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/vectorise/Vectorise/Type/TyConDecl.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/vectorise/Vectorise/Type/TyConDecl.hs b/compiler/vectorise/Vectorise/Type/TyConDecl.hs
index 38af2dc846..f0d05b0413 100644
--- a/compiler/vectorise/Vectorise/Type/TyConDecl.hs
+++ b/compiler/vectorise/Vectorise/Type/TyConDecl.hs
@@ -48,7 +48,7 @@ vectTyConDecl tycon
-- vectorise superclass constraint (types)
; theta' <- mapM vectType (classSCTheta cls)
- -- vectorise method selectors and add them to the vectorisation map
+ -- vectorise method selectors
; methods' <- sequence [ vectMethod id meth | (id, meth) <- classOpItems cls]
-- keep the original recursiveness flag
@@ -75,6 +75,11 @@ vectTyConDecl tycon
Just datacon' = tyConSingleDataCon_maybe tycon'
; defDataCon datacon datacon'
+ -- the original superclass and methods selectors must map to the vectorised ones
+ ; let selIds = classAllSelIds cls
+ selIds' = classAllSelIds cls'
+ ; zipWithM_ defGlobalVar selIds selIds'
+
-- return the type constructor of the vectorised class
; return tycon'
}
@@ -110,7 +115,7 @@ vectTyConDecl tycon
| otherwise
= cantVectorise "Can't vectorise exotic type constructor" (ppr tycon)
--- |Vectorise a class method.
+-- |Vectorise a class method. (Don't enter into the vectorisation map yet.)
--
vectMethod :: Id -> DefMeth -> VM (Name, DefMethSpec, Type)
vectMethod id defMeth
@@ -119,7 +124,6 @@ vectMethod id defMeth
-- Create a name for the vectorised method.
; id' <- mkVectId id typ'
- ; defGlobalVar id id'
-- When we call buildClass in vectTyConDecl, it adds foralls and dictionaries
-- to the types of each method. However, the types we get back from vectType