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