1 module VectType ( vectTyCon, vectType )
4 #include "HsVersions.h"
15 import Control.Monad ( liftM2 )
17 vectTyCon :: TyCon -> VM TyCon
19 | isFunTyCon tc = builtin closureTyCon
20 | isBoxedTupleTyCon tc = return tc
21 | isUnLiftedTyCon tc = return tc
25 Just tc' -> return tc'
27 -- FIXME: just for now
28 Nothing -> pprTrace "ccTyCon:" (ppr tc) $ return tc
30 vectType :: Type -> VM Type
31 vectType ty | Just ty' <- coreView ty = vectType ty'
32 vectType (TyVarTy tv) = return $ TyVarTy tv
33 vectType (AppTy ty1 ty2) = liftM2 AppTy (vectType ty1) (vectType ty2)
34 vectType (TyConApp tc tys) = liftM2 TyConApp (vectTyCon tc) (mapM vectType tys)
35 vectType (FunTy ty1 ty2) = liftM2 TyConApp (builtin closureTyCon)
36 (mapM vectType [ty1,ty2])
37 vectType ty@(ForAllTy _ _)
39 mdicts <- mapM paDictArgType tyvars
40 mono_ty' <- vectType mono_ty
41 return $ tyvars `mkForAllTys` ([dict | Just dict <- mdicts] `mkFunTys` mono_ty')
43 (tyvars, mono_ty) = splitForAllTys ty
45 vectType ty = pprPanic "vectType:" (ppr ty)