From dbcf03e004e845e9ec483a17cf306162e0a5bbd4 Mon Sep 17 00:00:00 2001 From: Roman Leshchinskiy Date: Mon, 9 Jul 2007 05:38:19 +0000 Subject: [PATCH] Utilities for handling closure types during vectorisation --- compiler/vectorise/Vectorise.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compiler/vectorise/Vectorise.hs b/compiler/vectorise/Vectorise.hs index d662142..67b82c1 100644 --- a/compiler/vectorise/Vectorise.hs +++ b/compiler/vectorise/Vectorise.hs @@ -273,3 +273,14 @@ vectType (ForAllTy tv ty) vectType ty = pprPanic "vectType:" (ppr ty) +isClosureTyCon :: TyCon -> Bool +isClosureTyCon tc = tyConUnique tc == closureTyConKey + +splitClosureTy :: Type -> (Type, Type) +splitClosureTy ty + | Just (tc, [arg_ty, res_ty]) <- splitTyConApp_maybe ty + , isClosureTyCon tc + = (arg_ty, res_ty) + + | otherwise = pprPanic "splitClosureTy" (ppr ty) + -- 1.7.10.4